* ============LICENSE_START===================================================
* SPARKY (AAI UI service)
* ============================================================================
- * Copyright © 2017 AT&T Intellectual Property.
- * Copyright © 2017 Amdocs
+ * Copyright © 2017 AT&T Intellectual Property.
+ * Copyright © 2017 Amdocs
* All rights reserved.
* ============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.aai.restclient.client.OperationResult;
+import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.sparky.config.oxm.OxmEntityDescriptor;
import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
import org.onap.aai.sparky.config.oxm.OxmModelLoader;
import org.onap.aai.sparky.dal.ActiveInventoryAdapter;
-import org.onap.aai.sparky.editattributes.AttributeUpdater;
import org.onap.aai.sparky.editattributes.AttributeUpdater.AaiEditObject;
OxmEntityDescriptor desc = new OxmEntityDescriptor();
desc.addPrimaryKeyName("hostname");
desc.setEntityName("pserver");
-
OxmEntityLookup entityLookup = new OxmEntityLookup();
entityLookup.addEntityDescriptor("pserver", desc);
- AttributeUpdater updater = new AttributeUpdater(new OxmModelLoader(), entityLookup, aaiAdapter);
+ AttributeUpdater updater =
+ new AttributeUpdater(new OxmModelLoader("v11", null, null), entityLookup, aaiAdapter,"aai");
Map<String, Object> attributes = new HashMap<>();
attributes.put("prov-status", "PREPROV");
attributes.put("in-maint", "true");
*/
@Test(expected = NullPointerException.class)
public void testGetEditObjectFromUri() throws Exception {
+ String version = "v11";
+ OxmModelLoader loader = new OxmModelLoader(version, null, null);
- OxmModelLoader loader = new OxmModelLoader();
- loader.setLatestVersionNum(11);
OxmEntityDescriptor desc = new OxmEntityDescriptor();
desc.addPrimaryKeyName("hostname");
entityLookup.setEntityTypeLookup(typeLookup);
- AttributeUpdater updater = new AttributeUpdater(new OxmModelLoader(), entityLookup, aaiAdapter);
+ AttributeUpdater updater =
+ new AttributeUpdater(new OxmModelLoader(version, null, null), entityLookup, aaiAdapter,"aai");
AaiEditObject result = updater.getEditObjectFromUri(null);
assertEquals("Pserver", result.getObjectType());
assertEquals("pserver", result.getRootElement());
OxmEntityLookup entityLookup = new OxmEntityLookup();
entityLookup.addEntityDescriptor("pserver", desc);
- AttributeUpdater updater = new AttributeUpdater(new OxmModelLoader(), entityLookup, aaiAdapter);
+ AttributeUpdater updater = new AttributeUpdater(new OxmModelLoader("v11",null,null), entityLookup, aaiAdapter,"aai");
// Test entity uri without "/aai/version/"
String result = updater.getRelativeUri("cloud-infrastructure/pservers/pserver/mtznjtax101");
assertEquals("/cloud-infrastructure/pservers/pserver/mtznjtax101", result);
assertEquals("/cloud-infrastructure/pservers/pserver/mtznjtax101", result);
}
-}
+}
\ No newline at end of file