use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.
the class NodeIngestorTest method testGetContextForVersion.
@Test
public void testGetContextForVersion() {
DynamicJAXBContext ctx10 = nodeIngestor.getContextForVersion(new SchemaVersion("v10"));
// should work bc Foo is valid in test_network_v10 schema
DynamicEntity foo10 = ctx10.newDynamicEntity("Foo");
foo10.set("fooId", "bar");
assertEquals("bar", foo10.get("fooId"));
// should work bc Bar is valid in test_business_v10 schema
DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
bar10.set("barId", "bar2");
assertEquals("bar2", bar10.get("barId"));
XSDOutputResolver outputResolver10 = new XSDOutputResolver();
ctx10.generateSchema(outputResolver10);
DynamicJAXBContext ctx11 = nodeIngestor.getContextForVersion(new SchemaVersion("v11"));
// should work bc Foo.quantity is valid in test_network_v11 schema
DynamicEntity foo11 = ctx11.newDynamicEntity("Foo");
foo11.set("quantity", "12");
assertEquals("12", foo11.get("quantity"));
DynamicEntity quux11 = ctx11.newDynamicEntity("Quux");
quux11.set("qManagerName", "some guy");
assertEquals("some guy", quux11.get("qManagerName"));
XSDOutputResolver outputResolver11 = new XSDOutputResolver();
ctx11.generateSchema(outputResolver11);
thrown.expect(IllegalArgumentException.class);
// should fail bc Quux not in v10 test schema
ctx10.newDynamicEntity("Quux");
}
use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.
the class NodeTypesValidationModuleTest method test.
@Test
public void test() {
List<String> testPairs = new ArrayList<>();
testPairs.add("bar|foo");
testPairs.add("foo|foo");
testPairs.add("foo|quux");
assertTrue("".equals(validator.validate(testPairs, new SchemaVersion("v11"))));
assertTrue(// bc
validator.validate(testPairs, new SchemaVersion("v10")).contains("Invalid node type(s) found: quux"));
// no
// quux
// in
// v10
}
use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.
the class ConfigTranslatorForWiringTest method getNodeFiles.
@Override
public Map<SchemaVersion, List<String>> getNodeFiles() {
String f = bean.getNodeDirectory() + "test_business_v10.xml";
List<String> files = new ArrayList<>();
files.add(f);
Map<SchemaVersion, List<String>> mp = new TreeMap<>();
mp.put(new SchemaVersion("v10"), files);
return mp;
}
use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.
the class ConfigTranslatorForWiringTest method getEdgeFiles.
@Override
public Map<SchemaVersion, List<String>> getEdgeFiles() {
String f = bean.getEdgeDirectory() + "test.json";
List<String> files = new ArrayList<>();
files.add(f);
Map<SchemaVersion, List<String>> mp = new TreeMap<>();
mp.put(new SchemaVersion("v10"), files);
return mp;
}
use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.
the class GoodConfigForValidationTest method getNodeFiles.
@Override
public Map<SchemaVersion, List<String>> getNodeFiles() {
List<String> files = new ArrayList<>();
files.add("src/test/resources/oxm/goodConfigForValidationTest_oxm.xml");
Map<SchemaVersion, List<String>> input = new TreeMap<>();
// input.put(SchemaVersion.getLatest(), files);
for (SchemaVersion v : schemaVersions.getVersions()) {
input.put(v, files);
}
return input;
}
Aggregations