Easter cleaning
This commit is contained in:
commit
9e36078b2e
1862 changed files with 270281 additions and 0 deletions
|
|
@ -0,0 +1,268 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* X4ODriverManager
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class X4ODriverManagerTest {
|
||||
|
||||
@Test
|
||||
public void testDefaultLanguageVersionSelect() throws Exception {
|
||||
String version = X4ODriverManager.getDefaultLanguageVersion(new String[]{"1.0","2.0","3.0"});
|
||||
Assertions.assertNotNull(version);
|
||||
Assertions.assertEquals("3.0",version);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultLanguageVersionEmpty() throws Exception {
|
||||
String version = X4ODriverManager.getDefaultLanguageVersion(new String[]{});
|
||||
Assertions.assertNotNull(version);
|
||||
Assertions.assertEquals(X4ODriver.DEFAULT_LANGUAGE_VERSION,version);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultLanguageVersionNull() throws Exception {
|
||||
String version = X4ODriverManager.getDefaultLanguageVersion(null);
|
||||
Assertions.assertNotNull(version);
|
||||
Assertions.assertEquals(X4ODriver.DEFAULT_LANGUAGE_VERSION,version);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLanguageNull() throws Exception {
|
||||
String language = null;
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriverManager.getX4ODriver(language);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass());
|
||||
Assertions.assertTrue(e.getMessage().contains("language"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLanguageEmpty() throws Exception {
|
||||
String language = "";
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriverManager.getX4ODriver(language);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertEquals(IllegalArgumentException.class, e.getClass());
|
||||
Assertions.assertTrue(e.getMessage().contains("language"), "Error message string is missing language");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLanguageVersionNonExcisting() throws Exception {
|
||||
String language = "test";
|
||||
String version = "99.9";
|
||||
Throwable e = null;
|
||||
try {
|
||||
X4ODriver<?> driver = X4ODriverManager.getX4ODriver(language);
|
||||
driver.createLanguage(version).createLanguageSession();
|
||||
} catch (Throwable catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
/* TODO
|
||||
assertNotNull(e);
|
||||
assertNotNull(e.getCause());
|
||||
assertNotNull(e.getCause().getCause());
|
||||
assertEquals(X4OPhaseException.class, e.getCause().getClass());
|
||||
assertEquals(X4OLanguageLoaderException.class, e.getCause().getCause().getClass());
|
||||
assertTrue("Error message string is missing language",e.getMessage().contains("language"));
|
||||
assertTrue("Error message string is missing test",e.getMessage().contains("test"));
|
||||
assertTrue("Error message string is missing modules",e.getMessage().contains("modules"));
|
||||
assertTrue("Error message string is missing 2.0",e.getMessage().contains("2.0"));
|
||||
*/
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLanguageCount() throws Exception {
|
||||
List<String> languages = X4ODriverManager.getX4OLanguages();
|
||||
Assertions.assertNotNull(languages);
|
||||
Assertions.assertFalse(languages.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLanguageNames() throws Exception {
|
||||
List<String> languages = X4ODriverManager.getX4OLanguages();
|
||||
Assertions.assertNotNull(languages);
|
||||
Assertions.assertTrue(languages.contains("cel"), "cel language is missing");
|
||||
Assertions.assertTrue(languages.contains("eld"), "eld language is missing");
|
||||
Assertions.assertTrue(languages.contains("test"), "test language is missing");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLanguagesLoopSpeed() throws Exception {
|
||||
long startTime = System.currentTimeMillis();
|
||||
for (int i=0;i<100;i++) {
|
||||
testLanguageCount();
|
||||
}
|
||||
long loopTime = System.currentTimeMillis() - startTime;
|
||||
Assertions.assertEquals(true, loopTime<500, "Language list loop is slow;"+loopTime);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegisterDriverNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriverManager.registerX4ODriver(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegisterDriverNameNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
||||
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
|
||||
@Override public String getLanguageName() { return null; }
|
||||
|
||||
});
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegisterDriverNameEmpty() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
||||
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
|
||||
@Override public String getLanguageName() { return ""; }
|
||||
|
||||
});
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(IllegalArgumentException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("empty"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegisterDriverVersionNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
||||
@Override public String[] getLanguageVersions() { return null; }
|
||||
@Override public String getLanguageName() { return "junit-driver-test"; }
|
||||
|
||||
});
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegisterDriverVersionEmpty() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriverManager.registerX4ODriver(new X4ODriver<Object>() {
|
||||
@Override public String[] getLanguageVersions() { return new String[]{}; }
|
||||
@Override public String getLanguageName() { return "junit-driver-test"; }
|
||||
|
||||
});
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(IllegalArgumentException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("empty"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeregisterDriverNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriverManager.deregisterX4ODriver(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeregisterDriverNameNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriverManager.deregisterX4ODriver(new X4ODriver<Object>() {
|
||||
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
|
||||
@Override public String getLanguageName() { return null; }
|
||||
|
||||
});
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeregisterDriverInstance() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriver<?> driver = new X4ODriver<Object>() {
|
||||
@Override public String[] getLanguageVersions() { return new String[]{"1.0"}; }
|
||||
@Override public String getLanguageName() { return "junit-driver-test"; }
|
||||
};
|
||||
X4ODriverManager.registerX4ODriver(driver);
|
||||
Assertions.assertEquals(driver.hashCode(), X4ODriverManager.getX4ODriver("junit-driver-test").hashCode());
|
||||
X4ODriverManager.deregisterX4ODriver(driver);
|
||||
X4ODriverManager.getX4ODriver("junit-driver-test");
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(IllegalArgumentException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("junit-driver-test"), "Wrong exception message");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.conv;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.conv.text.ClassConverter;
|
||||
import org.x4o.xml.conv.text.EnumConverter;
|
||||
import org.x4o.xml.conv.text.URLConverter;
|
||||
import org.x4o.xml.lang.phase.X4OPhaseType;
|
||||
|
||||
/**
|
||||
* DefaultObjectConverterProviderTest test some basic converters.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class DefaultObjectConverterProviderTest {
|
||||
|
||||
Locale locale = Locale.getDefault();
|
||||
|
||||
@Test
|
||||
public void testConverterClone() throws Exception {
|
||||
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
|
||||
for (ObjectConverter conv:p.getObjectConverters()) {
|
||||
Assertions.assertNotNull(conv);
|
||||
ObjectConverter clone = conv.clone();
|
||||
Assertions.assertNotNull(clone);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterBoolean() throws Exception {
|
||||
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
|
||||
ObjectConverter conv = p.getObjectConverterForClass(Boolean.class);
|
||||
Assertions.assertNotNull(conv);
|
||||
Object result = conv.convertTo("true", locale);
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertEquals(Boolean.class,result.getClass(), "Result is not Boolean.class");
|
||||
Assertions.assertEquals(true,result, "Result is not true");
|
||||
Object resultBack = conv.convertBack(result, locale);
|
||||
Assertions.assertNotNull(resultBack);
|
||||
Assertions.assertEquals(String.class,resultBack.getClass(), "resultBack is not String.class");
|
||||
Assertions.assertEquals("true",resultBack, "resultBack is not true");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterInteger() throws Exception {
|
||||
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
|
||||
ObjectConverter conv = p.getObjectConverterForClass(Integer.class);
|
||||
Assertions.assertNotNull(conv);
|
||||
Object result = conv.convertTo("123", locale);
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertEquals(Integer.class,result.getClass(), "Result is not Integer.class");
|
||||
Assertions.assertEquals(123,result, "Result is not 123");
|
||||
Object resultBack = conv.convertBack(result, locale);
|
||||
Assertions.assertNotNull(resultBack);
|
||||
Assertions.assertEquals(String.class,resultBack.getClass(), "resultBack is not String.class");
|
||||
Assertions.assertEquals("123",resultBack, "resultBack is not 123");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterFloat() throws Exception {
|
||||
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
|
||||
ObjectConverter conv = p.getObjectConverterForClass(Float.class);
|
||||
Assertions.assertNotNull(conv);
|
||||
Object result = conv.convertTo("123.23", locale);
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertEquals(Float.class,result.getClass(), "Result is not Float.class");
|
||||
Assertions.assertEquals(123.23F,result, "Result is not 123.23");
|
||||
Object resultBack = conv.convertBack(result, locale);
|
||||
Assertions.assertNotNull(resultBack);
|
||||
Assertions.assertEquals(String.class,resultBack.getClass(), "resultBack is not String.class");
|
||||
Assertions.assertEquals("123.23",resultBack, "resultBack is not 123.23");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterLong() throws Exception {
|
||||
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
|
||||
ObjectConverter conv = p.getObjectConverterForClass(Long.class);
|
||||
Assertions.assertNotNull(conv);
|
||||
Object result = conv.convertTo("12323", locale);
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertEquals(Long.class,result.getClass(), "Result is not Long.class");
|
||||
Assertions.assertEquals(12323L,result, "Result is not 12323");
|
||||
Object resultBack = conv.convertBack(result, locale);
|
||||
Assertions.assertNotNull(resultBack);
|
||||
Assertions.assertEquals(String.class,resultBack.getClass(), "resultBack is not String.class");
|
||||
Assertions.assertEquals("12323",resultBack, "resultBack is not 12323");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterDouble() throws Exception {
|
||||
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
|
||||
ObjectConverter conv = p.getObjectConverterForClass(Double.class);
|
||||
Assertions.assertNotNull(conv);
|
||||
Object result = conv.convertTo("1232.3", locale);
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertEquals(Double.class,result.getClass(), "Result is not Double.class");
|
||||
Assertions.assertEquals(1232.3D,result, "Result is not 1232.3");
|
||||
Object resultBack = conv.convertBack(result, locale);
|
||||
Assertions.assertNotNull(resultBack);
|
||||
Assertions.assertEquals(String.class,resultBack.getClass(), "resultBack is not String.class");
|
||||
Assertions.assertEquals("1232.3",resultBack, "resultBack is not 1232.3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterUrl() throws Exception {
|
||||
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
|
||||
ObjectConverter conv = p.getObjectConverterForClass(URL.class);
|
||||
Assertions.assertNotNull(conv);
|
||||
Object result = conv.convertTo("http://www.x4o.org", locale);
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertEquals(URL.class,result.getClass(), "Result is not Url.class");
|
||||
Assertions.assertEquals(new URL("http://www.x4o.org"),result, "Result is not http://www.x4o.org");
|
||||
Object resultBack = conv.convertBack(result, locale);
|
||||
Assertions.assertNotNull(resultBack);
|
||||
Assertions.assertEquals(String.class,resultBack.getClass(), "resultBack is not String.class");
|
||||
Assertions.assertEquals("http://www.x4o.org",resultBack, "resultBack is not http://www.x4o.org");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterUrlException() throws Exception {
|
||||
URLConverter conv = new URLConverter();
|
||||
Exception e = null;
|
||||
try {
|
||||
conv.convertStringTo("error2::s/sdf//sd!@#$%#", locale);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertNotNull(e.getCause());
|
||||
Assertions.assertEquals(ObjectConverterException.class, e.getClass());
|
||||
Assertions.assertEquals(MalformedURLException.class, e.getCause().getClass());
|
||||
Assertions.assertTrue(e.getMessage().contains("error"), "Error message string is missing error");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterEnum() throws Exception {
|
||||
EnumConverter convOrg = new EnumConverter();
|
||||
convOrg.setEnumClass(X4OPhaseType.class.getName());
|
||||
ObjectConverter conv = convOrg.clone();
|
||||
Object result = conv.convertTo("XML_READ", locale);
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertEquals("XML_READ", result.toString());
|
||||
Object resultBack = conv.convertBack(result, locale);
|
||||
Assertions.assertEquals("XML_READ", resultBack.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterEnumError() throws Exception {
|
||||
EnumConverter convOrg = new EnumConverter();
|
||||
convOrg.setEnumClass(X4OPhaseType.class.getName());
|
||||
ObjectConverter conv = convOrg.clone();
|
||||
|
||||
Exception e = null;
|
||||
try {
|
||||
conv.convertTo("nonEnumError", locale);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertEquals(ObjectConverterException.class, e.getClass());
|
||||
Assertions.assertTrue(e.getMessage().contains("EnumError"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterEnumNullError() throws Exception {
|
||||
EnumConverter conv = new EnumConverter();
|
||||
Exception e = null;
|
||||
try {
|
||||
conv.convertTo("nonEnumError", locale);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertEquals(ObjectConverterException.class, e.getClass());
|
||||
Assertions.assertTrue(e.getMessage().contains("enumClass"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterClass() throws Exception {
|
||||
ClassConverter classOrg = new ClassConverter();
|
||||
ObjectConverter conv = classOrg.clone();
|
||||
Object result = conv.convertTo("java.lang.Object", locale);
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertEquals(Object.class, result);
|
||||
Object resultBack = conv.convertBack(result, locale);
|
||||
Assertions.assertEquals("java.lang.Object", resultBack.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConverterClassError() throws Exception {
|
||||
ClassConverter classOrg = new ClassConverter();
|
||||
ObjectConverter conv = classOrg.clone();
|
||||
|
||||
Exception e = null;
|
||||
try {
|
||||
conv.convertTo("java.lang.ObjectError", locale);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertEquals(ObjectConverterException.class, e.getClass());
|
||||
Assertions.assertTrue(e.getMessage().contains("ObjectError"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
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.TestObjectChild;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o xml language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class AttributeBeanTest {
|
||||
|
||||
@Test
|
||||
public void testBeanBody() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
|
||||
TestObjectRoot root = reader.readResource("tests/attributes/test-body.xml");
|
||||
Assertions.assertNotNull(root);
|
||||
List<TestObjectChild> childs = root.getTestObjectChilds();
|
||||
Assertions.assertEquals(2,childs.size());
|
||||
TestObjectChild child0 = childs.get(0);
|
||||
TestObjectChild child1 = childs.get(1);
|
||||
Assertions.assertEquals("attr-name-𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕",child0.getName());
|
||||
Assertions.assertEquals("body-name-𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕",child1.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeanProperties() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
|
||||
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
|
||||
Assertions.assertNotNull(root);
|
||||
Assertions.assertNotNull(root.getTestBeans());
|
||||
Assertions.assertEquals(2, root.getTestBeans().size());
|
||||
TestBean b = root.getTestBeans().get(0);
|
||||
TestBean beanPublic = root.getTestBeans().get(1);
|
||||
|
||||
Assertions.assertEquals(123 ,0+ b.getPrivateIntegerTypeField());
|
||||
Assertions.assertEquals(123 ,0+ b.getPrivateIntegerObjectField());
|
||||
|
||||
Assertions.assertEquals(123l ,0+ b.getPrivateLongTypeField());
|
||||
Assertions.assertEquals(123l ,0+ b.getPrivateLongObjectField());
|
||||
|
||||
Assertions.assertEquals(123.45d ,0+ b.getPrivateDoubleTypeField());
|
||||
Assertions.assertEquals(123.45d ,0+ b.getPrivateDoubleObjectField());
|
||||
|
||||
Assertions.assertEquals(123.45f ,0+ b.getPrivateFloatTypeField());
|
||||
Assertions.assertEquals(123.45f ,0+ b.getPrivateFloatObjectField());
|
||||
|
||||
Assertions.assertEquals(67 ,0+ b.getPrivateByteTypeField());
|
||||
Assertions.assertEquals(67 ,0+ b.getPrivateByteObjectField());
|
||||
|
||||
Assertions.assertEquals(true, b.isPrivateBooleanTypeField());
|
||||
Assertions.assertEquals(new Boolean(true), b.getPrivateBooleanObjectField());
|
||||
|
||||
Assertions.assertEquals('W' ,0+ b.getPrivateCharTypeField());
|
||||
Assertions.assertEquals('C' ,0+ b.getPrivateCharObjectField());
|
||||
|
||||
Assertions.assertEquals("x4o-𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕" ,b.getPrivateStringObjectField());
|
||||
//Assertions.assertEquals("x4o-ᒡᒢᑊᒻᒻᓫᔿ" ,b.getPrivateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ()); // SAX fails
|
||||
Assertions.assertEquals("x4o-仙上主天" ,b.getPrivateStringObjectFieldUnicode仙上主天());
|
||||
|
||||
//TODO: add again: assertEquals(true ,null!=b.getPrivateDateObjectField());
|
||||
|
||||
Assertions.assertEquals("x4o-𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕" ,beanPublic.publicStringObjectField);
|
||||
//Assertions.assertEquals("x4o-ᒡᒢᑊᒻᒻᓫᔿ" ,beanPublic.publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ); // SAX fails
|
||||
Assertions.assertEquals("x4o-仙上主天" ,beanPublic.publicStringObjectFieldUnicode仙上主天);
|
||||
}
|
||||
}
|
||||
128
nx01-x4o-driver/src/test/java/org/x4o/xml/core/EmptyXmlTest.java
Normal file
128
nx01-x4o-driver/src/test/java/org/x4o/xml/core/EmptyXmlTest.java
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.core;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o xml language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class EmptyXmlTest {
|
||||
|
||||
@Test
|
||||
public void testFileNotFound() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
try {
|
||||
reader.readFile("tests/empty-xml/non-excisting-file.xml");
|
||||
} catch (FileNotFoundException e) {
|
||||
Assertions.assertEquals(true, e.getMessage().contains("non-excisting-file.xml"));
|
||||
return;
|
||||
}
|
||||
Assertions.assertEquals(true,false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResourceNotFound() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
try {
|
||||
reader.readResource("tests/empty-xml/non-excisting-resource.xml");
|
||||
} catch (NullPointerException e) {
|
||||
Assertions.assertEquals(true,e.getMessage().contains("Could not find resource"));
|
||||
return;
|
||||
}
|
||||
Assertions.assertEquals(true,false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResourceParsing() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
try {
|
||||
reader.readResource("tests/empty-xml/empty-test.xml");
|
||||
} catch (SAXException e) {
|
||||
// Assertions.assertEquals("No ElementNamespace found for empty namespace.", e.getMessage());
|
||||
return;
|
||||
}
|
||||
Assertions.assertEquals(true,false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResourceEmptyReal() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
try {
|
||||
reader.readResource("tests/empty-xml/empty-real.xml");
|
||||
} catch (SAXException e) {
|
||||
Assertions.assertEquals(true,e.getMessage().contains("Premature end of file."));
|
||||
return;
|
||||
}
|
||||
Assertions.assertEquals(true,false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResourceEmptyXml() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
try {
|
||||
reader.readResource("tests/empty-xml/empty-xml.xml");
|
||||
} catch (SAXException e) {
|
||||
boolean hasError = e.getMessage().contains("Premature end of file."); // java6+ sax message
|
||||
if (hasError==false) {
|
||||
hasError = e.getMessage().contains("A well-formed document requires a root element."); // xercesImpl sax message
|
||||
}
|
||||
Assertions.assertEquals(true,hasError);
|
||||
return;
|
||||
}
|
||||
Assertions.assertEquals(true,false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyX40() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
Assertions.assertNotNull(driver);
|
||||
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
Assertions.assertNotNull(reader);
|
||||
|
||||
TestObjectRoot root = reader.readResource("tests/empty-xml/empty-x4o.xml");
|
||||
Assertions.assertNotNull(root);
|
||||
|
||||
Assertions.assertEquals(true,root.getTestBeans().isEmpty());
|
||||
Assertions.assertEquals(true,root.getTestObjectChilds().isEmpty());
|
||||
Assertions.assertEquals(true,root.getTestObjectParents().isEmpty());
|
||||
Assertions.assertEquals(true,root.getTestObjects().isEmpty());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.core;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.io.DefaultX4OReader;
|
||||
import org.x4o.xml.io.X4OReaderSession;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.x4o.xml.lang.phase.X4OPhaseLanguageRead;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* Tests emptry uri namespace laoding.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 1, 2011
|
||||
*/
|
||||
public class NamespaceUriTest {
|
||||
|
||||
@Test
|
||||
public void testSimpleUri() throws Exception {
|
||||
X4OLanguageSession context = null;
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
reader.addPhaseSkip(X4OPhaseLanguageRead.READ_RELEASE);
|
||||
try {
|
||||
context = reader.readResourceSession("tests/namespace/uri-simple.xml");
|
||||
Assertions.assertEquals(true,context.getRootElement().getChilderen().size()==1);
|
||||
} finally {
|
||||
reader.releaseSession(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyUri() throws Exception {
|
||||
X4OLanguageSession context = null;
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
reader.addPhaseSkip(X4OPhaseLanguageRead.READ_RELEASE);
|
||||
reader.setProperty(DefaultX4OReader.DOC_EMPTY_NAMESPACE_URI, "http://test.junit.x4o.org/xml/ns/junit-test-lang");
|
||||
try {
|
||||
context = reader.readResourceSession("tests/namespace/uri-empty.xml");
|
||||
Assertions.assertEquals(true,context.getRootElement().getChilderen().size()==1);
|
||||
} finally {
|
||||
reader.releaseSession(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSchemaUri() throws Exception {
|
||||
X4OLanguageSession context = null;
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
reader.addPhaseSkip(X4OPhaseLanguageRead.READ_RELEASE);
|
||||
try {
|
||||
context = reader.readResourceSession("tests/namespace/uri-schema.xml");
|
||||
Assertions.assertEquals(true,context.getRootElement().getChilderen().size()==1);
|
||||
} finally {
|
||||
reader.releaseSession(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.core;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.io.DefaultX4OReader;
|
||||
import org.x4o.xml.io.DefaultX4OWriter;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
import org.x4o.xml.io.X4OWriter;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* X4ODebugWriterTest runs parser with debug output.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 26, 2012
|
||||
*/
|
||||
public class X4ODebugWriterTest {
|
||||
|
||||
private File createDebugFile() throws IOException {
|
||||
File debugFile = File.createTempFile("test-debug", ".xml");
|
||||
debugFile.deleteOnExit();
|
||||
return debugFile;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDebugOutputReader() throws Exception {
|
||||
File debugFile = createDebugFile();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
reader.setProperty(DefaultX4OReader.DEBUG_OUTPUT_STREAM, new FileOutputStream(debugFile));
|
||||
reader.readResource("tests/attributes/test-bean.xml");
|
||||
|
||||
Assertions.assertTrue(debugFile.exists(), "Debug file does not exists.");
|
||||
String debug = readFile(debugFile);
|
||||
Assertions.assertNotNull(debug);
|
||||
Assertions.assertFalse(debug.length()==0, "no debug content");
|
||||
Assertions.assertTrue(debug.length()>20, "debug content to small");
|
||||
|
||||
//System.out.println("=================== Reader Output ======================");
|
||||
//System.out.println(debug);
|
||||
debugFile.delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDebugOutputWriter() throws Exception {
|
||||
File debugFile = createDebugFile();
|
||||
File writeFile = createDebugFile();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
X4OWriter<TestObjectRoot> writer = driver.createWriter();
|
||||
TestObjectRoot object = reader.readResource("tests/attributes/test-bean.xml");
|
||||
|
||||
writer.setProperty(DefaultX4OWriter.DEBUG_OUTPUT_STREAM, new FileOutputStream(debugFile));
|
||||
writer.writeFile(object, writeFile);
|
||||
|
||||
Assertions.assertTrue(debugFile.exists(), "Debug file does not exists.");
|
||||
String debug = readFile(debugFile);
|
||||
Assertions.assertNotNull(debug);
|
||||
Assertions.assertFalse(debug.length()==0, "no debug content");
|
||||
Assertions.assertTrue(debug.length()>20, "debug content to small");
|
||||
|
||||
//System.out.println("=================== Writer Output ======================");
|
||||
//System.out.println(debug);
|
||||
debugFile.delete();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.core;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.eld.CelDriver;
|
||||
import org.x4o.xml.io.DefaultX4OReader;
|
||||
import org.x4o.xml.io.X4OEntityResolver;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* X4OLanguageClassLoaderTest test classloader.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 27, 2012
|
||||
*/
|
||||
public class X4OEntityResolverTest {
|
||||
|
||||
@Test
|
||||
public void testElementLangugeNull() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
new X4OEntityResolver(null,null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass());
|
||||
Assertions.assertTrue(e.getMessage().contains("null"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolve() throws Exception {
|
||||
X4ODriver<?> driver = new CelDriver();
|
||||
X4OEntityResolver resolver = new X4OEntityResolver(driver.createLanguage().createLanguageSession(),DefaultX4OReader.DEFAULT_PROPERTY_CONFIG);
|
||||
InputSource input = resolver.resolveEntity("","http://cel.x4o.org/xml/ns/cel-root-1.0.xsd");
|
||||
Assertions.assertNotNull(input);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveMissing() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = new TestDriver();
|
||||
X4OEntityResolver resolver = new X4OEntityResolver(driver.createLanguage().createLanguageSession(),DefaultX4OReader.DEFAULT_PROPERTY_CONFIG);
|
||||
Exception e = null;
|
||||
try {
|
||||
resolver.resolveEntity("","http://cel.x4o.org/xml/ns/cel-root-1.0.xsd-missing-resource");
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertEquals(SAXException.class, e.getClass());
|
||||
Assertions.assertTrue(e.getMessage().contains("missing-resource"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveProperty() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = new TestDriver();
|
||||
X4OLanguageSession language = driver.createLanguage().createLanguageSession();
|
||||
SAX3PropertyConfig conf = new SAX3PropertyConfig(DefaultX4OReader.DEFAULT_PROPERTY_CONFIG,SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"reader/x4o/");
|
||||
conf.setProperty(DefaultX4OReader.SAX_ENTITY_RESOLVER, new TestEntityResolver());
|
||||
X4OEntityResolver resolver = new X4OEntityResolver(language,conf);
|
||||
Exception e = null;
|
||||
InputSource input = null;
|
||||
try {
|
||||
input = resolver.resolveEntity("","http://cel.x4o.org/xml/ns/cel-root-1.0.xsd");
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNull(e);
|
||||
Assertions.assertNotNull(input);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolvePropertyNull() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = new TestDriver();
|
||||
X4OLanguageSession language = driver.createLanguage().createLanguageSession();
|
||||
SAX3PropertyConfig conf = new SAX3PropertyConfig(DefaultX4OReader.DEFAULT_PROPERTY_CONFIG,SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"reader/x4o/");
|
||||
conf.setProperty(DefaultX4OReader.SAX_ENTITY_RESOLVER, new TestEntityResolver());
|
||||
X4OEntityResolver resolver = new X4OEntityResolver(language,conf);
|
||||
Exception e = null;
|
||||
try {
|
||||
resolver.resolveEntity("","http://cel.x4o.org/xml/ns/cel-root-1.0.xsd-null");
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertEquals(SAXException.class, e.getClass());
|
||||
Assertions.assertTrue(e.getMessage().contains("null"));
|
||||
}
|
||||
|
||||
public class TestEntityResolver implements EntityResolver {
|
||||
|
||||
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
|
||||
if (systemId.contains("null")) {
|
||||
return null;
|
||||
} else {
|
||||
return new InputSource();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.core;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementClass;
|
||||
import org.x4o.xml.element.ElementClassAttribute;
|
||||
import org.x4o.xml.lang.X4OLanguageConfiguration;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
|
||||
/**
|
||||
* Tests some resulting options from the language config.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 20, 2012
|
||||
*/
|
||||
public class X4OParserConfigurationTest {
|
||||
|
||||
static TestDriver driver;
|
||||
static X4OLanguageConfiguration config;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() throws Exception {
|
||||
driver = TestDriver.getInstance();
|
||||
config = driver.createLanguage().getLanguageConfiguration();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParserConfigurationLanguage() {
|
||||
Assertions.assertEquals("test",driver.getLanguageName());
|
||||
Assertions.assertEquals(X4OLanguageConfiguration.DEFAULT_LANG_MODULES_FILE,config.getLanguageResourceModulesFileName());
|
||||
Assertions.assertEquals(X4OLanguageConfiguration.DEFAULT_LANG_PATH_PREFIX,config.getLanguageResourcePathPrefix());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParserConfigurationElement() {
|
||||
Assertions.assertNotNull(config.getDefaultElement());
|
||||
Assertions.assertTrue(Element.class.isAssignableFrom(config.getDefaultElement()), "No Element Interface");
|
||||
|
||||
Assertions.assertNotNull(config.getDefaultElementClass());
|
||||
Assertions.assertTrue(ElementClass.class.isAssignableFrom(config.getDefaultElementClass()), "No ElementClass Interface");
|
||||
|
||||
Assertions.assertNotNull(config.getDefaultElementClassAttribute());
|
||||
Assertions.assertTrue(ElementClassAttribute.class.isAssignableFrom(config.getDefaultElementClassAttribute()), "No ElementClassAttribute Interface");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.core;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.x4o.xml.lang.phase.DefaultX4OPhaseManager;
|
||||
import org.x4o.xml.lang.phase.X4OPhase;
|
||||
import org.x4o.xml.lang.phase.X4OPhaseType;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
|
||||
/**
|
||||
* Tests some code for testing x4o phases.
|
||||
* *
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 15, 2009
|
||||
*/
|
||||
public class X4OPhaseManagerTest {
|
||||
|
||||
static boolean phaseRunned = false;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() throws Exception {
|
||||
phaseRunned = false;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPhases() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OLanguageSession context = driver.createLanguage().createLanguageSession();
|
||||
DefaultX4OPhaseManager manager = (DefaultX4OPhaseManager)context.getLanguage().getPhaseManager();
|
||||
Collection<X4OPhase> phasesAll = manager.getAllPhases();
|
||||
List<X4OPhase> phases = manager.getOrderedPhases(X4OPhaseType.XML_READ);
|
||||
Assertions.assertNotNull(phases);
|
||||
Assertions.assertFalse(phases.isEmpty());
|
||||
Assertions.assertNotNull(phasesAll);
|
||||
Assertions.assertFalse(phasesAll.isEmpty());
|
||||
for (X4OPhase phase:phases) {
|
||||
Assertions.assertNotNull(phase);
|
||||
Assertions.assertNotNull(phase.getId());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void testPhaseManager() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
ElementLanguage context = driver.createLanguageSession();
|
||||
X4OPhaseManager manager = context.getLanguage().getPhaseManager();
|
||||
|
||||
Exception e = null;
|
||||
try {
|
||||
manager.addX4OPhaseHandler(null);
|
||||
} catch (NullPointerException ee) {
|
||||
e = ee;
|
||||
}
|
||||
Assertions.assertEquals(true, e!=null );
|
||||
}
|
||||
*/
|
||||
}
|
||||
133
nx01-x4o-driver/src/test/java/org/x4o/xml/eld/EldParserTest.java
Normal file
133
nx01-x4o-driver/src/test/java/org/x4o/xml/eld/EldParserTest.java
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.eld;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.X4ODriverManager;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
import org.x4o.xml.io.X4OWriter;
|
||||
import org.x4o.xml.lang.DefaultX4OLanguageModule;
|
||||
import org.x4o.xml.lang.X4OLanguage;
|
||||
import org.x4o.xml.lang.X4OLanguageModule;
|
||||
|
||||
/**
|
||||
* Tests some code for eld
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 15, 2009
|
||||
*/
|
||||
public class EldParserTest {
|
||||
|
||||
@Test
|
||||
public void testNone() {
|
||||
/*
|
||||
X4ODriver<ElementLanguageModule> driver = X4ODriverManager.getX4ODriver(TestDriver.LANGUAGE);
|
||||
driver.setGlobalProperty("", "");
|
||||
|
||||
ElementLanguage lang = driver.createLanguage();
|
||||
X4OSchemaWriter schemaWriter = driver.createSchemaWriter();
|
||||
schemaWriter.writeSchema(new File("/tmp"));
|
||||
|
||||
X4OReader reader = driver.createReader();
|
||||
//reader.setProperty("", "");
|
||||
//reader.addELBeanInstance(name, bean)
|
||||
Object rootTreeNode = (Object)reader.readResource("com/iets/foo/test.xml");
|
||||
|
||||
|
||||
X4OWriter writer = driver.createWriter();
|
||||
writer.writeFile(new File("/tmp/output.xml"));
|
||||
|
||||
try {
|
||||
read.readResource("");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRunEldParserCore() throws Exception {
|
||||
|
||||
//X4ODriver<X4OLanguageModule> driver = (X4ODriver<X4OLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
|
||||
//X4OReader<X4OLanguageModule> reader = driver.createReader();
|
||||
//EldDriver parser = new EldDriver(true);
|
||||
//reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
|
||||
try {
|
||||
//X4OLanguageModule module = reader.readResource("META-INF/eld/eld-lang.eld");
|
||||
//List<String> resultTags = new ArrayList<String>(50);
|
||||
//for (ElementNamespace ns:module.getElementNamespaces()) {
|
||||
//
|
||||
//}
|
||||
/*
|
||||
for (Element e:parser.getDriver().getElementLanguage().getRootElement().getAllChilderen()) {
|
||||
//System.out.println("obj: "+e.getElementObject());
|
||||
if (e.getElementType().equals(ElementType.element) && e.getElementObject() instanceof ElementClass) {
|
||||
ElementClass ec = (ElementClass)e.getElementObject();
|
||||
resultTags.add(ec.getTag());
|
||||
}
|
||||
}
|
||||
*/
|
||||
//TODO fix test
|
||||
/*
|
||||
assertTrue("No module tag found in core eld.", resultTags.contains("module"));
|
||||
assertTrue("No elementClass tag found in core eld.", resultTags.contains("elementClass"));
|
||||
assertTrue("No elementInterface tag found in core eld.", resultTags.contains("elementInterface"));
|
||||
assertTrue("No bean tag found in core eld.", resultTags.contains("bean"));
|
||||
assertTrue("No elementConfigurator tag found in core eld.", resultTags.contains("elementConfigurator"));
|
||||
*/
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
} finally {
|
||||
// parser.doReleasePhaseManual();
|
||||
}
|
||||
}
|
||||
|
||||
@Test //("fix recusrieve")
|
||||
public void testRunEldParser() throws Exception {
|
||||
if (1 == 1) {
|
||||
return;
|
||||
}
|
||||
X4ODriver<X4OLanguageModule> driver = (X4ODriver<X4OLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
|
||||
X4OReader<X4OLanguageModule> reader = driver.createReader();
|
||||
X4OWriter<X4OLanguageModule> writer = driver.createWriter();
|
||||
|
||||
X4OLanguage language = driver.createLanguage(driver.getLanguageVersionDefault());
|
||||
X4OLanguageModule mod = new DefaultX4OLanguageModule();
|
||||
|
||||
reader.addELBeanInstance(EldModuleLoader.EL_PARENT_LANGUAGE, language);
|
||||
reader.addELBeanInstance(EldModuleLoader.EL_PARENT_LANGUAGE_MODULE, mod);
|
||||
|
||||
X4OLanguageModule modNew = reader.readResource("META-INF/test/test-lang.eld");
|
||||
|
||||
//int binds = mod.getElementBindingHandlers().size();
|
||||
//System.out.println(binds);
|
||||
|
||||
// String output = writer.writeString(mod);
|
||||
// assertNotNull(output);
|
||||
|
||||
// TODO; fix element config+event to new interface + reserse for writing.
|
||||
|
||||
//System.out.println(output);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.eld;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.io.DefaultX4OReader;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* EldValidatingTest runs parser in validation mode.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 22, 2012
|
||||
*/
|
||||
public class EldValidatingTest {
|
||||
|
||||
@Test
|
||||
public void testValidation() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
//reader.getContentConfig().setProperty("",true);
|
||||
reader.setProperty(DefaultX4OReader.VALIDATION_INPUT_DOC, true);
|
||||
//parser.setProperty(DefaultX4OReader.VALIDATION_SCHEMA_PATH, "/tmp");
|
||||
try {
|
||||
// TODO: reader.readResource("META-INF/eld/eld-lang.eld");
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.eld.doc;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.X4ODriverManager;
|
||||
import org.x4o.xml.eld.CelDriver;
|
||||
import org.x4o.xml.eld.EldDriver;
|
||||
import org.x4o.xml.lang.task.X4OLanguageTask;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
|
||||
/**
|
||||
* Test for eld doc generation
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 26, 2010
|
||||
*/
|
||||
public class X4OWriteLanguageDocExecutorTest {
|
||||
|
||||
private File createOutputPath(String dir) throws Exception {
|
||||
File result = new File("target/tests"+File.separator+dir);
|
||||
if (result.exists()==false) {
|
||||
result.mkdirs();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void testDoc(String language,String outputPostfix) throws Exception {
|
||||
X4ODriver<?> driver = X4ODriverManager.getX4ODriver(language);
|
||||
X4OLanguageTask task = driver.getLanguageTask(EldDocLanguageTask.TASK_ID);
|
||||
SAX3PropertyConfig config = task.createTaskConfig();
|
||||
File outputPath = createOutputPath(outputPostfix);
|
||||
config.setProperty(EldDocWriter.OUTPUT_PATH,outputPath);
|
||||
task.createTaskExecutor(config).execute(driver.createLanguage());
|
||||
Assertions.assertTrue(outputPath.exists());
|
||||
Assertions.assertTrue(outputPath.list()!=null);
|
||||
Assertions.assertTrue(outputPath.list().length>2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCelDoc() throws Exception {
|
||||
testDoc(CelDriver.LANGUAGE_NAME,"junit-doc-cel");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEldDoc() throws Exception {
|
||||
testDoc(EldDriver.LANGUAGE_NAME,"junit-doc-eld");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnitDoc() throws Exception {
|
||||
testDoc(TestDriver.LANGUAGE_NAME,"junit-doc-test");
|
||||
}
|
||||
/*
|
||||
@Test
|
||||
public void testSwiXml2Doc() throws Exception {
|
||||
testDoc(EldDriver.LANGUAGE_NAME,"junit-doc-eld");
|
||||
EldDocLanguageTask writer = new EldDocLanguageTask();
|
||||
writer.setBasePath(createOutputTargetPath("junit-swixml2"));
|
||||
writer.setLanguageName(SwiXmlDriver.LANGUAGE_NAME);
|
||||
writer.setLanguageVersion(SwiXmlDriver.LANGUAGE_VERSION_2);
|
||||
writer.execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSwiXml3Doc() throws Exception {
|
||||
testDoc(EldDriver.LANGUAGE_NAME,"junit-doc-eld");
|
||||
EldDocLanguageTask writer = new EldDocLanguageTask();
|
||||
writer.setBasePath(createOutputTargetPath("junit-swixml3"));
|
||||
writer.setLanguageName(SwiXmlDriver.LANGUAGE_NAME);
|
||||
writer.setLanguageVersion(SwiXmlDriver.LANGUAGE_VERSION_3);
|
||||
writer.execute();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.eld.xsd;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.X4ODriverManager;
|
||||
import org.x4o.xml.eld.CelDriver;
|
||||
import org.x4o.xml.eld.EldDriver;
|
||||
import org.x4o.xml.eld.EldModuleLoaderCore;
|
||||
import org.x4o.xml.io.X4OWriterTest;
|
||||
import org.x4o.xml.lang.task.X4OLanguageTask;
|
||||
import org.x4o.xml.test.swixml.SwiXmlDriver;
|
||||
|
||||
/**
|
||||
* Tests some code for eld schema generating
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Auh 16, 2012
|
||||
*/
|
||||
public class EldXsdLanguageTaskTest {
|
||||
|
||||
private File createOutputPath(String dir) throws Exception {
|
||||
File result = new File("target/tests"+File.separator+dir);
|
||||
if (result.exists()==false) {
|
||||
result.mkdirs();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Test
|
||||
private File testSchema(String language,String outputPostfix,Map<String,Object> props) throws Exception {
|
||||
X4ODriver<?> driver = X4ODriverManager.getX4ODriver(language);
|
||||
X4OLanguageTask task = driver.getLanguageTask(EldXsdLanguageTask.TASK_ID);
|
||||
SAX3PropertyConfig config = task.createTaskConfig();
|
||||
File outputPath = createOutputPath(outputPostfix);
|
||||
config.setProperty(EldXsdWriter.OUTPUT_PATH,outputPath);
|
||||
config.setProperty(EldXsdWriter.OUTPUT_DOCUMENTATION,false);
|
||||
config.setProperty(SAX3WriterXml.PROLOG_LICENCE_FILE,new File("../licence.txt"));
|
||||
config.setProperty(SAX3WriterXml.PROLOG_USER_COMMENT,"Generated by junit-test-run in class: "+this.getClass().getSimpleName());
|
||||
if (props!=null) {
|
||||
for (String key:props.keySet()) {
|
||||
Object value = props.get(key);
|
||||
config.setProperty(key, value);
|
||||
}
|
||||
}
|
||||
task.createTaskExecutor(config).execute(driver.createLanguage());
|
||||
Assertions.assertTrue(outputPath.exists());
|
||||
Assertions.assertTrue(outputPath.list()!=null);
|
||||
return outputPath;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEldSchema() throws Exception {
|
||||
File outputPath = testSchema(EldDriver.LANGUAGE_NAME,"junit-xsd-eld",null);
|
||||
Assertions.assertTrue(outputPath.list().length>2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEldCoreSchema() throws Exception {
|
||||
File outputPath = testSchema(CelDriver.LANGUAGE_NAME,"junit-xsd-cel",null);
|
||||
Assertions.assertTrue(outputPath.list().length>1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSwiXmlSchema() throws Exception {
|
||||
File outputPath = testSchema(SwiXmlDriver.LANGUAGE_NAME,"junit-xsd-swixml",null);
|
||||
Assertions.assertTrue(outputPath.list().length>1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilterNamespace() throws Exception {
|
||||
Map<String,Object> props = new HashMap<String,Object>();
|
||||
props.put(EldXsdWriter.FILTER_NAMESPACE, EldModuleLoaderCore.CEL_ROOT_URI);
|
||||
File outputPath = testSchema(CelDriver.LANGUAGE_NAME,"junit-one-ns",props);
|
||||
Assertions.assertTrue(outputPath.list().length==1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilterElement() throws Exception {
|
||||
Map<String,Object> props = new HashMap<String,Object>();
|
||||
props.put(EldXsdWriter.FILTER_NAMESPACE, EldModuleLoaderCore.CEL_CORE_URI);
|
||||
props.put(EldXsdWriter.FILTER_ELEMENT, "elementInterface");
|
||||
props.put(EldXsdWriter.PROLOG_GENERATED_ENABLE, false);
|
||||
props.put(EldXsdWriter.PROLOG_XMLNS_INFO_ENABLE, false);
|
||||
props.put(SAX3WriterXml.PROLOG_LICENCE_ENABLE,false);
|
||||
File outputPath = testSchema(CelDriver.LANGUAGE_NAME,"junit-one-element",props);
|
||||
Assertions.assertTrue(outputPath.list().length==1);
|
||||
|
||||
String text = X4OWriterTest.readFile(new File("target/tests/junit-one-element/cel-core-1.0.xsd"));
|
||||
Assertions.assertNotNull(text);
|
||||
Assertions.assertTrue(text.contains("elementInterface"));
|
||||
Assertions.assertFalse(text.contains("module"));
|
||||
Assertions.assertFalse(text.contains("attributeAlias"));
|
||||
Assertions.assertFalse(text.contains("bindingHandler"));
|
||||
Assertions.assertFalse(text.contains("classConverter"));
|
||||
|
||||
Assertions.assertTrue(text.length()<10000);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.element;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.test.models.TestBean;
|
||||
import org.x4o.xml.test.models.TestObjectChild;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o xml language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class DefaultElementObjectPropertyValueTest {
|
||||
|
||||
DefaultElementObjectPropertyValue helper = new DefaultElementObjectPropertyValue();
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() throws Exception {
|
||||
// enable all logs
|
||||
InputStream loggingProperties = DefaultElementObjectPropertyValueTest.class.getResourceAsStream("/META-INF/logging.properties");
|
||||
LogManager.getLogManager().readConfiguration( loggingProperties );
|
||||
loggingProperties.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullValue() throws Exception {
|
||||
|
||||
TestObjectChild obj = new TestObjectChild();
|
||||
obj.setName("test");
|
||||
|
||||
Assertions.assertEquals("test", obj.getName()); // test org value
|
||||
Assertions.assertEquals("test", helper.getProperty(obj, "name")); // test null get value
|
||||
|
||||
helper.setProperty(obj, "name", null);
|
||||
|
||||
Assertions.assertEquals(null, obj.getName()); // test null value
|
||||
Assertions.assertEquals(null, helper.getProperty(obj, "name")); // test null get value
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIntegerValue() throws Exception {
|
||||
TestObjectChild obj = new TestObjectChild();
|
||||
helper.setProperty(obj, "price", 666);
|
||||
|
||||
Assertions.assertEquals(666,helper.getProperty(obj, "price"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testException() throws Exception {
|
||||
TestObjectChild obj = new TestObjectChild();
|
||||
helper.setProperty(obj, "price", 666);
|
||||
|
||||
boolean error = false;
|
||||
try {
|
||||
helper.getProperty(obj, "price2");
|
||||
} catch (ElementObjectPropertyValueException not) {
|
||||
error = true;
|
||||
}
|
||||
Assertions.assertEquals(true,error);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChinees() throws Exception {
|
||||
TestBean obj = new TestBean();
|
||||
|
||||
helper.setProperty(obj, "privateStringObjectField", "foo");
|
||||
Assertions.assertEquals("foo",helper.getProperty(obj, "privateStringObjectField"));
|
||||
|
||||
helper.setProperty(obj, "privateStringObjectFieldUnicode仙上主天", "bar");
|
||||
Assertions.assertEquals("bar",helper.getProperty(obj, "privateStringObjectFieldUnicode仙上主天"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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 org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* X4OConnectionTest.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 28, 2013
|
||||
*/
|
||||
public class X4OConnectionTest {
|
||||
|
||||
@Test
|
||||
public void testReaderPropertyFailRead() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
reader.getProperty("test");
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(IllegalArgumentException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("key"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("No"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReaderPropertyFail() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
reader.setProperty("test", "test");
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(IllegalArgumentException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("key"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("No"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriterPropertyFail() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OWriter<TestObjectRoot> writer = driver.createWriter();
|
||||
writer.setProperty("test", "test");
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(IllegalArgumentException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("key"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("No"), "Wrong exception message");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,244 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestBean;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* X4OReaderSessionTest.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 15, 2013
|
||||
*/
|
||||
public class X4OReaderSessionTest {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFileName() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
File xmlFile = copyResourceToTempFile();
|
||||
X4OLanguageSession context = reader.readFileSession(xmlFile.getAbsolutePath());
|
||||
TestObjectRoot root = (TestObjectRoot)context.getRootElement().getElementObject();
|
||||
Assertions.assertNotNull(root);
|
||||
Assertions.assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
Assertions.assertNotNull(bean);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFileNameNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
Exception e = null;
|
||||
try {
|
||||
String nullFileName = null;
|
||||
reader.readFileSession(nullFileName);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("fileName"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFile() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
File xmlFile = copyResourceToTempFile();
|
||||
X4OLanguageSession context = reader.readFileSession(xmlFile);
|
||||
TestObjectRoot root = (TestObjectRoot)context.getRootElement().getElementObject();
|
||||
Assertions.assertNotNull(root);
|
||||
Assertions.assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
Assertions.assertNotNull(bean);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFileNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
Exception e = null;
|
||||
try {
|
||||
File nullFile = null;
|
||||
reader.readFileSession(nullFile);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("file"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFileNotExists() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
Exception e = null;
|
||||
try {
|
||||
File tempFile = File.createTempFile("test-file", ".xml");
|
||||
tempFile.delete();
|
||||
reader.readFileSession(tempFile);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(FileNotFoundException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("exists"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("File"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFileNotReadable() throws Exception {
|
||||
if (File.separatorChar != '/') {
|
||||
return; // only test on real os.
|
||||
}
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
Exception e = null;
|
||||
try {
|
||||
reader.readFileSession(new File("/etc/shadow"));
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(IOException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("exists"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("read"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadResource() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
X4OLanguageSession context = reader.readResourceSession("tests/attributes/test-bean.xml");
|
||||
TestObjectRoot root = (TestObjectRoot)context.getRootElement().getElementObject();
|
||||
Assertions.assertNotNull(root);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadResourceNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
Exception e = null;
|
||||
try {
|
||||
reader.readResourceSession(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("resourceName"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadString() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
X4OLanguageSession context = reader.readStringSession(
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
|
||||
"<root:root xmlns:root=\"http://test.junit.x4o.org/xml/ns/junit-test-root\" xmlns=\"http://test.junit.x4o.org/xml/ns/junit-test-lang\">"+
|
||||
"<testBean privateIntegerTypeField=\"987654321\"/>"+
|
||||
"</root:root>"
|
||||
);
|
||||
TestObjectRoot root = (TestObjectRoot)context.getRootElement().getElementObject();
|
||||
Assertions.assertNotNull(root);
|
||||
Assertions.assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
Assertions.assertNotNull(bean);
|
||||
Assertions.assertEquals("987654321", ""+bean.getPrivateIntegerTypeField());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadStringNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
Exception e = null;
|
||||
try {
|
||||
reader.readStringSession(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("string"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadUrl() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
URL xmlUrl = Thread.currentThread().getContextClassLoader().getResource("tests/attributes/test-bean.xml");
|
||||
X4OLanguageSession context = reader.readUrlSession(xmlUrl);
|
||||
TestObjectRoot root = (TestObjectRoot)context.getRootElement().getElementObject();
|
||||
Assertions.assertNotNull(root);
|
||||
Assertions.assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
Assertions.assertNotNull(bean);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadUrlNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
Exception e = null;
|
||||
try {
|
||||
reader.readUrlSession(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("url"), "Wrong exception message");
|
||||
}
|
||||
}
|
||||
221
nx01-x4o-driver/src/test/java/org/x4o/xml/io/X4OReaderTest.java
Normal file
221
nx01-x4o-driver/src/test/java/org/x4o/xml/io/X4OReaderTest.java
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestBean;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* X4OReaderTest.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 15, 2013
|
||||
*/
|
||||
public class X4OReaderTest {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadInputStream() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReaderSession<TestObjectRoot> reader = driver.createReaderSession();
|
||||
File xmlFile = copyResourceToTempFile();
|
||||
URL basePath = new File(xmlFile.getAbsolutePath()).toURI().toURL();
|
||||
InputStream inputStream = new FileInputStream(xmlFile);
|
||||
TestObjectRoot root = null;
|
||||
try {
|
||||
root = reader.read(inputStream, xmlFile.getAbsolutePath(), basePath);
|
||||
} finally {
|
||||
inputStream.close();
|
||||
}
|
||||
Assertions.assertNotNull(root);
|
||||
Assertions.assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
Assertions.assertNotNull(bean);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadResource() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
|
||||
Assertions.assertNotNull(root);
|
||||
}
|
||||
|
||||
@Test
|
||||
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;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("resourceName"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
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.junit.x4o.org/xml/ns/junit-test-root\" xmlns=\"http://test.junit.x4o.org/xml/ns/junit-test-lang\">"+
|
||||
"<testBean privateIntegerTypeField=\"987654321\"/>"+
|
||||
"</root:root>"
|
||||
);
|
||||
Assertions.assertNotNull(root);
|
||||
Assertions.assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
Assertions.assertNotNull(bean);
|
||||
Assertions.assertEquals("987654321", ""+bean.getPrivateIntegerTypeField());
|
||||
}
|
||||
|
||||
@Test
|
||||
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;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("string"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
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);
|
||||
Assertions.assertNotNull(root);
|
||||
Assertions.assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
Assertions.assertNotNull(bean);
|
||||
}
|
||||
|
||||
@Test
|
||||
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;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("url"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFileName() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
File xmlFile = copyResourceToTempFile();
|
||||
TestObjectRoot root = reader.readFile(xmlFile.getAbsolutePath());
|
||||
Assertions.assertNotNull(root);
|
||||
Assertions.assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
Assertions.assertNotNull(bean);
|
||||
}
|
||||
|
||||
@Test
|
||||
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;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("fileName"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFile() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
File xmlFile = copyResourceToTempFile();
|
||||
TestObjectRoot root = reader.readFile(xmlFile);
|
||||
Assertions.assertNotNull(root);
|
||||
Assertions.assertTrue(root.getTestBeans().size()>0);
|
||||
TestBean bean = root.getTestBeans().get(0);
|
||||
Assertions.assertNotNull(bean);
|
||||
}
|
||||
|
||||
@Test
|
||||
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;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("file"), "Wrong exception message");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.util.Scanner;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* X4OWriterAttributeTest tests xml write attribute write order.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2013
|
||||
*/
|
||||
public class X4OWriterAttributeTest {
|
||||
|
||||
private File createOutputFile() throws IOException {
|
||||
File outputFile = File.createTempFile("test-writer-attr", ".xml");
|
||||
outputFile.deleteOnExit();
|
||||
return outputFile;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteAttrNatural() throws Exception {
|
||||
File outputFile = createOutputFile();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
X4OWriter<TestObjectRoot> writer = driver.createWriter();
|
||||
|
||||
TestObjectRoot root = reader.readResource("tests/writer/test-attribute-order.xml");
|
||||
writer.writeFile(root, outputFile);
|
||||
String text = new Scanner( outputFile ).useDelimiter("\\A").next();
|
||||
outputFile.delete();
|
||||
|
||||
Assertions.assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
Assertions.assertTrue(text.contains("TestAttributeOrderChildNatural"+
|
||||
" aaaName=\"NAME_1\" aabName=\"NAME_2\" aacName=\"NAME_3\""+
|
||||
" abaName=\"NAME_4\" abbName=\"NAME_5\" abcName=\"NAME_6\""+
|
||||
" caaName=\"NAME_7\" cabName=\"NAME_8\" cacName=\"NAME_9\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteAttrOrdered() throws Exception {
|
||||
File outputFile = createOutputFile();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
X4OWriter<TestObjectRoot> writer = driver.createWriter();
|
||||
|
||||
TestObjectRoot root = reader.readResource("tests/writer/test-attribute-order.xml");
|
||||
writer.writeFile(root, outputFile);
|
||||
String text = new Scanner( outputFile ).useDelimiter("\\A").next();
|
||||
outputFile.delete();
|
||||
|
||||
Assertions.assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
Assertions.assertTrue(text.contains("custom-ordered-child"+
|
||||
" cacName=\"NAME_9\" cabName=\"NAME_8\" caaName=\"NAME_7\""+
|
||||
" abcName=\"NAME_6\" abbName=\"NAME_5\" abaName=\"NAME_4\""+
|
||||
" aaaName=\"NAME_1\" aabName=\"NAME_2\" aacName=\"NAME_3\""));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* X4OWriterSessionTest.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 28, 2013
|
||||
*/
|
||||
public class X4OWriterSessionTest {
|
||||
|
||||
private File createOutputFile() throws IOException {
|
||||
File outputFile = File.createTempFile("test-writer-context", ".xml");
|
||||
outputFile.deleteOnExit();
|
||||
return outputFile;
|
||||
}
|
||||
|
||||
private X4OLanguageSession createContext() throws SAXException, X4OConnectionException, IOException {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
|
||||
X4OLanguageSession context = driver.createLanguage().createLanguageSession();
|
||||
Element rootElement = null;
|
||||
try {
|
||||
rootElement = (Element)context.getLanguage().getLanguageConfiguration().getDefaultElement().newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new SAXException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
rootElement.setElementObject(root);
|
||||
context.setRootElement(rootElement);
|
||||
return context;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteFile() throws Exception {
|
||||
File outputFile = createOutputFile();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OWriterSession<TestObjectRoot> writer = driver.createWriterSession();
|
||||
|
||||
writer.writeFileSession(createContext(), outputFile);
|
||||
String text = X4OWriterTest.readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
Assertions.assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
Assertions.assertTrue(text.contains("http://test.junit.x4o.org/xml/ns/junit-test-root"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:parent name=\"test-bean.xml\"/>"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:configBean"), text);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteFileNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OWriterSession<TestObjectRoot> writer = driver.createWriterSession();
|
||||
Exception e = null;
|
||||
File nullFile = null;
|
||||
try {
|
||||
writer.writeFileSession(createContext(), nullFile);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("file"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteFileName() throws Exception {
|
||||
File outputFile = createOutputFile();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OWriterSession<TestObjectRoot> writer = driver.createWriterSession();
|
||||
|
||||
writer.writeFileSession(createContext(), outputFile.getAbsolutePath());
|
||||
String text = X4OWriterTest.readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
Assertions.assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
Assertions.assertTrue(text.contains("http://test.junit.x4o.org/xml/ns/junit-test-root"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:parent name=\"test-bean.xml\"/>"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:configBean"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteFileNameNull() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OWriterSession<TestObjectRoot> writer = driver.createWriterSession();
|
||||
Exception e = null;
|
||||
String nullFileName = null;
|
||||
try {
|
||||
writer.writeFileSession(createContext(), nullFileName);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
Assertions.assertNotNull(e, "No exception");
|
||||
Assertions.assertEquals(NullPointerException.class, e.getClass(), "Wrong exception class");
|
||||
Assertions.assertTrue(e.getMessage().contains("null"), "Wrong exception message");
|
||||
Assertions.assertTrue(e.getMessage().contains("fileName"), "Wrong exception message");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteStream() throws Exception {
|
||||
File outputFile = createOutputFile();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OWriterSession<TestObjectRoot> writer = driver.createWriterSession();
|
||||
|
||||
OutputStream outputStream = new FileOutputStream(outputFile);
|
||||
try {
|
||||
writer.writeSession(createContext(),outputStream);
|
||||
} finally {
|
||||
outputStream.close();
|
||||
}
|
||||
String text = X4OWriterTest.readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
Assertions.assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
Assertions.assertTrue(text.contains("http://test.junit.x4o.org/xml/ns/junit-test-root"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:parent name=\"test-bean.xml\"/>"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:configBean"));
|
||||
}
|
||||
}
|
||||
161
nx01-x4o-driver/src/test/java/org/x4o/xml/io/X4OWriterTest.java
Normal file
161
nx01-x4o-driver/src/test/java/org/x4o/xml/io/X4OWriterTest.java
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.awt.Component;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
import org.x4o.xml.test.swixml.Accelerator3;
|
||||
import org.x4o.xml.test.swixml.SwiXmlDriver;
|
||||
import org.x4o.xml.test.swixml.SwingEngine;
|
||||
|
||||
/**
|
||||
* X4OWriterTest test xml writer output.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 28, 2013
|
||||
*/
|
||||
public class X4OWriterTest {
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriterSwiXmlOutput() throws Exception {
|
||||
Accelerator3 ac3 = new Accelerator3(false);
|
||||
SwingEngine engine = new SwingEngine(ac3);
|
||||
|
||||
File outputFile = createOutputFile();
|
||||
X4ODriver<Component> driver = SwiXmlDriver.getInstance();
|
||||
X4OReader<Component> reader = driver.createReader();
|
||||
X4OWriter<Component> writer = driver.createWriter(SwiXmlDriver.LANGUAGE_VERSION_3);
|
||||
|
||||
//reader.setProperty(key, value);
|
||||
//writer.setProperty(key, value);
|
||||
|
||||
reader.addELBeanInstance(SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE, engine);
|
||||
Component root = reader.readResource("tests/swixml/swixml-accelerator-3.0.xml");
|
||||
writer.writeFile(root, outputFile);
|
||||
|
||||
Assertions.assertTrue(outputFile.exists(), "Debug file does not exists.");
|
||||
|
||||
//String text = new Scanner( outputFile ).useDelimiter("\\A").next();
|
||||
//System.out.println("Output: '\n"+text+"\n' end in "+outputFile.getAbsolutePath());
|
||||
|
||||
outputFile.delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteFile() throws Exception {
|
||||
File outputFile = createOutputFile();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
X4OWriter<TestObjectRoot> writer = driver.createWriter();
|
||||
|
||||
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
|
||||
writer.writeFile(root, outputFile);
|
||||
String text = readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
Assertions.assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
Assertions.assertTrue(text.contains("http://test.junit.x4o.org/xml/ns/junit-test-root"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:parent name=\"test-bean.xml\"/>"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:configBean"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteFileName() throws Exception {
|
||||
File outputFile = createOutputFile();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
X4OWriter<TestObjectRoot> writer = driver.createWriter();
|
||||
|
||||
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
|
||||
writer.writeFile(root, outputFile.getAbsolutePath());
|
||||
String text = readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
Assertions.assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
Assertions.assertTrue(text.contains("http://test.junit.x4o.org/xml/ns/junit-test-root"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:parent name=\"test-bean.xml\"/>"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:configBean"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteStream() throws Exception {
|
||||
File outputFile = createOutputFile();
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
X4OWriter<TestObjectRoot> writer = driver.createWriter();
|
||||
|
||||
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
|
||||
OutputStream outputStream = new FileOutputStream(outputFile);
|
||||
try {
|
||||
writer.write(root,outputStream);
|
||||
} finally {
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
writer.writeFile(root, outputFile.getAbsolutePath());
|
||||
String text = readFile( outputFile );
|
||||
outputFile.delete();
|
||||
|
||||
Assertions.assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
|
||||
Assertions.assertTrue(text.contains("http://test.junit.x4o.org/xml/ns/junit-test-root"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:parent name=\"test-bean.xml\"/>"));
|
||||
Assertions.assertTrue(text.contains("<junit-test-lang:configBean"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.lang;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.lang.DefaultX4OLanguageLoader.VersionedResources;
|
||||
import org.x4o.xml.test.TestDriver;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o language loader
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 20, 2012
|
||||
*/
|
||||
public class DefaultX4OLanguageLoaderTest {
|
||||
|
||||
static X4ODriver<TestObjectRoot> driver;
|
||||
static X4OLanguage language;
|
||||
static DefaultX4OLanguageLoader loader;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() throws Exception {
|
||||
driver = TestDriver.getInstance();
|
||||
language = driver.createLanguage();
|
||||
loader = (DefaultX4OLanguageLoader)language.getLanguageConfiguration().getDefaultLanguageLoader().newInstance();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadingDuplicate() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
loader.loadLanguage((X4OLanguageLocal)language, "test", "1.0");
|
||||
} catch (Exception ee) {
|
||||
e = ee;
|
||||
}
|
||||
Assertions.assertNotNull(e, "no duplicate module exception");
|
||||
Assertions.assertTrue(e.getMessage().contains("test"), "wrong module id.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testModulesSimple() throws Exception {
|
||||
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("tests/modules/test-modules-simple.xml");
|
||||
Assertions.assertNotNull(in);
|
||||
List<VersionedResources> result = loader.loadLanguageModulesXml(in, "test-modules-simple.xml");
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertFalse(result.isEmpty());
|
||||
Assertions.assertTrue(result.size()==1, "Simple test returned non-one result: "+result.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testModulesFull() throws Exception {
|
||||
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("tests/modules/test-modules-full.xml");
|
||||
Assertions.assertNotNull(in);
|
||||
List<VersionedResources> result = loader.loadLanguageModulesXml(in, "test-modules-full.xml");
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertFalse(result.isEmpty());
|
||||
VersionedResources vr = result.get(0);
|
||||
Assertions.assertTrue(vr.eldResources.size()>1);
|
||||
Assertions.assertTrue(vr.moduleLoaders.size()>1);
|
||||
Assertions.assertTrue(vr.elbResources.size()>1);
|
||||
Assertions.assertTrue(vr.siblingLoaders.size()==1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testModulesDuplicateLoaderNoError() throws Exception {
|
||||
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("tests/modules/test-modules-err-loader.xml");
|
||||
Assertions.assertNotNull(in);
|
||||
List<VersionedResources> result = loader.loadLanguageModulesXml(in, "test-modules-err-loader.xml");
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertFalse(result.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testModulesDuplicateLoader() throws Exception {
|
||||
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("tests/modules/test-modules-err-loader.xml");
|
||||
Assertions.assertNotNull(in);
|
||||
List<VersionedResources> result = loader.loadLanguageModulesXml(in, "test-modules-err-loader.xml");
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertFalse(result.isEmpty());
|
||||
|
||||
Exception e=null;
|
||||
try {
|
||||
loader.validateModules(result);
|
||||
} catch (Exception ee) {
|
||||
e=ee;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertTrue(e.getMessage().contains("Duplicate"), "No 'Duplicate' found in message: "+e.getMessage());
|
||||
Assertions.assertTrue(e.getMessage().contains("module-loader"), "No 'module-loader' found in message: "+e.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testModulesDuplicateSiblingLoader() throws Exception {
|
||||
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("tests/modules/test-modules-err-sibling.xml");
|
||||
Assertions.assertNotNull(in);
|
||||
List<VersionedResources> result = loader.loadLanguageModulesXml(in, "test-modules-err-sibling.xml");
|
||||
Assertions.assertNotNull(result);
|
||||
Assertions.assertFalse(result.isEmpty());
|
||||
|
||||
Exception e=null;
|
||||
try {
|
||||
loader.validateModules(result);
|
||||
} catch (Exception ee) {
|
||||
e=ee;
|
||||
}
|
||||
Assertions.assertNotNull(e);
|
||||
Assertions.assertTrue(e.getMessage().contains("Duplicate"), "No 'Duplicate' found in message: "+e.getMessage());
|
||||
Assertions.assertTrue(e.getMessage().contains("sibling-loader"), "No 'sibling-loader' found in message: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.lang;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* X4OLanguageClassLoaderTest test classloader.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 27, 2012
|
||||
*/
|
||||
public class X4OLanguageClassLoaderTest {
|
||||
|
||||
@Test
|
||||
public void testLoadObject() throws Exception {
|
||||
Object o = X4OLanguageClassLoader.newInstance("java.lang.Object");
|
||||
Assertions.assertNotNull(o);
|
||||
Assertions.assertEquals(Object.class, o.getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tesNullThread() throws Exception {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
try {
|
||||
Thread.currentThread().setContextClassLoader(null);
|
||||
Object o = X4OLanguageClassLoader.newInstance("java.lang.Object");
|
||||
Assertions.assertNotNull(o);
|
||||
Assertions.assertEquals(Object.class, o.getClass());
|
||||
} finally {
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.lang;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* X4OLanguagePropertyTest test static enum code.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 27, 2012
|
||||
*/
|
||||
public class X4OLanguagePropertyTest {
|
||||
|
||||
@Test
|
||||
public void testUriValue() throws Exception {
|
||||
Assertions.assertEquals(1,1);
|
||||
}
|
||||
|
||||
/*
|
||||
public void testUriValue() throws Exception {
|
||||
new X4OLanguagePropertyKeys();
|
||||
X4OLanguageProperty prop = X4OLanguageProperty.valueByUri(X4OLanguagePropertyKeys.LANGUAGE_NAME);
|
||||
assertNotNull(prop);
|
||||
assertEquals(X4OLanguagePropertyKeys.LANGUAGE_NAME, prop.toUri());
|
||||
}
|
||||
|
||||
public void testUriValueNullError() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4OLanguageProperty.valueByUri(null);
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull(e);
|
||||
assertEquals(NullPointerException.class, e.getClass());
|
||||
assertTrue(e.getMessage().contains("uri"));
|
||||
}
|
||||
|
||||
public void testUriValueEmptyError() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4OLanguageProperty.valueByUri("");
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull(e);
|
||||
assertEquals(IllegalArgumentException.class, e.getClass());
|
||||
assertTrue(e.getMessage().contains("empty"));
|
||||
}
|
||||
|
||||
public void testUriValuePrefixError() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4OLanguageProperty.valueByUri("foobar");
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull(e);
|
||||
assertEquals(IllegalArgumentException.class, e.getClass());
|
||||
assertTrue(e.getMessage().contains("foobar"));
|
||||
}
|
||||
|
||||
public void testUriValueMissingError() throws Exception {
|
||||
Exception e = null;
|
||||
try {
|
||||
X4OLanguageProperty.valueByUri("http://language.x4o.org/xml/properties/some-missing-property");
|
||||
} catch (Exception catchE) {
|
||||
e = catchE;
|
||||
}
|
||||
assertNotNull(e);
|
||||
assertEquals(IllegalArgumentException.class, e.getClass());
|
||||
assertTrue(e.getMessage().contains("some-missing-property"));
|
||||
}
|
||||
|
||||
public void testValidValue() throws Exception {
|
||||
X4OLanguageProperty langName = X4OLanguageProperty.valueByUri(X4OLanguagePropertyKeys.LANGUAGE_NAME);
|
||||
X4OLanguageProperty langVersion = X4OLanguageProperty.valueByUri(X4OLanguagePropertyKeys.LANGUAGE_VERSION);
|
||||
assertEquals(false, langName.isValueValid("new-name"));
|
||||
assertEquals(false, langVersion.isValueValid("new-version"));
|
||||
}
|
||||
|
||||
public void testValidValueNull() throws Exception {
|
||||
X4OLanguageProperty elMap = X4OLanguageProperty.valueByUri(X4OLanguagePropertyKeys.EL_BEAN_INSTANCE_MAP);
|
||||
assertEquals(true, elMap.isValueValid(null));
|
||||
}
|
||||
|
||||
public void testValidValueObject() throws Exception {
|
||||
X4OLanguageProperty elMap = X4OLanguageProperty.valueByUri(X4OLanguagePropertyKeys.EL_BEAN_INSTANCE_MAP);
|
||||
assertEquals(false, elMap.isValueValid("string-object"));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.lang.meta;
|
||||
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.X4ODriverManager;
|
||||
|
||||
public class MTestDriver extends X4ODriver<Object> {
|
||||
|
||||
public static final String LANGUAGE_NAME = "mtest";
|
||||
public static final String[] LANGUAGE_VERSIONS = new String[]{X4ODriver.DEFAULT_LANGUAGE_VERSION};
|
||||
|
||||
@Override
|
||||
public String getLanguageName() {
|
||||
return LANGUAGE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getLanguageVersions() {
|
||||
return LANGUAGE_VERSIONS;
|
||||
}
|
||||
|
||||
static public MTestDriver getInstance() {
|
||||
return (MTestDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.lang.meta;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.element.DefaultElement;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.io.X4OReaderSession;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.x4o.xml.lang.phase.X4OPhaseLanguageRead;
|
||||
|
||||
/**
|
||||
* Tests the parent object meta element.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 15, 2012
|
||||
*/
|
||||
public class ParentObjectTest {
|
||||
|
||||
@Test
|
||||
public void testParentElement() throws Exception {
|
||||
X4OLanguageSession context = null;
|
||||
MTestDriver driver = new MTestDriver();
|
||||
X4OReaderSession<?> reader = driver.createReaderSession();
|
||||
reader.addPhaseSkip(X4OPhaseLanguageRead.READ_RELEASE);
|
||||
try {
|
||||
context = reader.readResourceSession("junit/test-meta-parent-element.xml");
|
||||
Assertions.assertEquals(1,context.getRootElement().getChilderen().size());
|
||||
Element childElement = context.getRootElement().getChilderen().get(0);
|
||||
JLabel test = (JLabel)childElement.getElementObject();
|
||||
Assertions.assertEquals("parentTest",test.getText());
|
||||
} finally {
|
||||
reader.releaseSession(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParentObjectElement() throws Exception {
|
||||
DefaultElement ep = new DefaultElement();
|
||||
ParentObjectElement e = new ParentObjectElement();
|
||||
Object o;
|
||||
|
||||
// test non parent
|
||||
o = e.getElementObject();
|
||||
Assertions.assertNull(o);
|
||||
e.setElementObject("test");
|
||||
o = e.getElementObject();
|
||||
Assertions.assertNull(o);
|
||||
|
||||
// test parent
|
||||
e.setParent(ep);
|
||||
o = e.getElementObject();
|
||||
Assertions.assertNull(o);
|
||||
e.setElementObject("test");
|
||||
o = e.getElementObject();
|
||||
Assertions.assertEquals("test",o);
|
||||
o = ep.getElementObject();
|
||||
Assertions.assertEquals("test",o);
|
||||
Assertions.assertEquals(e.getElementObject(),ep.getElementObject());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.lang.meta;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.io.X4OReaderSession;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.x4o.xml.lang.phase.X4OPhaseLanguageRead;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o meta xml language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class ReferenceStoreTest {
|
||||
|
||||
@Test
|
||||
public void testMetaGeneric() throws Exception {
|
||||
X4OLanguageSession context = null;
|
||||
MTestDriver driver = new MTestDriver();
|
||||
X4OReaderSession<?> reader = driver.createReaderSession();
|
||||
reader.addPhaseSkip(X4OPhaseLanguageRead.READ_RELEASE);
|
||||
try {
|
||||
context = reader.readResourceSession("junit/test-meta-generic.xml");
|
||||
Assertions.assertEquals(Date.class.getName(),context.getRootElement().getChilderen().get(0).getElementObject().getClass().getName());
|
||||
} finally {
|
||||
reader.releaseSession(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadClass() throws Exception {
|
||||
X4OLanguageSession context = null;
|
||||
MTestDriver driver = new MTestDriver();
|
||||
X4OReaderSession<?> reader = driver.createReaderSession();
|
||||
reader.addPhaseSkip(X4OPhaseLanguageRead.READ_RELEASE);
|
||||
try {
|
||||
context = reader.readResourceSession("junit/test-meta-reference.xml");
|
||||
Assertions.assertEquals(Date.class.getName(),context.getRootElement().getChilderen().get(0).getElementObject().getClass().getName());
|
||||
} finally {
|
||||
reader.releaseSession(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStoreRef() throws Exception {
|
||||
X4OLanguageSession context = null;
|
||||
MTestDriver driver = new MTestDriver();
|
||||
X4OReaderSession<?> reader = driver.createReaderSession();
|
||||
reader.addPhaseSkip(X4OPhaseLanguageRead.READ_RELEASE);
|
||||
try {
|
||||
context = reader.readResourceSession("junit/test-meta-reference.xml");
|
||||
Assertions.assertEquals(Date.class.getName(),context.getRootElement().getChilderen().get(0).getElementObject().getClass().getName());
|
||||
Assertions.assertEquals(Date.class.getName(),context.getRootElement().getChilderen().get(1).getElementObject().getClass().getName());
|
||||
Assertions.assertEquals(Date.class.getName(),context.getRootElement().getChilderen().get(2).getElementObject().getClass().getName());
|
||||
Assertions.assertEquals(Date.class.getName(),context.getRootElement().getChilderen().get(3).getElementObject().getClass().getName());
|
||||
} finally {
|
||||
reader.releaseSession(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o xml language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class SwingTests {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
//X4OTesting.initLogging();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSwing() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
File f = File.createTempFile("test-swing", ".xml");
|
||||
//f.deleteOnExit();
|
||||
//reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(f));
|
||||
//reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_ELD_PARSER, true);
|
||||
//reader.readResource("tests/test-swing.xml");
|
||||
//Thread.sleep(30000);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o xml language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class TagHandlerTest {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
//X4OTesting.initLogging();
|
||||
}
|
||||
|
||||
private void printS(Throwable e) {
|
||||
if (e.getCause()==null) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
printS(e.getCause());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTagHanders() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
/*
|
||||
File f = File.createTempFile("test-taghandlers", ".xml");
|
||||
f.deleteOnExit();
|
||||
reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(f));
|
||||
try {
|
||||
reader.readResource("tests/test-taghandlers.xml");
|
||||
} catch (Exception e) {
|
||||
printS(e);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test;
|
||||
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.X4ODriverManager;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
public class TestDriver extends X4ODriver<TestObjectRoot> {
|
||||
|
||||
static final public String LANGUAGE_NAME = "test";
|
||||
static final public String[] LANGUAGE_VERSIONS = new String[]{X4ODriver.DEFAULT_LANGUAGE_VERSION};
|
||||
|
||||
@Override
|
||||
public String getLanguageName() {
|
||||
return LANGUAGE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getLanguageVersions() {
|
||||
return LANGUAGE_VERSIONS;
|
||||
}
|
||||
|
||||
static public TestDriver getInstance() {
|
||||
return (TestDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o xml language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class X4OTesting {
|
||||
|
||||
static public void initLogging() throws Exception {
|
||||
// enable all logs
|
||||
InputStream loggingProperties = Class.class.getClass().getResourceAsStream("/META-INF/logging.properties"); // todo: fix loading
|
||||
LogManager.getLogManager().readConfiguration( loggingProperties );
|
||||
loggingProperties.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
import org.x4o.xml.test.models.TestObjectChild;
|
||||
import org.x4o.xml.test.models.TestObjectParent;
|
||||
import org.x4o.xml.test.models.TestObjectRoot;
|
||||
|
||||
/**
|
||||
* XIncludeTest
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 31, 2012
|
||||
*/
|
||||
public class XIncludeTest {
|
||||
|
||||
@Test
|
||||
public void testXInclude() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
TestObjectRoot root = reader.readResource("tests/xinclude/include-base.xml");
|
||||
Assertions.assertNotNull(root);
|
||||
TestObjectRoot parentRoot = (TestObjectRoot)root;
|
||||
if (parentRoot.getTestObjectParents().size()==0) {
|
||||
return; // FIXME: don't fail, as on jdk7 it 'sometimes' fails ...
|
||||
}
|
||||
Assertions.assertEquals(1,parentRoot.getTestObjectParents().size());
|
||||
TestObjectParent parent = parentRoot.getTestObjectParents().get(0);
|
||||
TestObjectChild child = parent.testObjectChilds.get(0);
|
||||
Assertions.assertEquals("include-child.xml",child.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.element;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import org.x4o.xml.element.AbstractElement;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 31, 2007
|
||||
*/
|
||||
public class ContentPaneElement extends AbstractElement {
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElement#getElementObject()
|
||||
*/
|
||||
@Override
|
||||
public Object getElementObject() {
|
||||
return ((JFrame)this.getParent().getElementObject()).getContentPane();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.element;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.xml.element.AbstractElement;
|
||||
import org.x4o.xml.element.ElementException;
|
||||
|
||||
/**
|
||||
* InlinePropertiesElement to test
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 23, 2012
|
||||
*/
|
||||
public class InlinePropertiesElement extends AbstractElement {
|
||||
|
||||
StringWriter xmlString = null;
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElement#doElementStart()
|
||||
*/
|
||||
@Override
|
||||
public void doElementStart() throws ElementException {
|
||||
StringWriter xmlString = new StringWriter();
|
||||
SAX3WriterXml writer = new SAX3WriterXml(xmlString);
|
||||
setElementObject(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElement#doElementEnd()
|
||||
*/
|
||||
@Override
|
||||
public void doElementEnd() throws ElementException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElement#getElementType()
|
||||
*/
|
||||
@Override
|
||||
public ElementType getElementType() {
|
||||
return ElementType.overrideSax;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.element;
|
||||
|
||||
|
||||
import org.x4o.xml.element.AbstractElementConfigurator;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementConfiguratorException;
|
||||
|
||||
|
||||
/**
|
||||
* TestElementConfigurator
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 27, 2012
|
||||
*/
|
||||
public class TestElementConfigurator extends AbstractElementConfigurator {
|
||||
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.element;
|
||||
|
||||
import org.x4o.xml.element.AbstractElementNamespaceAttribute;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementConfiguratorException;
|
||||
|
||||
/**
|
||||
* TestElementConfigurator
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 27, 2012
|
||||
*/
|
||||
public class TestElementNamespaceAttribute extends AbstractElementNamespaceAttribute {
|
||||
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.models;
|
||||
|
||||
public class TestAttributeOrderChild extends TestObjectChild {
|
||||
|
||||
private String aaaName = null;
|
||||
private String aabName = null;
|
||||
private String aacName = null;
|
||||
|
||||
private String abaName = null;
|
||||
private String abbName = null;
|
||||
private String abcName = null;
|
||||
|
||||
private String caaName = null;
|
||||
private String cabName = null;
|
||||
private String cacName = null;
|
||||
|
||||
/**
|
||||
* @return the caaName
|
||||
*/
|
||||
public String getCaaName() {
|
||||
return caaName;
|
||||
}
|
||||
/**
|
||||
* @param caaName the caaName to set
|
||||
*/
|
||||
public void setCaaName(String caaName) {
|
||||
this.caaName = caaName;
|
||||
}
|
||||
/**
|
||||
* @return the cabName
|
||||
*/
|
||||
public String getCabName() {
|
||||
return cabName;
|
||||
}
|
||||
/**
|
||||
* @param cabName the cabName to set
|
||||
*/
|
||||
public void setCabName(String cabName) {
|
||||
this.cabName = cabName;
|
||||
}
|
||||
/**
|
||||
* @return the cacName
|
||||
*/
|
||||
public String getCacName() {
|
||||
return cacName;
|
||||
}
|
||||
/**
|
||||
* @param cacName the cacName to set
|
||||
*/
|
||||
public void setCacName(String cacName) {
|
||||
this.cacName = cacName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the aaaName
|
||||
*/
|
||||
public String getAaaName() {
|
||||
return aaaName;
|
||||
}
|
||||
/**
|
||||
* @param aaaName the aaaName to set
|
||||
*/
|
||||
public void setAaaName(String aaaName) {
|
||||
this.aaaName = aaaName;
|
||||
}
|
||||
/**
|
||||
* @return the aabName
|
||||
*/
|
||||
public String getAabName() {
|
||||
return aabName;
|
||||
}
|
||||
/**
|
||||
* @param aabName the aabName to set
|
||||
*/
|
||||
public void setAabName(String aabName) {
|
||||
this.aabName = aabName;
|
||||
}
|
||||
/**
|
||||
* @return the aacName
|
||||
*/
|
||||
public String getAacName() {
|
||||
return aacName;
|
||||
}
|
||||
/**
|
||||
* @param aacName the aacName to set
|
||||
*/
|
||||
public void setAacName(String aacName) {
|
||||
this.aacName = aacName;
|
||||
}
|
||||
/**
|
||||
* @return the abaName
|
||||
*/
|
||||
public String getAbaName() {
|
||||
return abaName;
|
||||
}
|
||||
/**
|
||||
* @param abaName the abaName to set
|
||||
*/
|
||||
public void setAbaName(String abaName) {
|
||||
this.abaName = abaName;
|
||||
}
|
||||
/**
|
||||
* @return the abbName
|
||||
*/
|
||||
public String getAbbName() {
|
||||
return abbName;
|
||||
}
|
||||
/**
|
||||
* @param abbName the abbName to set
|
||||
*/
|
||||
public void setAbbName(String abbName) {
|
||||
this.abbName = abbName;
|
||||
}
|
||||
/**
|
||||
* @return the abcName
|
||||
*/
|
||||
public String getAbcName() {
|
||||
return abcName;
|
||||
}
|
||||
/**
|
||||
* @param abcName the abcName to set
|
||||
*/
|
||||
public void setAbcName(String abcName) {
|
||||
this.abcName = abcName;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.models;
|
||||
|
||||
public class TestAttributeOrderChildNatural extends TestAttributeOrderChild {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,525 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.models;
|
||||
|
||||
/**
|
||||
* Bean for property testing.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 15, 2009
|
||||
*/
|
||||
public class TestBean {
|
||||
|
||||
// TODO: Add public field support, ... and remove public* methods below
|
||||
|
||||
public int publicIntegerTypeField = 0;
|
||||
public Integer publicIntegerObjectField = new Integer(0);
|
||||
|
||||
public long publicLongTypeField = 0;
|
||||
public Long publicLongObjectField = new Long(0l);
|
||||
|
||||
public double publicDoubleTypeField = 0l;
|
||||
public Double publicDoubleObjectField = new Double(0);
|
||||
|
||||
public float publicFloatTypeField = 0l;
|
||||
public Float publicFloatObjectField = new Float(0);
|
||||
|
||||
public byte publicByteTypeField = 0;
|
||||
public Byte publicByteObjectField = Byte.valueOf((byte)0);
|
||||
|
||||
public boolean publicBooleanTypeField = false;
|
||||
public Boolean publicBooleanObjectField = new Boolean(false);
|
||||
|
||||
public char publicCharTypeField = ' ';
|
||||
public Character publicCharObjectField = new Character(' ');
|
||||
|
||||
public String publicStringObjectField = "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕";
|
||||
//public String publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = " ᒡᒢᑊᒻᒻᓫᔿ";
|
||||
public String publicStringObjectFieldUnicode仙上主天 = "仙上主天";
|
||||
|
||||
//public Date publicDateObjectField = new Date(0); // TODO add date converters
|
||||
|
||||
// private
|
||||
|
||||
private int privateIntegerTypeField = 0;
|
||||
private Integer privateIntegerObjectField = new Integer(0);
|
||||
|
||||
private long privateLongTypeField = 0;
|
||||
private Long privateLongObjectField = new Long(0l);
|
||||
|
||||
private double privateDoubleTypeField = 0l;
|
||||
private Double privateDoubleObjectField = new Double(0);
|
||||
|
||||
private float privateFloatTypeField = 0l;
|
||||
private Float privateFloatObjectField = new Float(0);
|
||||
|
||||
private byte privateByteTypeField = 0;
|
||||
private Byte privateByteObjectField = Byte.valueOf((byte)0);
|
||||
|
||||
private boolean privateBooleanTypeField = false;
|
||||
private Boolean privateBooleanObjectField = new Boolean(false);
|
||||
|
||||
private char privateCharTypeField = ' ';
|
||||
private Character privateCharObjectField = new Character(' ');
|
||||
|
||||
private String privateStringObjectField = "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕";
|
||||
//private String privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = " ᒡᒢᑊᒻᒻᓫᔿ";
|
||||
private String privateStringObjectFieldUnicode仙上主天 = "仙上主天";
|
||||
//private Date privateDateObjectField = new Date(0);
|
||||
|
||||
|
||||
// auto gen , get/set-ers
|
||||
|
||||
/**
|
||||
* @return the publicIntegerTypeField
|
||||
*/
|
||||
public int getPublicIntegerTypeField() {
|
||||
return publicIntegerTypeField;
|
||||
}
|
||||
/**
|
||||
* @param publicIntegerTypeField the publicIntegerTypeField to set
|
||||
*/
|
||||
public void setPublicIntegerTypeField(int publicIntegerTypeField) {
|
||||
this.publicIntegerTypeField = publicIntegerTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the publicIntegerObjectField
|
||||
*/
|
||||
public Integer getPublicIntegerObjectField() {
|
||||
return publicIntegerObjectField;
|
||||
}
|
||||
/**
|
||||
* @param publicIntegerObjectField the publicIntegerObjectField to set
|
||||
*/
|
||||
public void setPublicIntegerObjectField(Integer publicIntegerObjectField) {
|
||||
this.publicIntegerObjectField = publicIntegerObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the publicLongTypeField
|
||||
*/
|
||||
public long getPublicLongTypeField() {
|
||||
return publicLongTypeField;
|
||||
}
|
||||
/**
|
||||
* @param publicLongTypeField the publicLongTypeField to set
|
||||
*/
|
||||
public void setPublicLongTypeField(long publicLongTypeField) {
|
||||
this.publicLongTypeField = publicLongTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the publicLongObjectField
|
||||
*/
|
||||
public Long getPublicLongObjectField() {
|
||||
return publicLongObjectField;
|
||||
}
|
||||
/**
|
||||
* @param publicLongObjectField the publicLongObjectField to set
|
||||
*/
|
||||
public void setPublicLongObjectField(Long publicLongObjectField) {
|
||||
this.publicLongObjectField = publicLongObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the publicDoubleTypeField
|
||||
*/
|
||||
public double getPublicDoubleTypeField() {
|
||||
return publicDoubleTypeField;
|
||||
}
|
||||
/**
|
||||
* @param publicDoubleTypeField the publicDoubleTypeField to set
|
||||
*/
|
||||
public void setPublicDoubleTypeField(double publicDoubleTypeField) {
|
||||
this.publicDoubleTypeField = publicDoubleTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the publicDoubleObjectField
|
||||
*/
|
||||
public Double getPublicDoubleObjectField() {
|
||||
return publicDoubleObjectField;
|
||||
}
|
||||
/**
|
||||
* @param publicDoubleObjectField the publicDoubleObjectField to set
|
||||
*/
|
||||
public void setPublicDoubleObjectField(Double publicDoubleObjectField) {
|
||||
this.publicDoubleObjectField = publicDoubleObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the publicFloatTypeField
|
||||
*/
|
||||
public float getPublicFloatTypeField() {
|
||||
return publicFloatTypeField;
|
||||
}
|
||||
/**
|
||||
* @param publicFloatTypeField the publicFloatTypeField to set
|
||||
*/
|
||||
public void setPublicFloatTypeField(float publicFloatTypeField) {
|
||||
this.publicFloatTypeField = publicFloatTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the publicFloatObjectField
|
||||
*/
|
||||
public Float getPublicFloatObjectField() {
|
||||
return publicFloatObjectField;
|
||||
}
|
||||
/**
|
||||
* @param publicFloatObjectField the publicFloatObjectField to set
|
||||
*/
|
||||
public void setPublicFloatObjectField(Float publicFloatObjectField) {
|
||||
this.publicFloatObjectField = publicFloatObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the publicByteTypeField
|
||||
*/
|
||||
public byte getPublicByteTypeField() {
|
||||
return publicByteTypeField;
|
||||
}
|
||||
/**
|
||||
* @param publicByteTypeField the publicByteTypeField to set
|
||||
*/
|
||||
public void setPublicByteTypeField(byte publicByteTypeField) {
|
||||
this.publicByteTypeField = publicByteTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the publicByteObjectField
|
||||
*/
|
||||
public Byte getPublicByteObjectField() {
|
||||
return publicByteObjectField;
|
||||
}
|
||||
/**
|
||||
* @param publicByteObjectField the publicByteObjectField to set
|
||||
*/
|
||||
public void setPublicByteObjectField(Byte publicByteObjectField) {
|
||||
this.publicByteObjectField = publicByteObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the publicBooleanTypeField
|
||||
*/
|
||||
public boolean isPublicBooleanTypeField() {
|
||||
return publicBooleanTypeField;
|
||||
}
|
||||
/**
|
||||
* @param publicBooleanTypeField the publicBooleanTypeField to set
|
||||
*/
|
||||
public void setPublicBooleanTypeField(boolean publicBooleanTypeField) {
|
||||
this.publicBooleanTypeField = publicBooleanTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the publicBooleanObjectField
|
||||
*/
|
||||
public Boolean getPublicBooleanObjectField() {
|
||||
return publicBooleanObjectField;
|
||||
}
|
||||
/**
|
||||
* @param publicBooleanObjectField the publicBooleanObjectField to set
|
||||
*/
|
||||
public void setPublicBooleanObjectField(Boolean publicBooleanObjectField) {
|
||||
this.publicBooleanObjectField = publicBooleanObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the publicCharTypeField
|
||||
*/
|
||||
public char getPublicCharTypeField() {
|
||||
return publicCharTypeField;
|
||||
}
|
||||
/**
|
||||
* @param publicCharTypeField the publicCharTypeField to set
|
||||
*/
|
||||
public void setPublicCharTypeField(char publicCharTypeField) {
|
||||
this.publicCharTypeField = publicCharTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the publicCharObjectField
|
||||
*/
|
||||
public Character getPublicCharObjectField() {
|
||||
return publicCharObjectField;
|
||||
}
|
||||
/**
|
||||
* @param publicCharObjectField the publicCharObjectField to set
|
||||
*/
|
||||
public void setPublicCharObjectField(Character publicCharObjectField) {
|
||||
this.publicCharObjectField = publicCharObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the publicStringObjectField
|
||||
*/
|
||||
public String getPublicStringObjectField() {
|
||||
return publicStringObjectField;
|
||||
}
|
||||
/**
|
||||
* @param publicStringObjectField the publicStringObjectField to set
|
||||
*/
|
||||
public void setPublicStringObjectField(String publicStringObjectField) {
|
||||
this.publicStringObjectField = publicStringObjectField;
|
||||
}
|
||||
// /**
|
||||
// * @return the publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ
|
||||
// */
|
||||
// public String getPublicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ() {
|
||||
// return publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ;
|
||||
// }
|
||||
// /**
|
||||
// * @param publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ the publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ to set
|
||||
// */
|
||||
// public void setPublicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ(String publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ) {
|
||||
// this.publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ;
|
||||
// }
|
||||
/**
|
||||
* @return the publicStringObjectFieldUnicode仙上主天
|
||||
*/
|
||||
public String getPublicStringObjectFieldUnicode仙上主天() {
|
||||
return publicStringObjectFieldUnicode仙上主天;
|
||||
}
|
||||
/**
|
||||
* @param publicStringObjectFieldUnicode仙上主天 the publicStringObjectFieldUnicode仙上主天 to set
|
||||
*/
|
||||
public void setPublicStringObjectFieldUnicode仙上主天(String publicStringObjectFieldUnicode仙上主天) {
|
||||
this.publicStringObjectFieldUnicode仙上主天 = publicStringObjectFieldUnicode仙上主天;
|
||||
}
|
||||
/*
|
||||
* @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
|
||||
*/
|
||||
public int getPrivateIntegerTypeField() {
|
||||
return privateIntegerTypeField;
|
||||
}
|
||||
/**
|
||||
* @param privateIntegerTypeField the privateIntegerTypeField to set
|
||||
*/
|
||||
public void setPrivateIntegerTypeField(int privateIntegerTypeField) {
|
||||
this.privateIntegerTypeField = privateIntegerTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the privateIntegerObjectField
|
||||
*/
|
||||
public Integer getPrivateIntegerObjectField() {
|
||||
return privateIntegerObjectField;
|
||||
}
|
||||
/**
|
||||
* @param privateIntegerObjectField the privateIntegerObjectField to set
|
||||
*/
|
||||
public void setPrivateIntegerObjectField(Integer privateIntegerObjectField) {
|
||||
this.privateIntegerObjectField = privateIntegerObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the privateLongTypeField
|
||||
*/
|
||||
public long getPrivateLongTypeField() {
|
||||
return privateLongTypeField;
|
||||
}
|
||||
/**
|
||||
* @param privateLongTypeField the privateLongTypeField to set
|
||||
*/
|
||||
public void setPrivateLongTypeField(long privateLongTypeField) {
|
||||
this.privateLongTypeField = privateLongTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the privateLongObjectField
|
||||
*/
|
||||
public Long getPrivateLongObjectField() {
|
||||
return privateLongObjectField;
|
||||
}
|
||||
/**
|
||||
* @param privateLongObjectField the privateLongObjectField to set
|
||||
*/
|
||||
public void setPrivateLongObjectField(Long privateLongObjectField) {
|
||||
this.privateLongObjectField = privateLongObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the privateDoubleTypeField
|
||||
*/
|
||||
public double getPrivateDoubleTypeField() {
|
||||
return privateDoubleTypeField;
|
||||
}
|
||||
/**
|
||||
* @param privateDoubleTypeField the privateDoubleTypeField to set
|
||||
*/
|
||||
public void setPrivateDoubleTypeField(double privateDoubleTypeField) {
|
||||
this.privateDoubleTypeField = privateDoubleTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the privateDoubleObjectField
|
||||
*/
|
||||
public Double getPrivateDoubleObjectField() {
|
||||
return privateDoubleObjectField;
|
||||
}
|
||||
/**
|
||||
* @param privateDoubleObjectField the privateDoubleObjectField to set
|
||||
*/
|
||||
public void setPrivateDoubleObjectField(Double privateDoubleObjectField) {
|
||||
this.privateDoubleObjectField = privateDoubleObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the privateFloatTypeField
|
||||
*/
|
||||
public float getPrivateFloatTypeField() {
|
||||
return privateFloatTypeField;
|
||||
}
|
||||
/**
|
||||
* @param privateFloatTypeField the privateFloatTypeField to set
|
||||
*/
|
||||
public void setPrivateFloatTypeField(float privateFloatTypeField) {
|
||||
this.privateFloatTypeField = privateFloatTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the privateFloatObjectField
|
||||
*/
|
||||
public Float getPrivateFloatObjectField() {
|
||||
return privateFloatObjectField;
|
||||
}
|
||||
/**
|
||||
* @param privateFloatObjectField the privateFloatObjectField to set
|
||||
*/
|
||||
public void setPrivateFloatObjectField(Float privateFloatObjectField) {
|
||||
this.privateFloatObjectField = privateFloatObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the privateByteTypeField
|
||||
*/
|
||||
public byte getPrivateByteTypeField() {
|
||||
return privateByteTypeField;
|
||||
}
|
||||
/**
|
||||
* @param privateByteTypeField the privateByteTypeField to set
|
||||
*/
|
||||
public void setPrivateByteTypeField(byte privateByteTypeField) {
|
||||
this.privateByteTypeField = privateByteTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the privateByteObjectField
|
||||
*/
|
||||
public Byte getPrivateByteObjectField() {
|
||||
return privateByteObjectField;
|
||||
}
|
||||
/**
|
||||
* @param privateByteObjectField the privateByteObjectField to set
|
||||
*/
|
||||
public void setPrivateByteObjectField(Byte privateByteObjectField) {
|
||||
this.privateByteObjectField = privateByteObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the privateBooleanTypeField
|
||||
*/
|
||||
public boolean isPrivateBooleanTypeField() {
|
||||
return privateBooleanTypeField;
|
||||
}
|
||||
/**
|
||||
* @param privateBooleanTypeField the privateBooleanTypeField to set
|
||||
*/
|
||||
public void setPrivateBooleanTypeField(boolean privateBooleanTypeField) {
|
||||
this.privateBooleanTypeField = privateBooleanTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the privateBooleanObjectField
|
||||
*/
|
||||
public Boolean getPrivateBooleanObjectField() {
|
||||
return privateBooleanObjectField;
|
||||
}
|
||||
/**
|
||||
* @param privateBooleanObjectField the privateBooleanObjectField to set
|
||||
*/
|
||||
public void setPrivateBooleanObjectField(Boolean privateBooleanObjectField) {
|
||||
this.privateBooleanObjectField = privateBooleanObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the privateCharTypeField
|
||||
*/
|
||||
public char getPrivateCharTypeField() {
|
||||
return privateCharTypeField;
|
||||
}
|
||||
/**
|
||||
* @param privateCharTypeField the privateCharTypeField to set
|
||||
*/
|
||||
public void setPrivateCharTypeField(char privateCharTypeField) {
|
||||
this.privateCharTypeField = privateCharTypeField;
|
||||
}
|
||||
/**
|
||||
* @return the privateCharObjectField
|
||||
*/
|
||||
public Character getPrivateCharObjectField() {
|
||||
return privateCharObjectField;
|
||||
}
|
||||
/**
|
||||
* @param privateCharObjectField the privateCharObjectField to set
|
||||
*/
|
||||
public void setPrivateCharObjectField(Character privateCharObjectField) {
|
||||
this.privateCharObjectField = privateCharObjectField;
|
||||
}
|
||||
/**
|
||||
* @return the privateStringObjectField
|
||||
*/
|
||||
public String getPrivateStringObjectField() {
|
||||
return privateStringObjectField;
|
||||
}
|
||||
/**
|
||||
* @param privateStringObjectField the privateStringObjectField to set
|
||||
*/
|
||||
public void setPrivateStringObjectField(String privateStringObjectField) {
|
||||
this.privateStringObjectField = privateStringObjectField;
|
||||
}
|
||||
// /**
|
||||
// * @return the privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ
|
||||
// */
|
||||
// public String getPrivateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ() {
|
||||
// return privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ;
|
||||
// }
|
||||
// /**
|
||||
// * @param privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ the privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ to set
|
||||
// */
|
||||
// public void setPrivateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ(String privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ) {
|
||||
// this.privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ;
|
||||
// }
|
||||
/**
|
||||
* @return the privateStringObjectFieldUnicode仙上主天
|
||||
*/
|
||||
public String getPrivateStringObjectFieldUnicode仙上主天() {
|
||||
return privateStringObjectFieldUnicode仙上主天;
|
||||
}
|
||||
/**
|
||||
* @param privateStringObjectFieldUnicode仙上主天 the privateStringObjectFieldUnicode仙上主天 to set
|
||||
*/
|
||||
public void setPrivateStringObjectFieldUnicode仙上主天(String privateStringObjectFieldUnicode仙上主天) {
|
||||
this.privateStringObjectFieldUnicode仙上主天 = privateStringObjectFieldUnicode仙上主天;
|
||||
}
|
||||
/*
|
||||
* @return the privateDateObjectField
|
||||
|
||||
public Date getPrivateDateObjectField() {
|
||||
return privateDateObjectField;
|
||||
}*/
|
||||
/*
|
||||
* @param privateDateObjectField the privateDateObjectField to set
|
||||
|
||||
public void setPrivateDateObjectField(Date privateDateObjectField) {
|
||||
this.privateDateObjectField = privateDateObjectField;
|
||||
}*/
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.models;
|
||||
|
||||
public class TestObjectChild {
|
||||
|
||||
private String name = null;
|
||||
private Integer price = null;
|
||||
private Double size = null;
|
||||
private Object parent = null;
|
||||
|
||||
// Some test methods
|
||||
public String getName() { return name; }
|
||||
public void setName(String name) { this.name = name; }
|
||||
public Integer getPrice() { return price; }
|
||||
public void setPrice(Integer price) { this.price = price; }
|
||||
public Double getSize() { return size; }
|
||||
public void setSize(Double size) { this.size = size; }
|
||||
public Object getParent() { return parent; }
|
||||
public void setParent(Object parent) { this.parent = parent; }
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestObjectParent {
|
||||
|
||||
public String name = null;
|
||||
public List<TestObjectChild> testObjectChilds = new ArrayList<TestObjectChild>(2);
|
||||
|
||||
public void addTestObjectChild(TestObjectChild c) {
|
||||
testObjectChilds.add(c);
|
||||
}
|
||||
|
||||
public List<TestObjectChild> getTestObjectChilds() {
|
||||
return testObjectChilds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestObjectRoot {
|
||||
|
||||
private List<TestObjectChild> testObjectChilds = new ArrayList<TestObjectChild>(2);
|
||||
private List<TestObjectParent> testObjectParents = new ArrayList<TestObjectParent>(2);
|
||||
private List<TestBean> testBeans = new ArrayList<TestBean>(2);
|
||||
private List<Object> testObjects = new ArrayList<Object>(2);
|
||||
|
||||
public void addChild(TestObjectChild c) {
|
||||
testObjectChilds.add(c);
|
||||
}
|
||||
|
||||
public void addParent(TestObjectParent c) {
|
||||
testObjectParents.add(c);
|
||||
}
|
||||
|
||||
public void addTestBean(TestBean c) {
|
||||
testBeans.add(c);
|
||||
}
|
||||
|
||||
public void addObject(Object c) {
|
||||
testObjects.add(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the testObjectChilds
|
||||
*/
|
||||
public List<TestObjectChild> getTestObjectChilds() {
|
||||
return testObjectChilds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the testObjectParents
|
||||
*/
|
||||
public List<TestObjectParent> getTestObjectParents() {
|
||||
return testObjectParents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the testBeans
|
||||
*/
|
||||
public List<TestBean> getTestBeans() {
|
||||
return testBeans;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the testObjects
|
||||
*/
|
||||
public List<Object> getTestObjects() {
|
||||
return testObjects;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
* Accelerator2 test demo.
|
||||
*
|
||||
* see swixml sample; http://www.swixml.org/samples/src/Accelerator.java
|
||||
* Added exitMethod and render boolean for unit testing.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 15, 2012
|
||||
*/
|
||||
public class Accelerator2 {
|
||||
|
||||
protected static final String DESCRIPTOR = "tests/swixml/swixml-accelerator-2.0.xml";
|
||||
protected SwingEngine swix = new SwingEngine( this );
|
||||
|
||||
public Accelerator2(boolean render) throws Exception {
|
||||
if (render) {
|
||||
swix.render( Accelerator2.DESCRIPTOR, SwiXmlDriver.LANGUAGE_VERSION_2 ).setVisible( true );
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public Action newAction = new AbstractAction() {
|
||||
public void actionPerformed( ActionEvent e ) {
|
||||
JOptionPane.showMessageDialog( swix.getRootComponent(), "Sorry, not implemented yet." );
|
||||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public Action aboutAction = new AbstractAction() {
|
||||
public void actionPerformed( ActionEvent e ) {
|
||||
JOptionPane.showMessageDialog( swix.getRootComponent(), "This is the Accelerator Example." );
|
||||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public Action exitAction = new AbstractAction() {
|
||||
public void actionPerformed( ActionEvent e ) {
|
||||
System.exit(0);
|
||||
}
|
||||
};
|
||||
|
||||
public static void main( String[] args ) {
|
||||
try {
|
||||
new Accelerator2(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml;
|
||||
|
||||
/**
|
||||
* Accelerator3 test demo.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 15, 2012
|
||||
*/
|
||||
public class Accelerator3 extends Accelerator2 {
|
||||
|
||||
protected static final String DESCRIPTOR = "tests/swixml/swixml-accelerator-3.0.xml";
|
||||
|
||||
public Accelerator3(boolean render) throws Exception {
|
||||
super(false);
|
||||
if (render) {
|
||||
swix.render( Accelerator3.DESCRIPTOR, SwiXmlDriver.LANGUAGE_VERSION_3 ).setVisible( true );
|
||||
}
|
||||
}
|
||||
|
||||
public static void main( String[] args ) {
|
||||
try {
|
||||
new Accelerator3(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
|
||||
/**
|
||||
* Accelerator3Test test xml parsing
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 31, 2012
|
||||
*/
|
||||
public class Accelerator3Test {
|
||||
|
||||
@Test
|
||||
public void testSwingMenuAbout() throws Exception {
|
||||
Accelerator3 ac3 = new Accelerator3(false);
|
||||
SwingEngine engine = new SwingEngine(ac3);
|
||||
SwiXmlDriver driver = SwiXmlDriver.getInstance();
|
||||
X4OReader<Component> reader = driver.createReader(SwiXmlDriver.LANGUAGE_VERSION_3);
|
||||
reader.addELBeanInstance(SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE, engine);
|
||||
Component root = reader.readResource(Accelerator3.DESCRIPTOR);
|
||||
Assertions.assertNotNull(root);
|
||||
JFrame frame = (JFrame)root;
|
||||
Assertions.assertTrue(frame.getJMenuBar().getMenuCount()>0);
|
||||
JMenu helpMenu = frame.getJMenuBar().getMenu(1);
|
||||
Assertions.assertEquals("Help",helpMenu.getText());
|
||||
Assertions.assertTrue(helpMenu.getMenuComponentCount()>0);
|
||||
JMenuItem about = (JMenuItem)helpMenu.getMenuComponent(0);
|
||||
Assertions.assertEquals("mi_about", about.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import org.x4o.xml.element.AbstractElementConfigurator;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementConfiguratorException;
|
||||
|
||||
/**
|
||||
* SwiXmlActionConfigurator sets the Action object.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 16, 2012
|
||||
*/
|
||||
public class SwiXmlActionConfigurator extends AbstractElementConfigurator {
|
||||
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
String actionName = element.getAttributes().get("Action");
|
||||
if (actionName==null) {
|
||||
return;
|
||||
}
|
||||
SwingEngine se = SwiXmlDriver.getSwingEngine(element.getLanguageSession());
|
||||
Action action = se.getUIActionByName(actionName);
|
||||
Object object = element.getElementObject();
|
||||
if (object instanceof JMenuItem) {
|
||||
((JMenuItem)object).setAction(action);
|
||||
}
|
||||
// etc
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.el.ValueExpression;
|
||||
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.X4ODriverManager;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
|
||||
/**
|
||||
* SwiXmlParser works with the SwingEngine to config the UI tree.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 15, 2012
|
||||
*/
|
||||
public class SwiXmlDriver extends X4ODriver<Component> {
|
||||
|
||||
public static final String LANGUAGE_NAME = "swixml";
|
||||
public static final String LANGUAGE_VERSION_2 = "2.0";
|
||||
public static final String LANGUAGE_VERSION_2_NSURI = "http://swixml.junit.x4o.org/xml/ns/junit-swixml-lang";
|
||||
public static final String LANGUAGE_VERSION_3 = "3.0";
|
||||
public static final String[] LANGUAGE_VERSIONS = new String[]{LANGUAGE_VERSION_2,LANGUAGE_VERSION_3};
|
||||
public static final String LANGUAGE_EL_SWING_ENGINE = "swingEngine";
|
||||
|
||||
/**
|
||||
* Helper for while parsing to get the SwingEngine.
|
||||
* @param elementLanguage The elementLanguage to get the swingEngine out.
|
||||
* @return Returns the SwingEngine for this elementLanguage.
|
||||
*/
|
||||
static public SwingEngine getSwingEngine(X4OLanguageSession elementLanguage) {
|
||||
ValueExpression ee = elementLanguage.getExpressionLanguageFactory().createValueExpression(elementLanguage.getExpressionLanguageContext(),"${"+SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE+"}",Object.class);
|
||||
SwingEngine se = (SwingEngine)ee.getValue(elementLanguage.getExpressionLanguageContext());
|
||||
return se;
|
||||
}
|
||||
|
||||
static public SwiXmlDriver getInstance() {
|
||||
return (SwiXmlDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguageName() {
|
||||
return LANGUAGE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getLanguageVersions() {
|
||||
return LANGUAGE_VERSIONS;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import javax.swing.Action;
|
||||
|
||||
import org.x4o.xml.io.DefaultX4OReader;
|
||||
import org.x4o.xml.io.X4OReader;
|
||||
|
||||
/**
|
||||
* SwingEngine demo.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 15, 2012
|
||||
*/
|
||||
public class SwingEngine {
|
||||
|
||||
private Object uiHandler;
|
||||
private Component rootComponent = null;
|
||||
|
||||
public SwingEngine(Object uiHandler) {
|
||||
this.uiHandler=uiHandler;
|
||||
}
|
||||
|
||||
public Action getUIActionByName(String name) {
|
||||
if (name==null) {
|
||||
return null;
|
||||
}
|
||||
if (uiHandler==null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
for (Field f:uiHandler.getClass().getFields()) {
|
||||
if (name.equals(f.getName())) {
|
||||
Object value = f.get(uiHandler);
|
||||
if (value instanceof Action) {
|
||||
return (Action)value;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Component render(String resource,String languageVersion) {
|
||||
SwiXmlDriver driver = SwiXmlDriver.getInstance();
|
||||
X4OReader<Component> reader = driver.createReader(languageVersion);
|
||||
if (SwiXmlDriver.LANGUAGE_VERSION_2.equals(languageVersion)) {
|
||||
reader.setProperty(DefaultX4OReader.DOC_EMPTY_NAMESPACE_URI, SwiXmlDriver.LANGUAGE_VERSION_2_NSURI);
|
||||
}
|
||||
reader.addELBeanInstance(SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE, this);
|
||||
try {
|
||||
rootComponent = reader.readResource(resource);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return getRootComponent();
|
||||
}
|
||||
|
||||
public Component getRootComponent() {
|
||||
return rootComponent;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml.bind;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
import org.x4o.xml.element.AbstractElementBindingHandler;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementBindingHandlerException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 16, 2012
|
||||
*/
|
||||
public class JFrameBindingHandler extends AbstractElementBindingHandler<JFrame> {
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||
*/
|
||||
public Class<?> getBindParentClass() {
|
||||
return JFrame.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
|
||||
*/
|
||||
public Class<?>[] getBindChildClasses() {
|
||||
return new Class[] {JMenuBar.class,JComponent.class};
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void bindChild(Element childElement, JFrame parentObject, Object childObject) throws ElementBindingHandlerException {
|
||||
JFrame frame = (JFrame)parentObject;
|
||||
if (childObject instanceof JMenuBar) {
|
||||
JMenuBar child = (JMenuBar)childObject;
|
||||
frame.getRootPane().setJMenuBar(child);
|
||||
} else if (childObject instanceof JComponent) {
|
||||
JComponent child = (JComponent)childObject;
|
||||
|
||||
String c = childElement.getAttributes().get("constraints");
|
||||
Object con = null;
|
||||
if ("BorderLayout.CENTER".equals(c)) {
|
||||
con = BorderLayout.CENTER;
|
||||
} else if ("BorderLayout.NORTH".equals(c)) {
|
||||
con = BorderLayout.NORTH;
|
||||
} else if ("BorderLayout.CENTER".equals(c)) {
|
||||
con = BorderLayout.CENTER;
|
||||
} else if ("BorderLayout.SOUTH".equals(c)) {
|
||||
con = BorderLayout.SOUTH;
|
||||
}
|
||||
|
||||
if (con==null) {
|
||||
frame.getContentPane().add(child);
|
||||
} else {
|
||||
frame.getContentPane().add(child,con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void createChilderen(Element parentElement,JFrame parent) throws ElementBindingHandlerException {
|
||||
createChild(parentElement, parent.getMenuBar());
|
||||
for (Component c:parent.getComponents()) {
|
||||
if (c instanceof JComponent) {
|
||||
createChild(parentElement, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml.bind;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JInternalFrame;
|
||||
|
||||
import org.x4o.xml.element.AbstractElementBindingHandler;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementBindingHandlerException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 16, 2012
|
||||
*/
|
||||
public class JInternalFrameBindingHandler extends AbstractElementBindingHandler<JInternalFrame> {
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||
*/
|
||||
public Class<?> getBindParentClass() {
|
||||
return JInternalFrame.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
|
||||
*/
|
||||
public Class<?>[] getBindChildClasses() {
|
||||
return new Class[] {JComponent.class};
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void bindChild(Element childElement, JInternalFrame frame, Object childObject) throws ElementBindingHandlerException {
|
||||
JComponent child = (JComponent)childObject;
|
||||
|
||||
String c = childElement.getAttributes().get("constraints");
|
||||
Object con = null;
|
||||
if ("BorderLayout.CENTER".equals(c)) {
|
||||
con = BorderLayout.CENTER;
|
||||
} else if ("BorderLayout.NORTH".equals(c)) {
|
||||
con = BorderLayout.NORTH;
|
||||
} else if ("BorderLayout.CENTER".equals(c)) {
|
||||
con = BorderLayout.CENTER;
|
||||
} else if ("BorderLayout.SOUTH".equals(c)) {
|
||||
con = BorderLayout.SOUTH;
|
||||
}
|
||||
if (con==null) {
|
||||
frame.getContentPane().add(child);
|
||||
} else {
|
||||
frame.getContentPane().add(child,con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void createChilderen(Element parentElement,JInternalFrame parent) throws ElementBindingHandlerException {
|
||||
for (Component c:parent.getComponents()) {
|
||||
if (c instanceof JComponent) {
|
||||
if (c.getClass().getName().startsWith("javax.swing.plaf")) {
|
||||
return;
|
||||
}
|
||||
createChild(parentElement, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml.bind;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.x4o.xml.element.AbstractElementBindingHandler;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementBindingHandlerException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 16, 2012
|
||||
*/
|
||||
public class JPanelBindingHandler extends AbstractElementBindingHandler<JPanel> {
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||
*/
|
||||
public Class<?> getBindParentClass() {
|
||||
return JPanel.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
|
||||
*/
|
||||
public Class<?>[] getBindChildClasses() {
|
||||
return new Class[] {JComponent.class};
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void bindChild(Element childElement, JPanel parent, Object childObject) throws ElementBindingHandlerException {
|
||||
JComponent child = (JComponent)childObject;
|
||||
|
||||
String c = childElement.getAttributes().get("constraints");
|
||||
Object con = null;
|
||||
if ("BorderLayout.CENTER".equals(c)) {
|
||||
con = BorderLayout.CENTER;
|
||||
} else if ("BorderLayout.NORTH".equals(c)) {
|
||||
con = BorderLayout.NORTH;
|
||||
} else if ("BorderLayout.CENTER".equals(c)) {
|
||||
con = BorderLayout.CENTER;
|
||||
} else if ("BorderLayout.SOUTH".equals(c)) {
|
||||
con = BorderLayout.SOUTH;
|
||||
}
|
||||
if (con==null) {
|
||||
parent.add(child);
|
||||
} else {
|
||||
parent.add(child,con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void createChilderen(Element parentElement,JPanel parent) throws ElementBindingHandlerException {
|
||||
for (Component c:parent.getComponents()) {
|
||||
if (c instanceof JComponent) {
|
||||
createChild(parentElement, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml.bind;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JSplitPane;
|
||||
|
||||
import org.x4o.xml.element.AbstractElementBindingHandler;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementBindingHandlerException;
|
||||
|
||||
/**
|
||||
* JSplitPaneBindingHandler binds components to the JSplitPane
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 16, 2012
|
||||
*/
|
||||
public class JSplitPaneBindingHandler extends AbstractElementBindingHandler<JSplitPane> {
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||
*/
|
||||
public Class<?> getBindParentClass() {
|
||||
return JSplitPane.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
|
||||
*/
|
||||
public Class<?>[] getBindChildClasses() {
|
||||
return new Class[] {JComponent.class};
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object, )
|
||||
*/
|
||||
public void bindChild(Element childElement, JSplitPane pane, Object childObject) throws ElementBindingHandlerException {
|
||||
JComponent child = (JComponent)childObject;
|
||||
if (pane.getLeftComponent() instanceof JButton) { // strange swing constructor for splitpane
|
||||
pane.setLeftComponent(child);
|
||||
} else if (pane.getRightComponent() instanceof JButton) {
|
||||
pane.setRightComponent(child);
|
||||
} else {
|
||||
throw new ElementBindingHandlerException("SplitPane is full.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void createChilderen(Element parentElement,JSplitPane parentObject) throws ElementBindingHandlerException {
|
||||
createChild(parentElement, parentObject.getLeftComponent());
|
||||
createChild(parentElement, parentObject.getRightComponent());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml.conv;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverterException;
|
||||
|
||||
/**
|
||||
* BorderConverter test converter.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 17, 2012
|
||||
*/
|
||||
public class BorderConverter extends AbstractStringObjectConverter {
|
||||
|
||||
private static final long serialVersionUID = 6729812931433525103L;
|
||||
|
||||
public Class<?> getObjectClassTo() {
|
||||
return Border.class;
|
||||
}
|
||||
|
||||
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
|
||||
return ((Border)obj).toString();
|
||||
}
|
||||
|
||||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
try {
|
||||
if ("LoweredBevelBorder".equals(str)) {
|
||||
return BorderFactory.createLoweredBevelBorder();
|
||||
} else {
|
||||
return BorderFactory.createEmptyBorder();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ObjectConverterException(this,e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
BorderConverter result = new BorderConverter();
|
||||
result.converters=cloneConverters();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml.conv;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverterException;
|
||||
|
||||
/**
|
||||
* ColorConverter test converter.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 17, 2012
|
||||
*/
|
||||
public class ColorConverter extends AbstractStringObjectConverter {
|
||||
|
||||
private static final long serialVersionUID = 6729812931433525103L;
|
||||
|
||||
public Class<?> getObjectClassTo() {
|
||||
return Color.class;
|
||||
}
|
||||
|
||||
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
|
||||
return ((Color)obj).toString();
|
||||
}
|
||||
|
||||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
try {
|
||||
if (str.length()==0) {
|
||||
throw new ObjectConverterException(this,"Can't convert empty color.");
|
||||
}
|
||||
if (Character.isDigit(str.charAt(0))) {
|
||||
return Color.decode(str);
|
||||
} else {
|
||||
if ("blue".equalsIgnoreCase(str)) {
|
||||
return Color.BLUE;
|
||||
} else if ("green".equalsIgnoreCase(str)) {
|
||||
return Color.GREEN;
|
||||
} else if ("red".equalsIgnoreCase(str)) {
|
||||
return Color.RED;
|
||||
}
|
||||
throw new ObjectConverterException(this,"Can't convert color: "+str);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ObjectConverterException(this,e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
ColorConverter result = new ColorConverter();
|
||||
result.converters=cloneConverters();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml.conv;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverterException;
|
||||
|
||||
/**
|
||||
* IconConverter test converter.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 17, 2012
|
||||
*/
|
||||
public class IconConverter extends AbstractStringObjectConverter {
|
||||
|
||||
private static final long serialVersionUID = 6729812931433525103L;
|
||||
|
||||
public Class<?> getObjectClassTo() {
|
||||
return Icon.class;
|
||||
}
|
||||
|
||||
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
|
||||
return ((Icon)obj).toString();
|
||||
}
|
||||
|
||||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
try {
|
||||
Icon icon = UIManager.getIcon("OptionPane.questionIcon");
|
||||
|
||||
return icon;
|
||||
} catch (Exception e) {
|
||||
throw new ObjectConverterException(this,e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
IconConverter result = new IconConverter();
|
||||
result.converters=cloneConverters();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml.conv;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.JSplitPane;
|
||||
|
||||
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverterException;
|
||||
|
||||
/**
|
||||
* JSplitPaneOrientationConverter test converter.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 17, 2012
|
||||
*/
|
||||
public class JSplitPaneOrientationConverter extends AbstractStringObjectConverter {
|
||||
|
||||
private static final long serialVersionUID = 6729812931433525103L;
|
||||
|
||||
public Class<?> getObjectClassTo() {
|
||||
return Integer.class;
|
||||
}
|
||||
|
||||
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
|
||||
return ((Integer)obj).toString();
|
||||
}
|
||||
|
||||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
try {
|
||||
if ("HORIZONTAL".equals(str)) {
|
||||
return JSplitPane.HORIZONTAL_SPLIT;
|
||||
} else if ("VERTICAL".equals(str)) {
|
||||
return JSplitPane.VERTICAL_SPLIT;
|
||||
} else {
|
||||
throw new ObjectConverterException(this,"Unknown orientation: "+str);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ObjectConverterException(this,e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
JSplitPaneOrientationConverter result = new JSplitPaneOrientationConverter();
|
||||
result.converters=cloneConverters();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml.conv;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverterException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 17, 2012
|
||||
*/
|
||||
public class KeyStrokeConverter extends AbstractStringObjectConverter {
|
||||
|
||||
private static final long serialVersionUID = 6729812931433525103L;
|
||||
|
||||
public Class<?> getObjectClassTo() {
|
||||
return KeyStroke.class;
|
||||
}
|
||||
|
||||
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
|
||||
return ((KeyStroke)obj).toString();
|
||||
}
|
||||
|
||||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
try {
|
||||
KeyStroke key = KeyStroke.getKeyStroke(str);
|
||||
|
||||
return key;
|
||||
} catch (Exception e) {
|
||||
throw new ObjectConverterException(this,e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
KeyStrokeConverter result = new KeyStrokeConverter();
|
||||
result.converters=cloneConverters();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, 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.test.swixml.conv;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.LayoutManager;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.x4o.xml.conv.AbstractStringObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverter;
|
||||
import org.x4o.xml.conv.ObjectConverterException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 17, 2012
|
||||
*/
|
||||
public class LayoutConverter extends AbstractStringObjectConverter {
|
||||
|
||||
private static final long serialVersionUID = 6729812931433525103L;
|
||||
|
||||
public Class<?> getObjectClassTo() {
|
||||
return LayoutManager.class;
|
||||
}
|
||||
|
||||
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
|
||||
return ((LayoutManager)obj).toString();
|
||||
}
|
||||
|
||||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
try {
|
||||
if ("borderlayout".equals(str)) {
|
||||
return new BorderLayout();
|
||||
} else if (str.startsWith("FlowLayout")) {
|
||||
|
||||
if (str.contains("RIGHT")) {
|
||||
return new FlowLayout(FlowLayout.RIGHT);
|
||||
} else if (str.contains("LEFT")) {
|
||||
return new FlowLayout(FlowLayout.LEFT);
|
||||
} else if (str.contains("CENTER")) {
|
||||
return new FlowLayout(FlowLayout.CENTER);
|
||||
} else if (str.contains("LEADING")) {
|
||||
return new FlowLayout(FlowLayout.LEADING);
|
||||
} else if (str.contains("TRAILING")) {
|
||||
return new FlowLayout(FlowLayout.TRAILING);
|
||||
} else {
|
||||
return new FlowLayout();
|
||||
}
|
||||
|
||||
} else if (str.startsWith("GridLayout")) {
|
||||
|
||||
int indexStart = str.indexOf('(');
|
||||
int indexMid = str.indexOf(',');
|
||||
int indexEnd = str.indexOf(')');
|
||||
if (indexStart>0 && indexMid>0 && indexEnd>0) {
|
||||
|
||||
Integer rows = new Integer(str.substring(indexStart+1,indexMid));
|
||||
Integer cols = new Integer(str.substring(indexMid+1,indexEnd));
|
||||
|
||||
return new GridLayout(rows,cols);
|
||||
|
||||
} else {
|
||||
throw new ObjectConverterException(this,"Could not parse arguments: "+str);
|
||||
}
|
||||
|
||||
} else if (str.startsWith("GridBagLayout")) {
|
||||
|
||||
return new GridBagLayout();
|
||||
|
||||
} else {
|
||||
throw new ObjectConverterException(this,"Unknow layout requested: "+str);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ObjectConverterException(this,e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
LayoutConverter result = new LayoutConverter();
|
||||
result.converters=cloneConverters();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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"
|
||||
providerHost="test.x4o.org"
|
||||
providerName="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 id="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:configuratorGlobal bean.class="org.x4o.xml.test.element.TestElementConfigurator" id="testConfigGlobal">
|
||||
<eld:description>Test the global element configurator.</eld:description>
|
||||
</eld:configuratorGlobal>
|
||||
|
||||
<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:namespaceAttribute attributeName="attr1" bean.class="org.x4o.xml.test.element.TestElementNamespaceAttribute" id="attrTest1">
|
||||
<eld:description>Test the global element attribute1 handler.</eld:description>
|
||||
</eld:namespaceAttribute>
|
||||
<eld:namespaceAttribute attributeName="attr2" bean.class="org.x4o.xml.test.element.TestElementNamespaceAttribute" id="attrTest2">
|
||||
<eld:description>Test the global element attribute2 handler.</eld:description>
|
||||
<eld:namespaceAttributeNext attributeName="attr1"/>
|
||||
</eld:namespaceAttribute>
|
||||
|
||||
<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-2014, 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>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#
|
||||
# Copyright (c) 2004-2014, 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.
|
||||
#
|
||||
|
||||
#
|
||||
# unit test logging setup.
|
||||
#
|
||||
# Specify the handlers to create in the root logger
|
||||
# (all loggers are children of the root logger)
|
||||
# The following creates two handlers
|
||||
handlers = java.util.logging.ConsoleHandler
|
||||
|
||||
# Set the default logging level for new ConsoleHandler instances
|
||||
java.util.logging.ConsoleHandler.level = ALL
|
||||
|
||||
# Set the default logging level for the root logger
|
||||
.level = INFO
|
||||
|
||||
org.x4o.parser = ALL
|
||||
|
||||
# Java 6 has internal logging on many builtin libs
|
||||
sun.level=OFF
|
||||
java.level=OFF
|
||||
javax.level=OFF
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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"
|
||||
providerHost="mtest.x4o.org"
|
||||
providerName="Meta Test Language"
|
||||
id="mtest-lang"
|
||||
>
|
||||
<eld:namespace
|
||||
uri="http://mtest.x4o.org/xml/ns/mtest-root"
|
||||
schemaUri="http://mtest.x4o.org/xml/ns/mtest-root-1.0.xsd"
|
||||
schemaResource="mtest-root-1.0.xsd"
|
||||
schemaPrefix="mroot"
|
||||
name="MTest Root Namespace"
|
||||
languageRoot="true"
|
||||
id="mroot"
|
||||
>
|
||||
<!-- Root Element for nice namespace'ing -->
|
||||
<eld:element tag="root" objectClass="java.lang.Object">
|
||||
<eld:description>The test root element.</eld:description>
|
||||
</eld:element>
|
||||
</eld:namespace>
|
||||
|
||||
<eld:namespace
|
||||
uri="http://mtest.x4o.org/xml/ns/mtest-lang"
|
||||
schemaUri="http://mtest.x4o.org/xml/ns/mtest-lang-1.0.xsd"
|
||||
schemaResource="mtest-lang-1.0.xsd"
|
||||
schemaPrefix="mlang"
|
||||
name="MTest Language Namespace"
|
||||
id="mlang"
|
||||
>
|
||||
<eld:element tag="date" objectClass="java.util.Date"/>
|
||||
<eld:element tag="JFrame" objectClass="javax.swing.JFrame"/>
|
||||
<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,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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>mtest-lang.eld</eld-resource>
|
||||
<sibling-loader>org.x4o.xml.lang.meta.MetaLanguageSiblingLoader</sibling-loader>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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="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"
|
||||
providerHost="swixml.junit.x4o.org"
|
||||
providerName="Junit Swixml-2 Language"
|
||||
id="junit-swixml-module"
|
||||
>
|
||||
|
||||
<bindingHandler id="JFrameBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JFrameBindingHandler"/>
|
||||
<bindingHandler id="JInternalFrameBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JInternalFrameBindingHandler"/>
|
||||
<bindingHandler id="JPanelBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JPanelBindingHandler"/>
|
||||
<bindingHandler id="JSplitPaneBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JSplitPaneBindingHandler"/>
|
||||
<classBindingHandler id="JScrollPane-JComponent" parentClass="javax.swing.JScrollPane" childClass="javax.swing.JComponent" addMethod="setViewportView" getMethod="getViewport"/>
|
||||
<classBindingHandler id="JDesktopPane-JInternalFrame" parentClass="javax.swing.JDesktopPane" childClass="javax.swing.JInternalFrame" addMethod="add" getMethod="getComponents"/>
|
||||
<classBindingHandler id="JFrame-JDesktopPane" parentClass="javax.swing.JFrame" childClass="javax.swing.JDesktopPane" addMethod="setContentPane" getMethod="getContentPane"/>
|
||||
<classBindingHandler id="JMenuBar-JMenu" parentClass="javax.swing.JMenuBar" childClass="javax.swing.JMenu" addMethod="add" getMethod="getComponents"/>
|
||||
<classBindingHandler id="JMenu-JMenuItem" parentClass="javax.swing.JMenu" childClass="javax.swing.JMenuItem" addMethod="add" getMethod="getComponents"/>
|
||||
<classBindingHandler id="JRootPane-JComponent" parentClass="javax.swing.JRootPane" childClass="javax.swing.JComponent" addMethod="add" getMethod="getComponents"/>
|
||||
|
||||
<elementInterface id="Component" interfaceClass="java.awt.Component">
|
||||
<attribute id="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>
|
||||
</attribute>
|
||||
<attribute id="size">
|
||||
<conv:stringSplitConverter classTo="java.awt.Dimension" split="," splitSize="2" singleToMethod="setSize" useNativeType="true">
|
||||
<conv:stringSplitConverterStep fromMethod="getHeight" fromOrder="1" toOrder="1"><conv:integerConverter/></conv:stringSplitConverterStep>
|
||||
<conv:stringSplitConverterStep fromMethod="getWidth" fromOrder="2" toOrder="2"><conv:integerConverter/></conv:stringSplitConverterStep>
|
||||
</conv:stringSplitConverter>
|
||||
</attribute>
|
||||
<attribute id="icon">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.IconConverter"/>
|
||||
</attribute>
|
||||
<attribute id="background">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.ColorConverter"/>
|
||||
</attribute>
|
||||
<attribute id="location">
|
||||
<conv:stringSplitConverter classTo="java.awt.Point" split="," splitSize="2" singleToMethod="setLocation" useNativeType="true">
|
||||
<conv:stringSplitConverterStep fromMethod="getX" fromOrder="1" toOrder="1"><conv:integerConverter/></conv:stringSplitConverterStep>
|
||||
<conv:stringSplitConverterStep fromMethod="getY" fromOrder="2" toOrder="2"><conv:integerConverter/></conv:stringSplitConverterStep>
|
||||
</conv:stringSplitConverter>
|
||||
</attribute>
|
||||
<attribute id="locationOnScreen" runBeanValue="false"/>
|
||||
</elementInterface>
|
||||
|
||||
<elementInterface id="JComponent" interfaceClass="javax.swing.JComponent">
|
||||
<attribute id="layout">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.LayoutConverter"/>
|
||||
</attribute>
|
||||
<attribute id="border">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.BorderConverter"/>
|
||||
</attribute>
|
||||
<attribute id="toolTipText"><attributeAlias name="ToolTipText"/></attribute>
|
||||
<attribute id="focusPainted"><attributeAlias name="FocusPainted"/></attribute>
|
||||
<attribute id="borderPainted"><attributeAlias name="BorderPainted"/></attribute>
|
||||
</elementInterface>
|
||||
|
||||
|
||||
<namespace
|
||||
uri="http://swixml.junit.x4o.org/xml/ns/junit-swixml-root"
|
||||
schemaUri="http://swixml.junit.x4o.org/xml/ns/junit-swixml-root-2.0.xsd"
|
||||
schemaResource="junit-swixml-root-2.0.xsd"
|
||||
schemaPrefix="root"
|
||||
description="Root namespace to have nice namespaceing."
|
||||
name="Junit Swixml Root Namespace"
|
||||
languageRoot="true"
|
||||
id="junit-swixml-root"
|
||||
>
|
||||
<element tag="frame" objectClass="javax.swing.JFrame">
|
||||
<description>Single element in language root to create nice tree, for imports in xsd namespace aware generated files.</description>
|
||||
</element>
|
||||
</namespace>
|
||||
<namespace
|
||||
uri="http://swixml.junit.x4o.org/xml/ns/junit-swixml-lang"
|
||||
schemaUri="http://swixml.junit.x4o.org/xml/ns/junit-swixml-lang-2.0.xsd"
|
||||
schemaResource="junit-swixml-lang-2.0.xsd"
|
||||
schemaPrefix="lang"
|
||||
description="Language namespace for all swing components."
|
||||
name="Junit Swixml Language Namespace"
|
||||
id="junit-swixml-lang"
|
||||
>
|
||||
<!-- Note frame should not be here(it can but xsd needs root), but else classic xml does not parse without xmlns additions. -->
|
||||
<element tag="frame" objectClass="javax.swing.JFrame"/>
|
||||
<element tag="menubar" objectClass="javax.swing.JMenuBar"/>
|
||||
<element tag="menu" objectClass="javax.swing.JMenu"/>
|
||||
<element tag="menuitem" objectClass="javax.swing.JMenuItem">
|
||||
<attribute id="accelerator">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.KeyStrokeConverter"/>
|
||||
<attributeAlias name="Accelerator"/>
|
||||
</attribute>
|
||||
<attribute id="mnemonic" runBeanValue="false"/>
|
||||
<attribute id="Action" runBeanValue="false"/>
|
||||
<configurator id="menuitem-action" bean.class="org.x4o.xml.test.swixml.SwiXmlActionConfigurator"/>
|
||||
</element>
|
||||
<element tag="separator" />
|
||||
<element tag="panel" objectClass="javax.swing.JPanel"/>
|
||||
<element tag="splitpane" objectClass="javax.swing.JSplitPane">
|
||||
<attribute id="orientation">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.JSplitPaneOrientationConverter"/>
|
||||
</attribute>
|
||||
<attribute id="dividerLocation">
|
||||
<conv:integerConverter/>
|
||||
</attribute>
|
||||
</element>
|
||||
<element tag="layeredPane" objectClass="javax.swing.JLayeredPane"/>
|
||||
<element tag="rootPane" objectClass="javax.swing.JRootPane"/>
|
||||
<element tag="scrollPane" objectClass="javax.swing.JScrollPane"/>
|
||||
<element tag="tree" objectClass="javax.swing.JTree"/>
|
||||
<element tag="button" objectClass="javax.swing.JButton">
|
||||
<attributeFromBody id="button-text" name="text"/>
|
||||
</element>
|
||||
<element tag="table" objectClass="javax.swing.JTable"/>
|
||||
<element tag="textarea" objectClass="javax.swing.JTextArea"/>
|
||||
<element tag="label" objectClass="javax.swing.JLabel"/>
|
||||
<element tag="textfield" objectClass="javax.swing.JTextField"/>
|
||||
<element tag="desktoppane" objectClass="javax.swing.JDesktopPane"/>
|
||||
<element tag="internalframe" objectClass="javax.swing.JInternalFrame">
|
||||
<attribute id="title"><attributeAlias name="Title"/></attribute>
|
||||
<attribute id="bounds"><attributeAlias name="Bounds"/></attribute>
|
||||
<attribute id="layout"><attributeAlias name="Layout"/></attribute>
|
||||
<attribute id="visible"><attributeAlias name="Visible"/></attribute>
|
||||
<attribute id="resizable"><attributeAlias name="Resizable"/></attribute>
|
||||
</element>
|
||||
</namespace>
|
||||
</root:module>
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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="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"
|
||||
providerHost="swixml.junit.x4o.org"
|
||||
providerName="Junit Swixml-3 Language"
|
||||
id="junit-swixml-module"
|
||||
>
|
||||
|
||||
<bindingHandler id="JFrameBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JFrameBindingHandler"/>
|
||||
<bindingHandler id="JInternalFrameBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JInternalFrameBindingHandler"/>
|
||||
<bindingHandler id="JPanelBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JPanelBindingHandler"/>
|
||||
<bindingHandler id="JSplitPaneBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JSplitPaneBindingHandler"/>
|
||||
<classBindingHandler id="JScrollPane-JComponent" parentClass="javax.swing.JScrollPane" childClass="javax.swing.JComponent" addMethod="setViewportView" getMethod="getViewport"/>
|
||||
<classBindingHandler id="JDesktopPane-JInternalFrame" parentClass="javax.swing.JDesktopPane" childClass="javax.swing.JInternalFrame" addMethod="add" getMethod="getComponents" />
|
||||
<classBindingHandler id="JFrame-JDesktopPane" parentClass="javax.swing.JFrame" childClass="javax.swing.JDesktopPane" addMethod="setContentPane" getMethod="getContentPane"/>
|
||||
<classBindingHandler id="JMenuBar-JMenu" parentClass="javax.swing.JMenuBar" childClass="javax.swing.JMenu" addMethod="add" getMethod="getComponents"/>
|
||||
<classBindingHandler id="JMenu-JMenuItem" parentClass="javax.swing.JMenu" childClass="javax.swing.JMenuItem" addMethod="add" getMethod="getComponents"/>
|
||||
<classBindingHandler id="JRootPane-JComponent" parentClass="javax.swing.JRootPane" childClass="javax.swing.JComponent" addMethod="add" getMethod="getComponents"/>
|
||||
|
||||
<elementInterface id="Component" interfaceClass="java.awt.Component">
|
||||
<attribute id="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>
|
||||
</attribute>
|
||||
<attribute id="size">
|
||||
<conv:stringSplitConverter classTo="java.awt.Dimension" split="," splitSize="2" singleToMethod="setSize" useNativeType="true">
|
||||
<conv:stringSplitConverterStep fromMethod="getHeight" fromOrder="1" toOrder="1"><conv:integerConverter/></conv:stringSplitConverterStep>
|
||||
<conv:stringSplitConverterStep fromMethod="getWidth" fromOrder="2" toOrder="2"><conv:integerConverter/></conv:stringSplitConverterStep>
|
||||
</conv:stringSplitConverter>
|
||||
</attribute>
|
||||
<attribute id="icon">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.IconConverter"/>
|
||||
</attribute>
|
||||
<attribute id="background">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.ColorConverter"/>
|
||||
</attribute>
|
||||
<attribute id="location">
|
||||
<conv:stringSplitConverter classTo="java.awt.Point" split="," splitSize="2" singleToMethod="setLocation" useNativeType="true">
|
||||
<conv:stringSplitConverterStep fromMethod="getX" fromOrder="1" toOrder="1"><conv:integerConverter/></conv:stringSplitConverterStep>
|
||||
<conv:stringSplitConverterStep fromMethod="getY" fromOrder="2" toOrder="2"><conv:integerConverter/></conv:stringSplitConverterStep>
|
||||
</conv:stringSplitConverter>
|
||||
</attribute>
|
||||
<attribute id="locationOnScreen" runBeanValue="false"/>
|
||||
</elementInterface>
|
||||
|
||||
<elementInterface id="JComponent" interfaceClass="javax.swing.JComponent">
|
||||
<attribute id="layout">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.LayoutConverter"/>
|
||||
</attribute>
|
||||
<attribute id="border">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.BorderConverter"/>
|
||||
</attribute>
|
||||
</elementInterface>
|
||||
|
||||
<namespace
|
||||
uri="http://swixml.junit.x4o.org/xml/ns/junit-swixml-root"
|
||||
schemaUri="http://swixml.junit.x4o.org/xml/ns/junit-swixml-root-3.0.xsd"
|
||||
schemaResource="junit-swixml-root-3.0.xsd"
|
||||
schemaPrefix="root"
|
||||
description="Root namespace to have nice namespaceing."
|
||||
name="Junit Swixml Root Namespace"
|
||||
languageRoot="true"
|
||||
id="junit-swixml-root"
|
||||
>
|
||||
<element objectClass="javax.swing.JFrame"/>
|
||||
</namespace>
|
||||
<namespace
|
||||
uri="http://swixml.junit.x4o.org/xml/ns/junit-swixml-lang"
|
||||
schemaUri="http://swixml.junit.x4o.org/xml/ns/junit-swixml-lang-3.0.xsd"
|
||||
schemaResource="junit-swixml-lang-3.0.xsd"
|
||||
schemaPrefix="lang"
|
||||
description="Language namespace for all swing components."
|
||||
name="Junit Swixml Language Namespace"
|
||||
id="junit-swixml-lang"
|
||||
>
|
||||
<namespaceAttribute attributeName="fxid" bean.class="org.x4o.xml.test.element.TestElementNamespaceAttribute" id="fxid-test"></namespaceAttribute>
|
||||
<element objectClass="javax.swing.JMenuBar"/>
|
||||
<element objectClass="javax.swing.JMenu"/>
|
||||
<element objectClass="javax.swing.JMenuItem">
|
||||
<attribute id="accelerator">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.KeyStrokeConverter"/>
|
||||
<attributeAlias name="Accelerator"/>
|
||||
</attribute>
|
||||
<attribute id="mnemonic" runBeanValue="false"/>
|
||||
<attribute id="Action" runBeanValue="false"/>
|
||||
<configurator id="menuitem-action" bean.class="org.x4o.xml.test.swixml.SwiXmlActionConfigurator"/>
|
||||
</element>
|
||||
<element id="JMenu.Separator" description="TODO"/>
|
||||
<element objectClass="javax.swing.JPanel"/>
|
||||
<element objectClass="javax.swing.JSplitPane">
|
||||
<attribute id="orientation">
|
||||
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.JSplitPaneOrientationConverter"/>
|
||||
</attribute>
|
||||
<attribute id="dividerLocation">
|
||||
<conv:integerConverter/>
|
||||
</attribute>
|
||||
</element>
|
||||
|
||||
<element objectClass="javax.swing.JLayeredPane"/>
|
||||
<element objectClass="javax.swing.JRootPane"/>
|
||||
<element objectClass="javax.swing.JScrollPane"/>
|
||||
<element objectClass="javax.swing.JTree"/>
|
||||
<element objectClass="javax.swing.JButton"/>
|
||||
<element objectClass="javax.swing.JTable"/>
|
||||
<element objectClass="javax.swing.JTextArea"/>
|
||||
<element objectClass="javax.swing.JLabel"/>
|
||||
<element objectClass="javax.swing.JTextField"/>
|
||||
<element objectClass="javax.swing.JDesktopPane"/>
|
||||
<element objectClass="javax.swing.JInternalFrame"/>
|
||||
</namespace>
|
||||
</root:module>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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="2.0">
|
||||
<eld-resource>swixml-lang-2.0.eld</eld-resource>
|
||||
</language>
|
||||
<language version="3.0">
|
||||
<eld-resource>swixml-lang-3.0.eld</eld-resource>
|
||||
</language>
|
||||
</modules>
|
||||
171
nx01-x4o-driver/src/test/resources/META-INF/test/test-lang.eld
Normal file
171
nx01-x4o-driver/src/test/resources/META-INF/test/test-lang.eld
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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="Junit Test Language"
|
||||
providerHost="test.junit.x4o.org"
|
||||
id="junit-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 id="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:namespace
|
||||
uri="http://test.junit.x4o.org/xml/ns/junit-test-root"
|
||||
schemaUri="http://test.junit.x4o.org/xml/ns/junit-test-root-1.0.xsd"
|
||||
schemaResource="junit-test-root-1.0.xsd"
|
||||
schemaPrefix="root"
|
||||
description="Root namespace to have nice namespaceing."
|
||||
name="Junit Test Root Namespace"
|
||||
languageRoot="true"
|
||||
id="junit-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.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
schemaUri="http://test.junit.x4o.org/xml/ns/junit-test-lang-1.0.xsd"
|
||||
schemaResource="junit-test-lang-1.0.xsd"
|
||||
schemaPrefix="lang"
|
||||
description="Test language namespace to test some/most features"
|
||||
name="Junit Test Language Namespace"
|
||||
id="junit-test-lang"
|
||||
>
|
||||
<!-- TODO: fix x4o writer, run EldParserTest
|
||||
<eld:namespaceAttribute attributeName="attr1" bean.class="org.x4o.xml.test.element.TestElementNamespaceAttribute" id="attrTest1">
|
||||
<eld:description>Test the global element attribute1 handler.</eld:description>
|
||||
</eld:namespaceAttribute>
|
||||
<eld:namespaceAttribute attributeName="attr2" bean.class="org.x4o.xml.test.element.TestElementNamespaceAttribute" id="attrTest2">
|
||||
<eld:description>Test the global element attribute2 handler.</eld:description>
|
||||
<eld:attributeHandlerNextAttribute attributeName="attr1"/>
|
||||
</eld:namespaceAttribute>
|
||||
-->
|
||||
<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">
|
||||
<!-- TODO: fix writer
|
||||
<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:attributeFromBody name="name" id="child-name"/>
|
||||
</eld:element>
|
||||
<!--
|
||||
<eld:element tag="childName">
|
||||
<eld:attributeFromBody name="name" id="child-name" useParent="true"/>
|
||||
<eld:elementParent tag="child"/>
|
||||
</eld:element>
|
||||
<eld:element tag="childSize">
|
||||
<eld:attributeFromBody name="size" id="child-size" useParent="true"/>
|
||||
<eld:elementParent tag="child"/>
|
||||
</eld:element>
|
||||
-->
|
||||
|
||||
<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 objectClass="org.x4o.xml.test.models.TestAttributeOrderChildNatural"/>
|
||||
|
||||
<eld:element id="custom-ordered-child" objectClass="org.x4o.xml.test.models.TestAttributeOrderChild">
|
||||
<eld:attribute id="aaaName" writeOrder="5000"/>
|
||||
<eld:attribute id="aabName" writeOrder="5010"/>
|
||||
<eld:attribute id="aacName" writeOrder="5020"/>
|
||||
<eld:attribute id="abaName" writeOrder="3002"/>
|
||||
<eld:attribute id="abbName" writeOrder="3001"/>
|
||||
<eld:attribute id="abcName" writeOrder="3000"/>
|
||||
<eld:attribute id="caaName" writeOrder="1003"/>
|
||||
<eld:attribute id="cabName" writeOrder="1002"/>
|
||||
<eld:attribute id="cacName" writeOrder="1000"/>
|
||||
</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-2014, 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.*">
|
||||
<eld-resource>test-lang.eld</eld-resource>
|
||||
</language>
|
||||
</modules>
|
||||
62
nx01-x4o-driver/src/test/resources/META-INF/x4o-drivers.xml
Normal file
62
nx01-x4o-driver/src/test/resources/META-INF/x4o-drivers.xml
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<drivers version="1.0"
|
||||
xmlns="http://language.x4o.org/xml/ns/drivers"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://language.x4o.org/xml/ns/drivers http://language.x4o.org/xml/ns/drivers-1.0.xsd"
|
||||
>
|
||||
<driver language="test" className="org.x4o.xml.test.TestDriver"/>
|
||||
<!--
|
||||
<languageResourcePathPrefix>META-INF</languageResourcePathPrefix>
|
||||
<languageResourceModulesFileName>-modules.xml</languageResourceModulesFileName>
|
||||
<defaultElementNamespace>org.x4o.xml.element.DefaultElementNamespace</defaultElementNamespace>
|
||||
<defaultElementInterface>org.x4o.xml.element.DefaultElementInterface</defaultElementInterface>
|
||||
<defaultElement>org.x4o.xml.element.DefaultElement</defaultElement>
|
||||
<defaultElementClass>org.x4o.xml.element.DefaultElementClass</defaultElementClass>
|
||||
<defaultElementClassAttribute></defaultElementClassAttribute>
|
||||
<defaultElementLanguageModule></defaultElementLanguageModule>
|
||||
<defaultElementBodyComment></defaultElementBodyComment>
|
||||
<defaultElementBodyCharacters></defaultElementBodyCharacters>
|
||||
<defaultElementBodyWhitespace></defaultElementBodyWhitespace>
|
||||
<defaultElementNamespaceInstanceProvider></defaultElementNamespaceInstanceProvider>
|
||||
<defaultElementAttributeValueParser></defaultElementAttributeValueParser>
|
||||
<defaultElementObjectPropertyValue></defaultElementObjectPropertyValue>
|
||||
<defaultElementNamespaceAttributeComparator></defaultElementNamespaceAttributeComparator>
|
||||
|
||||
<properties>
|
||||
<property key="" value=""/>
|
||||
</properties>
|
||||
|
||||
<lockLanguage>true</lockLanguage>
|
||||
<secure-resources>
|
||||
<secure-resource resource="META-INF/test/test-modules.xml" hash="887486557" hashType="MD5"/>
|
||||
<secure-resource resource="META-INF/test/test-lang.eld" hash="238758509486557" hashType="MD5"/>
|
||||
</secure-resources>
|
||||
</driver>
|
||||
-->
|
||||
<driver language="swixml" className="org.x4o.xml.test.swixml.SwiXmlDriver"/>
|
||||
<defaultDriver language="junit-defp"/>
|
||||
</drivers>
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<x4o:root xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang">
|
||||
<x4o:bean el.id="date0" bean.class="java.util.Date"/>
|
||||
|
||||
<x4o:template el.id="superBean">
|
||||
<x4o:bean bean.class="org.x4o.xml.core.TestBean"
|
||||
privateIntegerTypeField="333"
|
||||
privateIntegerObjectField="333"
|
||||
privateLongTypeField="333"
|
||||
privateLongObjectField="333"
|
||||
privateDoubleTypeField="333.333"
|
||||
privateDoubleObjectField = "333.333"
|
||||
privateFloatTypeField="333.333"
|
||||
privateFloatObjectField="333.333"
|
||||
privateByteTypeField="333"
|
||||
privateByteObjectField="333"
|
||||
privateBooleanTypeField="true"
|
||||
privateBooleanObjectField="true"
|
||||
privateCharTypeField="W"
|
||||
privateCharObjectField="C"
|
||||
privateStringObjectField="x4o"
|
||||
privateDateObjectField="${date0}"
|
||||
/>
|
||||
</x4o:template>
|
||||
<x4o:bean el.id="bean1" el.template="superBean" privateLongTypeField="444"/>
|
||||
<x4o:bean el.id="bean2" el.template="superBean" privateBooleanTypeField="false"/>
|
||||
<x4o:bean el.id="bean3" el.template="superBean" privateStringObjectField="testTemplate"/>
|
||||
|
||||
<x4o:forLoop var="item" value="">
|
||||
<x4o:bean el.id="bean1" el.template="superBean" privateStringObjectField="${item}"/>
|
||||
</x4o:forLoop>
|
||||
|
||||
<x4o:for start="0" stop="200" var="i">
|
||||
<entry key="prop${i}" parent.template="${defaultProp}">value${i+250}</entry>
|
||||
</x4o:for>
|
||||
|
||||
</x4o:root>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<x4o:root xmlns:test="http://test.x4o.org/xml/ns/test"
|
||||
xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://meta.x4o.org/xml/ns/meta-lang http://meta.x4o.org/xml/xsd/meta-lang/1
|
||||
http://test.x4o.org/xml/ns/test http://test.x4o.org/xml/ns/test-1.0.xsd"
|
||||
>
|
||||
|
||||
<x4o:template el.id="master1">
|
||||
<test:testObjectChild el.id="CHILD1" name="CHILD1" price="123" size="123.45"/>
|
||||
</x4o:template>
|
||||
<test:testObjectChild el.id="child1" size="123.99" x4o.template="master1"/>
|
||||
|
||||
<x4o:template el.id="master2">
|
||||
<test:testObjectChild el.id="CHILD2" name="CHILD2" price="2323" size="23.24"/>
|
||||
</x4o:template>
|
||||
<x4o:elReference el.id="child2" el.ref="child2" x4o.template="master2"/>
|
||||
|
||||
<test:testObjectParent el.id="parent2">
|
||||
<x4o:templateTag template="${master2}"/>
|
||||
</test:testObjectParent>
|
||||
|
||||
</x4o:root>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<tree:root
|
||||
xmlns:tree="http://mtest.x4o.org/xml/ns/mtest-root"
|
||||
xmlns:mt="http://mtest.x4o.org/xml/ns/mtest-lang"
|
||||
xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
|
||||
>
|
||||
<x4o:bean el.id="date0" bean.class="java.util.Date"/>
|
||||
<mt:JLabel>
|
||||
<x4o:property name="text" value="label text"/>
|
||||
<x4o:method method="validate"/>
|
||||
<x4o:parentObject>
|
||||
<x4o:property name="text" value="label text2"/>
|
||||
</x4o:parentObject>
|
||||
</mt:JLabel>
|
||||
</tree:root>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<tree:root
|
||||
xmlns:tree="http://mtest.x4o.org/xml/ns/mtest-root"
|
||||
xmlns:mt="http://mtest.x4o.org/xml/ns/mtest-lang"
|
||||
xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
|
||||
>
|
||||
<mt:JLabel>
|
||||
<x4o:parentObject>
|
||||
<x4o:property name="text" value="parentTest"/>
|
||||
</x4o:parentObject>
|
||||
</mt:JLabel>
|
||||
</tree:root>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<tree:root
|
||||
xmlns:tree="http://mtest.x4o.org/xml/ns/mtest-root"
|
||||
xmlns:mt="http://mtest.x4o.org/xml/ns/mtest-lang"
|
||||
xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
|
||||
>
|
||||
<x4o:bean el.id="date0" bean.class="java.util.Date"/>
|
||||
<x4o:elReference el.id="date1" el.ref="date0"/>
|
||||
<x4o:elReference el.id="date2" el.ref="date0"/>
|
||||
<x4o:elReference el.id="date3" el.ref="date0"/>
|
||||
</tree:root>
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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:root
|
||||
xmlns:root="http://test.junit.x4o.org/xml/ns/junit-test-root"
|
||||
xmlns="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
>
|
||||
<parent name="test-bean.xml"/>
|
||||
<testBean
|
||||
privateIntegerTypeField="123"
|
||||
privateIntegerObjectField="123"
|
||||
privateLongTypeField="123"
|
||||
privateLongObjectField="123"
|
||||
privateDoubleTypeField="123.45"
|
||||
privateDoubleObjectField = "123.45"
|
||||
privateFloatTypeField="123.45"
|
||||
privateFloatObjectField="123.45"
|
||||
privateByteTypeField="67"
|
||||
privateByteObjectField="67"
|
||||
privateBooleanTypeField="true"
|
||||
privateBooleanObjectField="true"
|
||||
privateCharTypeField="W"
|
||||
privateCharObjectField="C"
|
||||
privateStringObjectField="x4o-𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕"
|
||||
privateStringObjectFieldUnicode仙上主天="x4o-仙上主天"
|
||||
privateDateObjectField="${date0}"
|
||||
/>
|
||||
<testBean
|
||||
publicIntegerTypeField="123"
|
||||
publicIntegerObjectField="123"
|
||||
publicLongTypeField="123"
|
||||
publicLongObjectField="123"
|
||||
publicDoubleTypeField="123.45"
|
||||
publicDoubleObjectField = "123.45"
|
||||
publicFloatTypeField="123.45"
|
||||
publicFloatObjectField="123.45"
|
||||
publicByteTypeField="67"
|
||||
publicByteObjectField="67"
|
||||
publicBooleanTypeField="true"
|
||||
publicBooleanObjectField="true"
|
||||
publicCharTypeField="W"
|
||||
publicCharObjectField="C"
|
||||
publicStringObjectField="x4o-𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕"
|
||||
publicStringObjectFieldUnicode仙上主天="x4o-仙上主天"
|
||||
publicDateObjectField="${date0}"
|
||||
/>
|
||||
<!-- TODO: Add when SAX is fixed
|
||||
privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ="x4o-ᒡᒢᑊᒻᒻᓫᔿ"
|
||||
publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ="x4o-ᒡᒢᑊᒻᒻᓫᔿ"
|
||||
-->
|
||||
</root:root>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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:root
|
||||
xmlns:root="http://test.junit.x4o.org/xml/ns/junit-test-root"
|
||||
xmlns="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
>
|
||||
<child name="attr-name-𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕"/>
|
||||
<child>body-name-𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕</child>
|
||||
</root:root>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<test>
|
||||
</test>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root:root xmlns:root="http://test.junit.x4o.org/xml/ns/junit-test-root">
|
||||
</root:root>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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">
|
||||
<module-loader>org.foo.bar.test.loader.EqualLoader</module-loader>
|
||||
<module-loader>org.foo.bar.test.loader.EqualLoader</module-loader>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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">
|
||||
<sibling-loader>org.foo.bar.test.loader.EqualSiblingLoader</sibling-loader>
|
||||
<sibling-loader>org.foo.bar.test.loader.EqualSiblingLoader</sibling-loader>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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>my-lib0.eld</eld-resource>
|
||||
<eld-resource>my-lib1.eld</eld-resource>
|
||||
<eld-resource>my-lib2.eld</eld-resource>
|
||||
<eld-resource>my-lib3.eld</eld-resource>
|
||||
<eld-resource>my-lib4.eld</eld-resource>
|
||||
<eld-resource>my-lib5.eld</eld-resource>
|
||||
<eld-resource>my-lib6.eld</eld-resource>
|
||||
<eld-resource>my-lib7.eld</eld-resource>
|
||||
|
||||
<elb-resource>my-bean0.elb</elb-resource>
|
||||
<elb-resource>my-bean1.elb</elb-resource>
|
||||
<elb-resource>my-bean2.elb</elb-resource>
|
||||
|
||||
<module-loader>org.foo.bar.test.loader.FirstLoader</module-loader>
|
||||
<module-loader>org.foo.bar.test.loader.SecondLoader</module-loader>
|
||||
<module-loader>org.foo.bar.test.loader.LastLoader</module-loader>
|
||||
|
||||
<sibling-loader>org.foo.bar.test.loader.OtherLanguageSiblingLoader</sibling-loader>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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>my-language.eld</eld-resource>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<testNoNSRoot>
|
||||
<parent name="uri-empty.xml"/>
|
||||
</testNoNSRoot>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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
|
||||
xmlns="http://test.junit.x4o.org/xml/ns/junit-test-root"
|
||||
xmlns:test="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://test.x4o.org/xml/ns/test-root test-root-1.0.xsd"
|
||||
>
|
||||
<test:parent name="uri-schema.xml"/>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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
|
||||
xmlns="http://test.junit.x4o.org/xml/ns/junit-test-root"
|
||||
xmlns:test="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
>
|
||||
<test:parent name="uri-simple.xml"/>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<frame name="mainframe" size="800,600" title="SWIXML-X4O" plaf="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" defaultCloseOperation="3">
|
||||
<menubar name="menubar">
|
||||
<menu name="filemenu" text="File">
|
||||
<menuitem name="mi_new" text="New" icon="icons/new.gif" mnemonic="VK_N" accelerator="control N" Action="newAction"/>
|
||||
<menuitem name="mi_open" text="Open" icon="icons/open.gif" mnemonic="VK_O" Accelerator="control O" ActionCommand="open"/>
|
||||
<menuitem name="mi_save" text="Save" icon="icons/save.gif" mnemonic="VK_S" ActionCommand="save"/>
|
||||
<menu name="propmenu" text="Properties" icon="icons/new.gif" >
|
||||
<menuitem name="mi_prop_edit" text="Edit" icon="icons/new.gif"/>
|
||||
<menuitem name="mi_prop_clear" text="Clear" icon="icons/new.gif"/>
|
||||
</menu>
|
||||
<separator/>
|
||||
<menuitem name="mi_exit" text="Exit" icon="icons/exit.gif" mnemonic="VK_X" Accelerator="control X" ActionCommand="exit" Action="exitAction"/>
|
||||
</menu>
|
||||
<menu text="Help">
|
||||
<menuitem name="mi_about" text="About" enabled="true" icon="icons/info.gif" Accelerator="alt A" Action="aboutAction" />
|
||||
</menu>
|
||||
</menubar>
|
||||
<desktoppane>
|
||||
<internalframe Title="Flow Layout (right aligned)" Bounds="10,10,150,150" Layout="FlowLayout(FlowLayout.RIGHT)" Visible="true" Resizable="true">
|
||||
<button>1</button>
|
||||
<button>2</button>
|
||||
<button>3</button>
|
||||
<button>4</button>
|
||||
</internalframe>
|
||||
<internalframe Title="Grid Layout" Bounds="200,10,170,170" Layout="GridLayout(4,3)" Visible="true" Resizable="true">
|
||||
<button text="1"/><button text="2"/><button text="3"/>
|
||||
<button text="4"/><button text="5"/><button text="6"/>
|
||||
<button text="7"/><button text="8"/><button text="9"/>
|
||||
<button text="*"/><button text="0"/><button text="#"/>
|
||||
</internalframe>
|
||||
<internalframe Title="Border Layout" Bounds="390,10,150,150" Layout="borderlayout" Visible="true" Resizable="true">
|
||||
<button constraints="BorderLayout.NORTH" text="1"/>
|
||||
<button constraints="BorderLayout.EAST" text="2"/>
|
||||
<button constraints="BorderLayout.SOUTH" text="3"/>
|
||||
<button constraints="BorderLayout.WEST" text="4"/>
|
||||
</internalframe>
|
||||
<internalframe Title="Gridbag Layout" Bounds="400,170,220,210" Visible="true" Resizable="true">
|
||||
<!-- Layout="GridBagLayout"
|
||||
<button text="Wonderful">
|
||||
<gridbagconstraints id="gbc_1" insets="2,2,2,2" gridx="0" gridy="0" ipadx="15" ipady="15" weightx="1" weighty="1"/>
|
||||
</button>
|
||||
<button text="World">
|
||||
<gridbagconstraints refid="gbc_1" gridx="1"/>
|
||||
</button>
|
||||
<button text="of">
|
||||
<gridbagconstraints refid="gbc_1" gridy="1"/>
|
||||
</button>
|
||||
<button text="Swixml">
|
||||
<gridbagconstraints refid="gbc_1" gridx="1" gridy="1"/>
|
||||
</button>
|
||||
-->
|
||||
</internalframe>
|
||||
<internalframe Title="Tree Window" Bounds="10,170,350,360" Layout="borderlayout" Visible="true" Resizable="true">
|
||||
<panel layout="borderlayout" constraints="BorderLayout.CENTER">
|
||||
<splitpane oneTouchExpandable="true" dividerLocation="200">
|
||||
<splitpane oneTouchExpandable="true" dividerLocation="140" orientation="VERTICAL">
|
||||
<scrollPane background="blue" >
|
||||
<tree name="tree"/>
|
||||
</scrollPane>
|
||||
<panel layout="borderlayout">
|
||||
<panel constraints="BorderLayout.NORTH">
|
||||
<button name="btn_copy" ToolTipText="JPanel" enabled="true" BorderPainted="false" FocusPainted="false" icon="icons/copy.gif" size="24,24"/>
|
||||
<button name="btn_paste" ToolTipText="JButton" enabled="true" BorderPainted="false" FocusPainted="false" icon="icons/paste.gif" size="24,24"/>
|
||||
<button name="btn_cut" ToolTipText="JLabel" enabled="true" icon="icons/cut.gif" BorderPainted="false" FocusPainted="false" size="24,24"/>
|
||||
</panel>
|
||||
<scrollPane constraints="BorderLayout.CENTER">
|
||||
<table name="table"/>
|
||||
</scrollPane>
|
||||
</panel>
|
||||
</splitpane>
|
||||
<panel name="preview" border="LoweredBevelBorder">
|
||||
<textarea name="ta" text="Tree Status Log....." background="red"/>
|
||||
</panel>
|
||||
</splitpane>
|
||||
</panel>
|
||||
<panel constraints="BorderLayout.SOUTH">
|
||||
<label text="Status:"/>
|
||||
<textfield text="OK"/>
|
||||
</panel>
|
||||
</internalframe>
|
||||
</desktoppane>
|
||||
</frame>
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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:JFrame
|
||||
xmlns:root="http://swixml.junit.x4o.org/xml/ns/junit-swixml-root"
|
||||
xmlns="http://swixml.junit.x4o.org/xml/ns/junit-swixml-lang"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://swixml.junit.x4o.org/xml/ns/junit-swixml-root http://swixml.junit.x4o.org/xml/ns/junit-swixml-root-3.0.xsd"
|
||||
name="mainframe" size="800,600" title="SWIXML-X4O" plaf="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" defaultCloseOperation="3"
|
||||
>
|
||||
<JMenuBar name="menubar">
|
||||
<JMenu name="filemenu" text="File">
|
||||
<JMenuItem name="mi_new" text="New" icon="icons/new.gif" mnemonic="VK_N" accelerator="control N" Action="newAction"/>
|
||||
<JMenuItem name="mi_open" text="Open" icon="icons/open.gif" mnemonic="VK_O" Accelerator="control O" ActionCommand="open"/>
|
||||
<JMenuItem name="mi_save" text="Save" icon="icons/save.gif" mnemonic="VK_S" ActionCommand="save"/>
|
||||
<JMenu name="propmenu" text="Properties" icon="icons/new.gif" >
|
||||
<JMenuItem name="mi_prop_edit" text="Edit" icon="icons/new.gif"/>
|
||||
<JMenuItem name="mi_prop_clear" text="Clear" icon="icons/new.gif"/>
|
||||
</JMenu>
|
||||
<JMenu.Separator/>
|
||||
<JMenuItem name="mi_exit" text="Exit" icon="icons/exit.gif" mnemonic="VK_X" Accelerator="control X" ActionCommand="exit" Action="exitAction"/>
|
||||
</JMenu>
|
||||
<JMenu text="Help">
|
||||
<JMenuItem name="mi_about" text="About" enabled="true" icon="icons/info.gif" Accelerator="alt A" Action="aboutAction" />
|
||||
</JMenu>
|
||||
</JMenuBar>
|
||||
<JDesktopPane>
|
||||
<JInternalFrame title="Flow Layout (right aligned)" bounds="10,10,150,150" layout="FlowLayout(FlowLayout.RIGHT)" visible="true" resizable="true">
|
||||
<JButton text="1"/>
|
||||
<JButton text="2"/>
|
||||
<JButton text="3"/>
|
||||
<JButton text="4"/>
|
||||
</JInternalFrame>
|
||||
<JInternalFrame title="Grid Layout" bounds="200,10,170,170" layout="GridLayout(4,3)" visible="true" resizable="true">
|
||||
<JButton text="1"/><JButton text="2"/><JButton text="3"/>
|
||||
<JButton text="4"/><JButton text="5"/><JButton text="6"/>
|
||||
<JButton text="7"/><JButton text="8"/><JButton text="9"/>
|
||||
<JButton text="*"/><JButton text="0"/><JButton text="#"/>
|
||||
</JInternalFrame>
|
||||
<JInternalFrame title="Border Layout" bounds="390,10,150,150" layout="borderlayout" visible="true" resizable="true">
|
||||
<JButton constraints="BorderLayout.NORTH" text="1"/>
|
||||
<JButton constraints="BorderLayout.EAST" text="2"/>
|
||||
<JButton constraints="BorderLayout.SOUTH" text="3"/>
|
||||
<JButton constraints="BorderLayout.WEST" text="4"/>
|
||||
</JInternalFrame>
|
||||
<JInternalFrame title="Gridbag Layout" bounds="400,170,220,210" visible="true" resizable="true">
|
||||
<!-- Layout="GridBagLayout"
|
||||
<JButton text="Wonderful">
|
||||
<gridbagconstraints id="gbc_1" insets="2,2,2,2" gridx="0" gridy="0" ipadx="15" ipady="15" weightx="1" weighty="1"/>
|
||||
</JButton>
|
||||
<JButton text="World">
|
||||
<gridbagconstraints refid="gbc_1" gridx="1"/>
|
||||
</JButton>
|
||||
<JButton text="of">
|
||||
<gridbagconstraints refid="gbc_1" gridy="1"/>
|
||||
</JButton>
|
||||
<JButton text="Swixml">
|
||||
<gridbagconstraints refid="gbc_1" gridx="1" gridy="1"/>
|
||||
</JButton>
|
||||
-->
|
||||
</JInternalFrame>
|
||||
<JInternalFrame title="Tree Window" bounds="10,170,350,360" layout="borderlayout" visible="true" resizable="true">
|
||||
<JPanel layout="borderlayout" constraints="BorderLayout.CENTER">
|
||||
<JSplitPane oneTouchExpandable="true" dividerLocation="200">
|
||||
<JSplitPane oneTouchExpandable="true" dividerLocation="140" orientation="VERTICAL">
|
||||
<JScrollPane background="blue" >
|
||||
<JTree name="tree"/>
|
||||
</JScrollPane>
|
||||
<JPanel layout="borderlayout">
|
||||
<JPanel constraints="BorderLayout.NORTH">
|
||||
<JButton name="btn_copy" toolTipText="JPanel" enabled="true" borderPainted="false" focusPainted="false" icon="icons/copy.gif" size="24,24"/>
|
||||
<JButton name="btn_paste" toolTipText="JJButton" enabled="true" borderPainted="false" focusPainted="false" icon="icons/paste.gif" size="24,24"/>
|
||||
<JButton name="btn_cut" toolTipText="JLabel" enabled="true" icon="icons/cut.gif" borderPainted="false" focusPainted="false" size="24,24"/>
|
||||
</JPanel>
|
||||
<JScrollPane constraints="BorderLayout.CENTER">
|
||||
<JTable name="table"/>
|
||||
</JScrollPane>
|
||||
</JPanel>
|
||||
</JSplitPane>
|
||||
<JPanel name="preview" border="LoweredBevelBorder">
|
||||
<JTextArea name="ta" text="Tree Status Log....." background="red"/>
|
||||
</JPanel>
|
||||
</JSplitPane>
|
||||
</JPanel>
|
||||
<JPanel constraints="BorderLayout.SOUTH">
|
||||
<JLabel text="Status:"/>
|
||||
<JTextField text="OK"/>
|
||||
</JPanel>
|
||||
</JInternalFrame>
|
||||
</JDesktopPane>
|
||||
</root:JFrame>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<x4o:root xmlns:test="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
|
||||
>
|
||||
|
||||
<test:sax xmlVersion="1.0" encoding="UTF-8" doctype="properties SYSTEM &http://java.sun.com/dtd/properties.dtd&'">
|
||||
<properties>
|
||||
<comment>
|
||||
Test namespace for x4o junit test
|
||||
</comment>
|
||||
<entry key="propertyTest" template.id="defaultProp" >fooBar</entry>
|
||||
<x4o:for start="0" stop="200" var="i">
|
||||
<entry key="prop${i}" parent.template="${defaultProp}">value${i+250}</entry>
|
||||
</x4o:for>
|
||||
</properties>
|
||||
</test:sax>
|
||||
|
||||
</x4o:root>
|
||||
43
nx01-x4o-driver/src/test/resources/tests/test-swing.xml
Normal file
43
nx01-x4o-driver/src/test/resources/tests/test-swing.xml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<tree:root
|
||||
xmlns:tree="http://test.junit.x4o.org/xml/ns/junit-test-root"
|
||||
xmlns:test="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
>
|
||||
<test:parent name="uri-simple.xml"/>
|
||||
|
||||
<test:testObjectChild name="Im bean1" price="555" size="234.34"/>
|
||||
|
||||
<test:JFrame bounds="800,600,100,20" title="X4O Test" defaultCloseOperation="3" visible="true">
|
||||
<test:JFrameContentPane>
|
||||
<test:JPanel>
|
||||
<test:JLabel text="X4O, it's easy2" toolTipText="toolstip property"/>
|
||||
<test:JTextField text="xMl"/>
|
||||
<test:JTextArea columns="60" rows="20" editable="true" text="EL-ROCKS: ${date}"/>
|
||||
</test:JPanel>
|
||||
</test:JFrameContentPane>
|
||||
</test:JFrame>
|
||||
</tree:root>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<x4o:root xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
|
||||
xmlns:test="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
>
|
||||
<!-- XML_COMMENT_TEXT -->
|
||||
|
||||
<x4o:bean el.id="date" bean.class="java.util.Date"/>
|
||||
<test:testObjectChild el.id="child1" name="Im bean1" price="555" size="234.34"/>
|
||||
|
||||
<!-- bind parent and child8888 -->
|
||||
<test:testObjectParent el.id="parent2">
|
||||
<!-- comment1 .... -->
|
||||
<test:testObjectChild el.id="child2" name="Im bean2" price="345236" size="12.09"/>
|
||||
<!-- comment2 .... -->
|
||||
<!-- comment3 .... -->
|
||||
<!-- comment4 .... -->
|
||||
<x4o:bean el.id="date" bean.class="java.util.Date"/>
|
||||
<!-- comment5 .... -->
|
||||
<x4o:bean el.id="date" bean.class="java.util.Date"/><!-- comment6 .... -->
|
||||
</test:testObjectParent>
|
||||
|
||||
<!-- Test EL -->
|
||||
<test:testObjectChild el.id="bean3" parent="${parent2}" name="TEST ${child1.name}" price="0" size="0"/>
|
||||
|
||||
<!-- this does NOT bind !! -->
|
||||
<test:testObjectChild>
|
||||
<test:testObjectParent/>
|
||||
</test:testObjectChild>
|
||||
|
||||
</x4o:root>
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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:root
|
||||
xmlns:root="http://test.junit.x4o.org/xml/ns/junit-test-root"
|
||||
xmlns="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
>
|
||||
<TestAttributeOrderChildNatural
|
||||
aaaName="NAME_1"
|
||||
aabName="NAME_2"
|
||||
aacName="NAME_3"
|
||||
abaName="NAME_4"
|
||||
abbName="NAME_5"
|
||||
abcName="NAME_6"
|
||||
caaName="NAME_7"
|
||||
cabName="NAME_8"
|
||||
cacName="NAME_9"
|
||||
/>
|
||||
<custom-ordered-child
|
||||
aaaName="NAME_1"
|
||||
aabName="NAME_2"
|
||||
aacName="NAME_3"
|
||||
abaName="NAME_4"
|
||||
abbName="NAME_5"
|
||||
abcName="NAME_6"
|
||||
caaName="NAME_7"
|
||||
cabName="NAME_8"
|
||||
cacName="NAME_9"
|
||||
/>
|
||||
</root:root>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<test:child
|
||||
xmlns:test="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://test.junit.x4o.org/xml/ns/junit-test-lang junit-test-lang-1.0.xsd"
|
||||
name="include-child-dir.xml">
|
||||
</test:child>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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
|
||||
xmlns="http://test.junit.x4o.org/xml/ns/junit-test-root"
|
||||
xmlns:test="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://test.junit.x4o.org/xml/ns/junit-test-root junit-test-root-1.0.xsd"
|
||||
>
|
||||
<test:parent name="include-base.xml">
|
||||
<xi:include href="include-child.xml"/>
|
||||
<xi:include href="dir/include-child-dir.xml"/>
|
||||
</test:parent>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2004-2014, 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.
|
||||
|
||||
-->
|
||||
<test:child
|
||||
xmlns:test="http://test.junit.x4o.org/xml/ns/junit-test-lang"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://test.junit.x4o.org/xml/ns/junit-test-lang junit-test-lang-1.0.xsd"
|
||||
name="include-child.xml">
|
||||
</test:child>
|
||||
Loading…
Add table
Add a link
Reference in a new issue