use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.
the class UniqueRelationshipQueryTest method setup.
/**
* Setup.
*
* @throws JAXBException the JAXB exception
*/
@Before
public void setup() throws JAXBException {
version = new SchemaVersion("v10");
dbEngine = new JanusGraphDBEngine(QueryStyle.GREMLIN_UNIQUE, loaderFactory.createLoaderForVersion(ModelType.MOXY, version), false);
unmarshaller = context.createUnmarshaller();
unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json");
unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false);
unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true);
}
use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.
the class UniqueURIQueryTest method parentQuery.
/**
* Parent query.
*
* @throws UnsupportedEncodingException the unsupported encoding exception
* @throws AAIException the AAI exception
*/
@Test
public void parentQuery() throws UnsupportedEncodingException, AAIException {
version = new SchemaVersion("v10");
dbEngine = new JanusGraphDBEngine(QueryStyle.GREMLIN_UNIQUE, loaderFactory.createLoaderForVersion(ModelType.MOXY, version), false);
URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1").build();
String key = "complex/key1";
QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri);
GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("aai-unique-key", key);
String parentResultType = "";
String resultType = "complex";
String containerType = "";
testSet(query, expected, expected, parentResultType, resultType, containerType);
}
use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.
the class NodeIngestor method translateAll.
private void translateAll(Translator translator) throws ExceptionInInitializerError {
if (translator instanceof ConfigTranslator) {
this.localSchema = "true";
}
Boolean retrieveLocalSchema = Boolean.parseBoolean(this.localSchema);
/*
* Set this to default schemaVersion
*/
this.schemaVersions = translator.getSchemaVersions();
List<SchemaVersion> schemaVersionList = translator.getSchemaVersions().getVersions();
try {
for (SchemaVersion version : schemaVersionList) {
LOGGER.debug("Version being processed" + version);
List<InputStream> inputStreams = retrieveOXM(version, translator);
LOGGER.debug("Retrieved OXMs from SchemaService");
/*
* IOUtils.copy and copy the inputstream
*/
if (inputStreams.isEmpty()) {
continue;
}
final DynamicJAXBContext ctx = ingest(inputStreams);
versionContextMap.put(version, ctx);
setAllTypesAndProperties(version, inputStreams);
schemaPerVersion.put(version, createCombinedSchema(inputStreams, version, retrieveLocalSchema));
}
} catch (JAXBException | ParserConfigurationException | SAXException | IOException e) {
throw new ExceptionInInitializerError(e);
}
}
use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.
the class OxmEdgeRulesLoader method loadModels.
/**
* Finds all DB Edge Rules and Edge Properties files for all OXM models.
*
* @throws SchemaProviderException
* @throws SchemaProviderException
*/
public static synchronized void loadModels() throws SchemaProviderException {
Map<String, File> propFiles = edgePropertyFiles(edgePropsConfiguration);
if (logger.isDebugEnabled()) {
logger.debug("Loading DB Edge Rules");
}
for (String version : OxmSchemaLoader.getLoadedOXMVersions()) {
try {
SchemaVersion schemaVersion = translator.getSchemaVersions().getVersions().stream().filter(s -> s.toString().equalsIgnoreCase(version)).findAny().orElse(null);
loadModel(schemaVersion, edgeIngestor, propFiles);
} catch (IOException | EdgeRuleNotFoundException e) {
throw new SchemaProviderException(e.getMessage(), e);
}
}
}
use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.
the class OxmEdgeRulesLoader method loadModels.
/**
* Loads DB Edge Rules and Edge Properties for a given version.
*
* @throws SchemaProviderException
*/
public static synchronized void loadModels(String v) throws SchemaProviderException {
Map<String, File> propFiles = edgePropertyFiles(edgePropsConfiguration);
if (logger.isDebugEnabled()) {
logger.debug("Loading DB Edge Rules ");
}
try {
SchemaVersion schemaVersion = translator.getSchemaVersions().getVersions().stream().filter(s -> s.toString().equalsIgnoreCase(v)).findAny().orElse(null);
loadModel(schemaVersion, edgeIngestor, propFiles);
} catch (IOException | EdgeRuleNotFoundException e) {
throw new SchemaProviderException(e.getMessage());
}
}
Aggregations