Added multi jvm test script and removed J2SE-1.5 compile errors.
This commit is contained in:
parent
6f2815491b
commit
0ac4faa613
28
build.txt
28
build.txt
|
@ -1,24 +1,11 @@
|
|||
|
||||
Building X4O
|
||||
|
||||
You need a few software packages;
|
||||
- java 1.5 or higher.
|
||||
- maven 3 or higher.
|
||||
Software requirements;
|
||||
- JDK 1.5++
|
||||
- Maven 3.0.1++ (3.0.3++ for jdk5)
|
||||
|
||||
|
||||
-- Run multi jvm test --
|
||||
|
||||
todo make maven like;
|
||||
note2: this does need maven 3.0.3++ in 3.0.1 there is some java6 classes.
|
||||
|
||||
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64/;mvn clean test
|
||||
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/;mvn clean test
|
||||
export JAVA_HOME=/usr/lib/jvm/j2sdk1.6-oracle/;mvn clean test
|
||||
export JAVA_HOME=/usr/lib/jvm/j2sdk1.7-oracle/;mvn clean test
|
||||
export JAVA_HOME=/usr/lib/jvm/jdk1.5.0_22/;~/bin/mvn3/apache-maven-3.0.3/bin/mvn clean test
|
||||
#not working;
|
||||
#export JAVA_HOME=/usr/lib/jvm/java-1.5.0-gcj-4.7/;~/bin/mvn3/apache-maven-3.0.3/bin/mvn clean test
|
||||
|
||||
-- Create package --
|
||||
|
||||
cd project-root/;
|
||||
|
@ -43,6 +30,15 @@ mvn -Pant-update-schema-eld package;
|
|||
note: the do 'install' is because of circle plugins.
|
||||
|
||||
|
||||
-- Run multi jvm test --
|
||||
|
||||
Run tests in all jvms;
|
||||
src/main/build/jvm-test.sh
|
||||
|
||||
Run tests in single jvm;
|
||||
src/main/build/jvm-test.sh /usr/lib/jvm/jdk1.5.0_22/
|
||||
|
||||
|
||||
-- Make release build --
|
||||
|
||||
# todo make work
|
||||
|
|
88
src/main/build/jvm-test.sh
Executable file
88
src/main/build/jvm-test.sh
Executable file
|
@ -0,0 +1,88 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2004-2013, Willem Cazander
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
# that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
# following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
# the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# Config script
|
||||
# note: 3.0.3++ as in prev version there are some java6 classes.
|
||||
MVN=~/bin/mvn3/apache-maven-3.0.3/bin/mvn;
|
||||
MVN_ARG="clean test";
|
||||
JVMS="
|
||||
/usr/lib/jvm/java-6-openjdk-amd64/
|
||||
/usr/lib/jvm/java-7-openjdk-amd64/
|
||||
/usr/lib/jvm/j2sdk1.6-oracle/
|
||||
/usr/lib/jvm/j2sdk1.7-oracle/
|
||||
/usr/lib/jvm/jdk1.5.0_22/"
|
||||
#/usr/lib/jvm/java-1.5.0-gcj-4.7/
|
||||
|
||||
# Goto project root;
|
||||
cd `dirname $0`/../../..;
|
||||
|
||||
# Print meta data
|
||||
echo "Starting jvm tests";
|
||||
echo "Maven cmd: $MVN";
|
||||
echo "Maven arg: $MVN_ARG";
|
||||
|
||||
# Check conditions
|
||||
if [ "" != "$1" ]; then
|
||||
echo "Starting single jvm test;";
|
||||
JVMS=$1;
|
||||
else
|
||||
echo "Starting jvm tests;";
|
||||
fi;
|
||||
echo "";
|
||||
|
||||
# Run tests per jvm
|
||||
for JVM in $JVMS; do
|
||||
JVM_KEY=`echo $JVM | sed 's/\/\|\-//g'|tr -d '.'`;
|
||||
echo "Running in jvm: $JVM";
|
||||
if [ -e $JVM ]; then
|
||||
export JAVA_HOME=$JVM;
|
||||
$MVN $MVN_ARG;
|
||||
RESULT=$?;
|
||||
else
|
||||
RESULT="JVM path not found";
|
||||
fi;
|
||||
|
||||
export "JVM_RESULT""$JVM_KEY"="$RESULT";
|
||||
done;
|
||||
|
||||
EXIT=0;
|
||||
echo "";
|
||||
echo "Test summary;";
|
||||
for JVM in $JVMS; do
|
||||
JVM_KEY=`echo $JVM | sed 's/\/\|\-//g'|tr -d '.'`;
|
||||
RESULT=`eval echo \\${"JVM_RESULT""$JVM_KEY"}`;
|
||||
echo -n "Result; ";
|
||||
if [ "$RESULT" = "0" ]; then
|
||||
echo -n "Success";
|
||||
else
|
||||
echo -n "Failure";
|
||||
EXIT=1;
|
||||
fi;
|
||||
echo " in jvm: $JVM (status:$RESULT)";
|
||||
done;
|
||||
|
||||
echo "All done.";
|
||||
|
||||
# EOF
|
||||
exit $EXIT;
|
|
@ -164,7 +164,7 @@ public final class X4ODriverManager {
|
|||
if (language==null) {
|
||||
throw new NullPointerException("Can't provider driver for null language.");
|
||||
}
|
||||
if (language.isEmpty()) {
|
||||
if (language.length()==0) {
|
||||
throw new IllegalArgumentException("Can't provider driver for empty language.");
|
||||
}
|
||||
if (instance.drivers.containsKey(language)) {
|
||||
|
|
|
@ -99,7 +99,7 @@ public abstract class AbstractElementClassBase extends AbstractElementMetaBase i
|
|||
if (namespaceUri==null) {
|
||||
throw new NullPointerException("Can't add parent tag with null namespace uri.");
|
||||
}
|
||||
if (namespaceUri.isEmpty()) {
|
||||
if (namespaceUri.length()==0) {
|
||||
throw new IllegalArgumentException("Can't add parent tag with empty namespace uri.");
|
||||
}
|
||||
List<String> tags = elementParents.get(namespaceUri);
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.io.File;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.element.Element;
|
||||
|
@ -76,7 +75,7 @@ public class X4OWriterContextTest extends TestCase {
|
|||
X4OWriterContext<TestObjectRoot> writer = driver.createWriterContext();
|
||||
|
||||
writer.writeFileContext(createContext(), outputFile);
|
||||
String text = new Scanner( outputFile ).useDelimiter("\\A").next();
|
||||
String text = X4OWriterTest.readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
|
@ -107,7 +106,7 @@ public class X4OWriterContextTest extends TestCase {
|
|||
X4OWriterContext<TestObjectRoot> writer = driver.createWriterContext();
|
||||
|
||||
writer.writeFileContext(createContext(), outputFile.getAbsolutePath());
|
||||
String text = new Scanner( outputFile ).useDelimiter("\\A").next();
|
||||
String text = X4OWriterTest.readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
|
@ -143,7 +142,7 @@ public class X4OWriterContextTest extends TestCase {
|
|||
} finally {
|
||||
outputStream.close();
|
||||
}
|
||||
String text = new Scanner( outputFile ).useDelimiter("\\A").next();
|
||||
String text = X4OWriterTest.readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
|
|
|
@ -23,11 +23,15 @@
|
|||
package org.x4o.xml.io;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Scanner;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
|
@ -47,13 +51,30 @@ import junit.framework.TestCase;
|
|||
*/
|
||||
public class X4OWriterTest extends TestCase {
|
||||
|
||||
|
||||
private File createOutputFile() throws IOException {
|
||||
File outputFile = File.createTempFile("test-writer", ".xml");
|
||||
outputFile.deleteOnExit();
|
||||
return outputFile;
|
||||
}
|
||||
|
||||
static public String readFile(File file) throws IOException {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file),Charset.forName("UTF-8")));
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line = br.readLine();
|
||||
while (line != null) {
|
||||
sb.append(line);
|
||||
sb.append('\n');
|
||||
line = br.readLine();
|
||||
}
|
||||
String out = sb.toString();
|
||||
//System.out.println(out);
|
||||
return out;
|
||||
} finally {
|
||||
br.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void testWriterSwiXmlOutput() throws Exception {
|
||||
Accelerator3 ac3 = new Accelerator3(false);
|
||||
SwingEngine engine = new SwingEngine(ac3);
|
||||
|
@ -86,7 +107,7 @@ public class X4OWriterTest extends TestCase {
|
|||
|
||||
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
|
||||
writer.writeFile(root, outputFile);
|
||||
String text = new Scanner( outputFile ).useDelimiter("\\A").next();
|
||||
String text = readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
|
@ -103,7 +124,7 @@ public class X4OWriterTest extends TestCase {
|
|||
|
||||
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
|
||||
writer.writeFile(root, outputFile.getAbsolutePath());
|
||||
String text = new Scanner( outputFile ).useDelimiter("\\A").next();
|
||||
String text = readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
|
@ -127,7 +148,7 @@ public class X4OWriterTest extends TestCase {
|
|||
}
|
||||
|
||||
writer.writeFile(root, outputFile.getAbsolutePath());
|
||||
String text = new Scanner( outputFile ).useDelimiter("\\A").next();
|
||||
String text = readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
|
|
|
@ -79,10 +79,10 @@ public class ApiDocNodeWriterBean implements ApiDocNodeWriter {
|
|||
if (ammo.nodeBodyOrder()!=-1) {
|
||||
methodWriter.setNodeBodyOrder(ammo.nodeBodyOrder());
|
||||
}
|
||||
if (!ammo.contentGroup().isEmpty()) {
|
||||
if (ammo.contentGroup().length()>0) {
|
||||
methodWriter.setContentGroup(ammo.contentGroup());
|
||||
}
|
||||
if (!ammo.contentGroupType().isEmpty()) {
|
||||
if (ammo.contentGroupType().length()>0) {
|
||||
methodWriter.setContentGroupType(ammo.contentGroupType());
|
||||
}
|
||||
doc.addNodeBodyWriter(methodWriter);
|
||||
|
|
Loading…
Reference in a new issue