use of org.whole.lang.codebase.StreamPersistenceProvider in project whole by wholeplatform.
the class XsdMappingTest method testMaven.
@Category(SlowTests.class)
@Test
public void testMaven() throws Exception {
InputStream is = loader.getResourceAsStream("maven-v4_0_0.xsd");
StreamSource ss = new StreamSource(is);
Schema schema = factory.newSchema(ss);
is = loader.getResourceAsStream("maven-v4_0_0.xml");
Validator v = schema.newValidator();
v.validate(new StreamSource(is));
is = loader.getResourceAsStream("maven-v4_0_0.xml");
IPersistenceProvider pp = new StreamPersistenceProvider(is);
pp.getBindings().wDefValue("packageName", "org.whole.lang.xsd.mapping.samples");
IEntity model = XsiPersistenceKit.instance().readModel(pp);
Assert.assertTrue(Matcher.match(new Maven400Instance().create(), model));
}
use of org.whole.lang.codebase.StreamPersistenceProvider in project whole by wholeplatform.
the class XsdMappingTest method testSimpleContent.
// Requires an Internet connection
// FIXME remove KnownFailingTests
@Category({ SlowTests.class, KnownFailingTests.class })
@Test
public void testSimpleContent() throws Exception {
InputStream is = loader.getResourceAsStream("simpleContent.xsd");
StreamSource ss = new StreamSource(is);
Schema schema = factory.newSchema(ss);
is = loader.getResourceAsStream("simpleContent.xml");
Validator v = schema.newValidator();
v.validate(new StreamSource(is));
is = loader.getResourceAsStream("simpleContent.xml");
IPersistenceProvider pp = new StreamPersistenceProvider(is);
pp.getBindings().wDefValue("packageName", "org.whole.lang.xsd.mapping.samples");
IEntity model = XsiPersistenceKit.instance().readModel(pp);
Assert.assertTrue(Matcher.match(new SimpleContentInstance().create(), model));
}
use of org.whole.lang.codebase.StreamPersistenceProvider in project whole by wholeplatform.
the class XsdMappingTest method testChoiceSample.
@Test
public void testChoiceSample() throws Exception {
InputStream is = loader.getResourceAsStream("ChoiceSample.xsd");
StreamSource ss = new StreamSource(is);
Schema schema = factory.newSchema(ss);
is = loader.getResourceAsStream("ChoiceSample.xml");
Validator v = schema.newValidator();
v.validate(new StreamSource(is));
is = loader.getResourceAsStream("ChoiceSample.xml");
IPersistenceProvider pp = new StreamPersistenceProvider(is);
pp.getBindings().wDefValue("packageName", "org.whole.lang.xsd.mapping.samples");
IEntity model = XsiPersistenceKit.instance().readModel(pp);
Assert.assertTrue(Matcher.match(new ChoiceSampleInstance().create(), model));
}
use of org.whole.lang.codebase.StreamPersistenceProvider in project whole by wholeplatform.
the class XsdMappingTest method testFreemind.
@Category(SlowTests.class)
@Test
public void testFreemind() throws Exception {
InputStream is = loader.getResourceAsStream("freemind.xsd");
StreamSource ss = new StreamSource(is);
Schema schema = factory.newSchema(ss);
is = loader.getResourceAsStream("freemindExample.xml");
Validator v = schema.newValidator();
v.validate(new StreamSource(is));
is = loader.getResourceAsStream("freemindExample.xml");
IPersistenceProvider pp = new StreamPersistenceProvider(is);
pp.getBindings().wDefValue("packageName", "org.whole.lang.xsd.mapping.samples");
IEntity model = XsiPersistenceKit.instance().readModel(pp);
Assert.assertTrue(Matcher.match(new FreemindInstance(model.wGetLanguageKit()).create(), model));
}
use of org.whole.lang.codebase.StreamPersistenceProvider in project whole by wholeplatform.
the class XsdMappingTest method testPain.
@Category(SlowTests.class)
@Test
public void testPain() throws Exception {
InputStream is = loader.getResourceAsStream("pain.xsd");
StreamSource ss = new StreamSource(is);
Schema schema = factory.newSchema(ss);
is = loader.getResourceAsStream("pain.xml");
Validator v = schema.newValidator();
v.validate(new StreamSource(is));
is = loader.getResourceAsStream("pain.xml");
IPersistenceProvider pp = new StreamPersistenceProvider(is);
pp.getBindings().wDefValue("packageName", "org.whole.lang.xsd.mapping.samples");
IEntity model = XsiPersistenceKit.instance().readModel(pp);
Assert.assertTrue(Matcher.match(new PainInstance().create(), model));
}
Aggregations