Changed meta package and added junit tests
This commit is contained in:
parent
897fe80357
commit
226c1f0425
35 changed files with 822 additions and 383 deletions
|
|
@ -37,6 +37,24 @@ import junit.framework.TestCase;
|
|||
*/
|
||||
public class X4ODriverManagerTest extends TestCase {
|
||||
|
||||
public void testDefaultLanguageVersionSelect() throws Exception {
|
||||
String version = X4ODriverManager.getDefaultLanguageVersion(new String[]{"1.0","2.0","3.0"});
|
||||
assertNotNull(version);
|
||||
assertEquals("3.0",version);
|
||||
}
|
||||
|
||||
public void testDefaultLanguageVersionEmpty() throws Exception {
|
||||
String version = X4ODriverManager.getDefaultLanguageVersion(new String[]{});
|
||||
assertNotNull(version);
|
||||
assertEquals(X4ODriver.DEFAULT_LANGUAGE_VERSION,version);
|
||||
}
|
||||
|
||||
public void testDefaultLanguageVersionNull() throws Exception {
|
||||
String version = X4ODriverManager.getDefaultLanguageVersion(null);
|
||||
assertNotNull(version);
|
||||
assertEquals(X4ODriver.DEFAULT_LANGUAGE_VERSION,version);
|
||||
}
|
||||
|
||||
public void testLanguageNull() throws Exception {
|
||||
String language = null;
|
||||
Exception e = null;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,217 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2012, 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.
|
||||
*/
|
||||
|
||||
package org.x4o.xml.io;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
import org.x4o.xml.lang.X4OLanguageContext;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestBean;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* X4OAbstractReaderContextTest.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 15, 2013
|
||||
*/
|
||||
public class X4OAbstractReaderContextTest extends TestCase {
|
||||
|
||||
private File copyResourceToTempFile() throws IOException {
|
||||
File tempFile = File.createTempFile("test-resource", ".xml");
|
||||
tempFile.deleteOnExit();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
X4OWriter<TestObjectRoot> writer = driver.createWriter();
|
||||
try {
|
||||
writer.writeFile(reader.readResource("tests/attributes/test-bean.xml"), tempFile);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
public void testReadFileName() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
File xmlFile = copyResourceToTempFile();
|
||||
X4OLanguageContext context = reader.readFileContext(xmlFile.getAbsolutePath());
|
||||
TestObjectRoot root = (TestObjectRoot)context.getRootElement().getElementObject();
|
||||
assertNotNull(root);
|
||||
assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
assertNotNull(bean);
|
||||
}
|
||||
|
||||
public void testReadFileNameNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
Exception e = null;
|
||||
try {
|
||||
String nullFileName = null;
|
||||
reader.readFileContext(nullFileName);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("null"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("fileName"));
|
||||
}
|
||||
|
||||
public void testReadFile() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
File xmlFile = copyResourceToTempFile();
|
||||
X4OLanguageContext context = reader.readFileContext(xmlFile);
|
||||
TestObjectRoot root = (TestObjectRoot)context.getRootElement().getElementObject();
|
||||
assertNotNull(root);
|
||||
assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
assertNotNull(bean);
|
||||
}
|
||||
|
||||
public void testReadFileNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
Exception e = null;
|
||||
try {
|
||||
File nullFile = null;
|
||||
reader.readFileContext(nullFile);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("null"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("file"));
|
||||
}
|
||||
|
||||
public void testReadFileNotExists() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
Exception e = null;
|
||||
try {
|
||||
File tempFile = File.createTempFile("test-file", ".xml");
|
||||
tempFile.delete();
|
||||
reader.readFileContext(tempFile);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",FileNotFoundException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("exists"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("File"));
|
||||
}
|
||||
|
||||
|
||||
public void testReadResource() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
X4OLanguageContext context = reader.readResourceContext("tests/attributes/test-bean.xml");
|
||||
TestObjectRoot root = (TestObjectRoot)context.getRootElement().getElementObject();
|
||||
assertNotNull(root);
|
||||
}
|
||||
|
||||
public void testReadResourceNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
Exception e = null;
|
||||
try {
|
||||
reader.readResourceContext(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("null"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("resourceName"));
|
||||
}
|
||||
|
||||
public void testReadString() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
X4OLanguageContext context = reader.readStringContext(
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
|
||||
"<root:root xmlns:root=\"http://test.x4o.org/xml/ns/test-root\" xmlns=\"http://test.x4o.org/xml/ns/test-lang\">"+
|
||||
"<testBean privateIntegerTypeField=\"987654321\"/>"+
|
||||
"</root:root>"
|
||||
);
|
||||
TestObjectRoot root = (TestObjectRoot)context.getRootElement().getElementObject();
|
||||
assertNotNull(root);
|
||||
assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
assertNotNull(bean);
|
||||
assertEquals("987654321", ""+bean.getPrivateIntegerTypeField());
|
||||
}
|
||||
|
||||
public void testReadStringNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
Exception e = null;
|
||||
try {
|
||||
reader.readStringContext(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("null"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("string"));
|
||||
}
|
||||
|
||||
public void testReadUrl() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
URL xmlUrl = Thread.currentThread().getContextClassLoader().getResource("tests/attributes/test-bean.xml");
|
||||
X4OLanguageContext context = reader.readUrlContext(xmlUrl);
|
||||
TestObjectRoot root = (TestObjectRoot)context.getRootElement().getElementObject();
|
||||
assertNotNull(root);
|
||||
assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
assertNotNull(bean);
|
||||
}
|
||||
|
||||
public void testReadUrlNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
|
||||
Exception e = null;
|
||||
try {
|
||||
reader.readUrlContext(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("null"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("url"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2012, 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.
|
||||
*/
|
||||
|
||||
package org.x4o.xml.io;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestBean;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* X4OAbstractReaderTest.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 15, 2013
|
||||
*/
|
||||
public class X4OAbstractReaderTest extends TestCase {
|
||||
|
||||
private File copyResourceToTempFile() throws IOException {
|
||||
File tempFile = File.createTempFile("test-resource", ".xml");
|
||||
tempFile.deleteOnExit();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
X4OWriter<TestObjectRoot> writer = driver.createWriter();
|
||||
try {
|
||||
writer.writeFile(reader.readResource("tests/attributes/test-bean.xml"), tempFile);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
|
||||
public void testReadResource() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
|
||||
assertNotNull(root);
|
||||
}
|
||||
|
||||
public void testReadResourceNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
reader.readResource(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("null"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("resourceName"));
|
||||
}
|
||||
|
||||
public void testReadString() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
TestObjectRoot root = reader.readString(
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
|
||||
"<root:root xmlns:root=\"http://test.x4o.org/xml/ns/test-root\" xmlns=\"http://test.x4o.org/xml/ns/test-lang\">"+
|
||||
"<testBean privateIntegerTypeField=\"987654321\"/>"+
|
||||
"</root:root>"
|
||||
);
|
||||
assertNotNull(root);
|
||||
assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
assertNotNull(bean);
|
||||
assertEquals("987654321", ""+bean.getPrivateIntegerTypeField());
|
||||
}
|
||||
|
||||
public void testReadStringNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
reader.readString(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("null"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("string"));
|
||||
}
|
||||
|
||||
public void testReadUrl() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
URL xmlUrl = Thread.currentThread().getContextClassLoader().getResource("tests/attributes/test-bean.xml");
|
||||
TestObjectRoot root = reader.readUrl(xmlUrl);
|
||||
assertNotNull(root);
|
||||
assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
assertNotNull(bean);
|
||||
}
|
||||
|
||||
public void testReadUrlNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
reader.readUrl(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("null"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("url"));
|
||||
}
|
||||
|
||||
public void testReadFileName() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
File xmlFile = copyResourceToTempFile();
|
||||
TestObjectRoot root = reader.readFile(xmlFile.getAbsolutePath());
|
||||
assertNotNull(root);
|
||||
assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
assertNotNull(bean);
|
||||
}
|
||||
|
||||
public void testReadFileNameNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
String nullFileName = null;
|
||||
reader.readFile(nullFileName);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("null"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("fileName"));
|
||||
}
|
||||
|
||||
public void testReadFile() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
File xmlFile = copyResourceToTempFile();
|
||||
TestObjectRoot root = reader.readFile(xmlFile);
|
||||
assertNotNull(root);
|
||||
assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
assertNotNull(bean);
|
||||
}
|
||||
|
||||
public void testReadFileNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
File nullFile = null;
|
||||
reader.readFile(nullFile);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull("No exception",e);
|
||||
assertEquals("Wrong exception class",NullPointerException.class, e.getClass());
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("null"));
|
||||
assertTrue("Wrong exception message",e.getMessage().contains("file"));
|
||||
}
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ public class TestBean {
|
|||
public Character publicCharObjectField = new Character(' ');
|
||||
|
||||
public String publicStringObjectField = " ";
|
||||
public Date publicDateObjectField = new Date(0);
|
||||
//public Date publicDateObjectField = new Date(0); // TODO add date converters
|
||||
|
||||
|
||||
// private
|
||||
|
|
@ -84,7 +84,7 @@ public class TestBean {
|
|||
private Character privateCharObjectField = new Character(' ');
|
||||
|
||||
private String privateStringObjectField = " ";
|
||||
private Date privateDateObjectField = new Date(0);
|
||||
//private Date privateDateObjectField = new Date(0);
|
||||
|
||||
|
||||
// auto gen , get/set-ers
|
||||
|
|
@ -269,18 +269,18 @@ public class TestBean {
|
|||
public void setPublicStringObjectField(String publicStringObjectField) {
|
||||
this.publicStringObjectField = publicStringObjectField;
|
||||
}
|
||||
/**
|
||||
/*
|
||||
* @return the publicDateObjectField
|
||||
*/
|
||||
|
||||
public Date getPublicDateObjectField() {
|
||||
return publicDateObjectField;
|
||||
}
|
||||
/**
|
||||
}*/
|
||||
/*
|
||||
* @param publicDateObjectField the publicDateObjectField to set
|
||||
*/
|
||||
|
||||
public void setPublicDateObjectField(Date publicDateObjectField) {
|
||||
this.publicDateObjectField = publicDateObjectField;
|
||||
}
|
||||
}*/
|
||||
/**
|
||||
* @return the privateIntegerTypeField
|
||||
*/
|
||||
|
|
@ -461,16 +461,16 @@ public class TestBean {
|
|||
public void setPrivateStringObjectField(String privateStringObjectField) {
|
||||
this.privateStringObjectField = privateStringObjectField;
|
||||
}
|
||||
/**
|
||||
/*
|
||||
* @return the privateDateObjectField
|
||||
*/
|
||||
|
||||
public Date getPrivateDateObjectField() {
|
||||
return privateDateObjectField;
|
||||
}
|
||||
/**
|
||||
}*/
|
||||
/*
|
||||
* @param privateDateObjectField the privateDateObjectField to set
|
||||
*/
|
||||
|
||||
public void setPrivateDateObjectField(Date privateDateObjectField) {
|
||||
this.privateDateObjectField = privateDateObjectField;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
|||
152
x4o-driver/src/test/resources/META-INF/junit-defd/defd-lang.eld
Normal file
152
x4o-driver/src/test/resources/META-INF/junit-defd/defd-lang.eld
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2012, 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.
|
||||
|
||||
-->
|
||||
<root:module
|
||||
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
|
||||
xmlns:eld="http://eld.x4o.org/xml/ns/eld-lang"
|
||||
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
|
||||
providerName="test.x4o.org"
|
||||
name="Test Language"
|
||||
id="test-module"
|
||||
>
|
||||
|
||||
<eld:classBindingHandler id="Parent-Child" parentClass="org.x4o.xml.test.models.TestObjectParent" childClass="org.x4o.xml.test.models.TestObjectChild" addMethod="addTestObjectChild" getMethod="getTestObjectChilds">
|
||||
<eld:description>Binds the TestObjectChild to the TestObjectParent</eld:description>
|
||||
</eld:classBindingHandler>
|
||||
<eld:classBindingHandler id="Root-Child" parentClass="org.x4o.xml.test.models.TestObjectRoot" childClass="org.x4o.xml.test.models.TestObjectChild" addMethod="addChild" getMethod="getTestObjectChilds">
|
||||
<eld:description>Binds the TestBean to the TestObjectChild</eld:description>
|
||||
</eld:classBindingHandler>
|
||||
<eld:classBindingHandler id="Root-Parent" parentClass="org.x4o.xml.test.models.TestObjectRoot" childClass="org.x4o.xml.test.models.TestObjectParent" addMethod="addParent" getMethod="getTestObjectParents">
|
||||
<eld:description>Binds the TestObjectParent to the TestObjectRoot</eld:description>
|
||||
</eld:classBindingHandler>
|
||||
<eld:classBindingHandler id="Root-Bean" parentClass="org.x4o.xml.test.models.TestObjectRoot" childClass="org.x4o.xml.test.models.TestBean" addMethod="addTestBean" getMethod="getTestBeans">
|
||||
<eld:description>Binds the TestBean to the TestObjectRoot</eld:description>
|
||||
</eld:classBindingHandler>
|
||||
<eld:classBindingHandler id="JComponent-JComponent" parentClass="javax.swing.JComponent" childClass="javax.swing.JComponent" addMethod="addComponent" getMethod="">
|
||||
<eld:description>Binds j components.</eld:description>
|
||||
</eld:classBindingHandler>
|
||||
<eld:classBindingHandler id="JFrame-JPanel" parentClass="javax.swing.JFrame" childClass="javax.swing.JPanel" addMethod="add" getMethod="getComponents">
|
||||
<eld:description>Binds panel to frame components as unit check.</eld:description>
|
||||
</eld:classBindingHandler>
|
||||
|
||||
<eld:elementInterface id="Component" interfaceClass="java.awt.Component">
|
||||
<eld:description>Configs the Component based objects.</eld:description>
|
||||
<eld:attribute name="bounds">
|
||||
<conv:stringSplitConverter classTo="java.awt.Rectangle" split="," splitSize="4" singleToMethod="setRect" useNativeType="true">
|
||||
<conv:stringSplitConverterStep fromMethod="getX" fromOrder="1" toOrder="1"><conv:doubleConverter/></conv:stringSplitConverterStep>
|
||||
<conv:stringSplitConverterStep fromMethod="getY" fromOrder="2" toOrder="2"><conv:doubleConverter/></conv:stringSplitConverterStep>
|
||||
<conv:stringSplitConverterStep fromMethod="getWidth" fromOrder="3" toOrder="3"><conv:doubleConverter/></conv:stringSplitConverterStep>
|
||||
<conv:stringSplitConverterStep fromMethod="getHeight" fromOrder="4" toOrder="4"><conv:doubleConverter/></conv:stringSplitConverterStep>
|
||||
</conv:stringSplitConverter>
|
||||
</eld:attribute>
|
||||
</eld:elementInterface>
|
||||
|
||||
<eld:elementInterface id="JComponent" interfaceClass="javax.swing.JComponent">
|
||||
<eld:description>Configs the JComponent based objects.</eld:description>
|
||||
<eld:classBindingHandler id="JComponent-JComponent" parentClass="javax.swing.JComponent" childClass="javax.swing.JComponent" addMethod="add" getMethod="getComponents">
|
||||
<eld:description>Binds the JComponent to the JComponent.</eld:description>
|
||||
</eld:classBindingHandler>
|
||||
</eld:elementInterface>
|
||||
|
||||
<eld:configuratorGlobal bean.class="org.x4o.xml.test.element.TestElementConfigurator" id="testConfigGlobal">
|
||||
<eld:description>Test the global element configurator.</eld:description>
|
||||
</eld:configuratorGlobal>
|
||||
|
||||
<eld:attributeHandler attributeName="tt.attr1" bean.class="org.x4o.xml.test.element.TestElementAttributeHandler" id="attrTest1">
|
||||
<eld:description>Test the global element attribute1 handler.</eld:description>
|
||||
</eld:attributeHandler>
|
||||
<eld:attributeHandler attributeName="tt.attr2" bean.class="org.x4o.xml.test.element.TestElementAttributeHandler" id="attrTest2">
|
||||
<eld:description>Test the global element attribute2 handler.</eld:description>
|
||||
<eld:attributeHandlerNextAttribute attributeName="tt.attr1"/>
|
||||
</eld:attributeHandler>
|
||||
|
||||
<eld:namespace
|
||||
uri="http://test.x4o.org/xml/ns/test-root"
|
||||
schemaUri="http://test.x4o.org/xml/ns/test-root-1.0.xsd"
|
||||
schemaResource="test-root-1.0.xsd"
|
||||
schemaPrefix="root"
|
||||
description="Root namespace to have nice namespaceing."
|
||||
name="Test Root Namespace"
|
||||
languageRoot="true"
|
||||
id="test-root"
|
||||
>
|
||||
<!-- Root Element for nice namespace'ing -->
|
||||
<eld:element tag="root" objectClass="org.x4o.xml.test.models.TestObjectRoot">
|
||||
<eld:description>The test root element.</eld:description>
|
||||
</eld:element>
|
||||
</eld:namespace>
|
||||
|
||||
<eld:namespace
|
||||
uri="http://test.x4o.org/xml/ns/test-lang"
|
||||
schemaUri="http://test.x4o.org/xml/ns/test-lang-1.0.xsd"
|
||||
schemaResource="test-lang-1.0.xsd"
|
||||
schemaPrefix="lang"
|
||||
description="Test language namespace to test some/most features"
|
||||
name="Test Language Namespace"
|
||||
id="test-lang"
|
||||
>
|
||||
<eld:element tag="testNoNSRoot" objectClass="org.x4o.xml.test.models.TestObjectRoot"/>
|
||||
|
||||
<eld:element tag="testBean" objectClass="org.x4o.xml.test.models.TestBean">
|
||||
<eld:description>The test the bean object.</eld:description>
|
||||
</eld:element>
|
||||
|
||||
<eld:element tag="configBean" objectClass="org.x4o.xml.test.models.TestBean">
|
||||
<eld:configurator bean.class="org.x4o.xml.test.element.TestElementConfigurator" id="testConfig1">
|
||||
<eld:description>The test element config.</eld:description>
|
||||
</eld:configurator>
|
||||
<eld:configurator bean.class="org.x4o.xml.test.element.TestElementConfigurator" id="testConfig2"/>
|
||||
<eld:elementSkipPhase name="runAttributesPhase"/>
|
||||
<eld:elementSkipPhase name="transformPhase"/>
|
||||
</eld:element>
|
||||
|
||||
<eld:element tag="parent" objectClass="org.x4o.xml.test.models.TestObjectParent"/>
|
||||
<eld:element tag="child" objectClass="org.x4o.xml.test.models.TestObjectChild"/>
|
||||
|
||||
<eld:element tag="testObjectParent" objectClass="org.x4o.xml.test.models.TestObjectParent"/>
|
||||
<eld:element tag="testObjectChild" objectClass="org.x4o.xml.test.models.TestObjectChild"/>
|
||||
<eld:element tag="testBeanObjectChild" objectClass="org.x4o.xml.test.models.TestObjectChild">
|
||||
<!--
|
||||
<eld:element tag="testBeanObjectChild" objectClass="org.x4o.xml.models.TestObjectChild" parentNamespace="http://test.x4o.org/eld/iets.eld" elementTag="superObject"/>
|
||||
<eld:elementClass tag="JTextArea" objectClassName="javax.swing.JTextArea"/>
|
||||
<eld:elementClassParentElementClass namespace="http://test.x4o.org/eld/iets.eld" elementTag="superObject"/>
|
||||
<eld:elementClassParentElementClass namespace="http://test.x4o.org/eld/iets.eld" elementTag="superObject2"/>
|
||||
-->
|
||||
</eld:element>
|
||||
|
||||
<eld:element tag="JFrame" objectClass="javax.swing.JFrame">
|
||||
<eld:elementParent tag="root" uri="http://test.x4o.org/xml/ns/test-root"/>
|
||||
</eld:element>
|
||||
<eld:element tag="JFrameContentPane" elementClass="org.x4o.xml.test.element.ContentPaneElement"/>
|
||||
<eld:element tag="JLabel" objectClass="javax.swing.JLabel"/>
|
||||
<eld:element tag="JPanel" objectClass="javax.swing.JPanel"/>
|
||||
<eld:element tag="JTextField" objectClass="javax.swing.JTextField"/>
|
||||
<eld:element tag="JTextArea" objectClass="javax.swing.JTextArea"/>
|
||||
<eld:element tag="JScrollPane" objectClass="javax.swing.JScrollPane"/>
|
||||
|
||||
</eld:namespace>
|
||||
</root:module>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2012, 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.
|
||||
|
||||
-->
|
||||
<modules version="1.0"
|
||||
xmlns="http://language.x4o.org/xml/ns/modules"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
|
||||
>
|
||||
<language version="1.0">
|
||||
<eld-resource>defd-lang.eld</eld-resource>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -30,4 +30,5 @@
|
|||
>
|
||||
<driver language="test" className="org.x4o.xml.test.TestDriver"/>
|
||||
<driver language="swixml" className="org.x4o.xml.test.swixml.SwiXmlDriver"/>
|
||||
<defaultDriver language="junit-defp"/>
|
||||
</drivers>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue