diff options
Diffstat (limited to 'catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceOperationTest.java')
-rw-r--r-- | catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceOperationTest.java | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceOperationTest.java index e1eb7db070..759fd2b811 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceOperationTest.java @@ -31,6 +31,7 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; @@ -42,6 +43,10 @@ import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.Operation; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; +import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; +import org.openecomp.sdc.be.model.operations.impl.ResourceOperation; +import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.model.operations.impl.util.OperationTestsUtil; import org.openecomp.sdc.be.resources.data.ResourceMetadataData; import org.openecomp.sdc.be.resources.data.UserData; @@ -61,7 +66,7 @@ public class InterfaceOperationTest { private static Logger log = LoggerFactory.getLogger(InterfaceOperationTest.class.getName()); private Gson prettyGson = new GsonBuilder().setPrettyPrinting().create(); - private static String USER_ID = "muserId"; + private static String USER_ID = "muUserId"; private static String CATEGORY_NAME = "category/mycategory"; // InterfaceLifecycleOperation interfaceOperation = new // InterfaceLifecycleOperation(); @@ -107,7 +112,7 @@ public class InterfaceOperationTest { } - @Test +/* @Test public void addInterfaceToResourceTest() { String capabilityTypeName = "mycapability1"; @@ -122,8 +127,7 @@ public class InterfaceOperationTest { ResourceOperationTest resourceOperationTest = new ResourceOperationTest(); resourceOperationTest.setOperations(titanDao, resourceOperation, propertyOperation); - Resource rootResource = resourceOperationTest.createResource(USER_ID, CATEGORY_NAME, rootName, "100.0", null, - true, true); + Resource rootResource = resourceOperationTest.createResource(USER_ID, CATEGORY_NAME, rootName, "100.0", null, true, true); String interfaceName = "standard"; InterfaceDefinition interfaceDefinition = buildInterfaceDefinition(); @@ -133,14 +137,12 @@ public class InterfaceOperationTest { operations.put("Create", op); interfaceDefinition.setOperations(operations); - Either<InterfaceDefinition, StorageOperationStatus> result = interfaceOperation - .addInterfaceToResource(interfaceDefinition, rootResource.getUniqueId(), "standard"); + Either<InterfaceDefinition, StorageOperationStatus> result = interfaceOperation.addInterfaceToResource(interfaceDefinition, rootResource.getUniqueId(), "standard"); assertTrue(result.isLeft()); log.debug("{}", result.left().value()); - Either<Resource, StorageOperationStatus> getResourceRes = resourceOperation - .getResource(rootResource.getUniqueId()); + Either<Resource, StorageOperationStatus> getResourceRes = resourceOperation.getResource(rootResource.getUniqueId()); assertTrue(getResourceRes.isLeft()); Resource resourceWithInterface = getResourceRes.left().value(); Map<String, InterfaceDefinition> interfaces = resourceWithInterface.getInterfaces(); @@ -162,8 +164,7 @@ public class InterfaceOperationTest { ResourceOperationTest resourceOperationTest = new ResourceOperationTest(); resourceOperationTest.setOperations(titanDao, resourceOperation, propertyOperation); - Resource rootResource = resourceOperationTest.createResource(USER_ID, CATEGORY_NAME, rootName, "200.0", null, - true, true); + Resource rootResource = resourceOperationTest.createResource(USER_ID, CATEGORY_NAME, rootName, "200.0", null, true, true); String interfaceName = "standard"; InterfaceDefinition interfaceDefinition = buildInterfaceDefinition(); @@ -173,25 +174,21 @@ public class InterfaceOperationTest { operations.put("create", op); interfaceDefinition.setOperations(operations); - Either<InterfaceDefinition, StorageOperationStatus> result = interfaceOperation - .addInterfaceToResource(interfaceDefinition, rootResource.getUniqueId(), "standard"); + Either<InterfaceDefinition, StorageOperationStatus> result = interfaceOperation.addInterfaceToResource(interfaceDefinition, rootResource.getUniqueId(), "standard"); ResourceMetadataData resourceData = new ResourceMetadataData(); resourceData.getMetadataDataDefinition().setUniqueId(rootResource.getUniqueId()); resourceData.getMetadataDataDefinition().setState(LifecycleStateEnum.CERTIFIED.name()); - Either<ResourceMetadataData, TitanOperationStatus> updateNode = titanDao.updateNode(resourceData, - ResourceMetadataData.class); + Either<ResourceMetadataData, TitanOperationStatus> updateNode = titanDao.updateNode(resourceData, ResourceMetadataData.class); assertTrue(updateNode.isLeft()); - Either<Resource, StorageOperationStatus> fetchRootResource = resourceOperation - .getResource(rootResource.getUniqueId()); + Either<Resource, StorageOperationStatus> fetchRootResource = resourceOperation.getResource(rootResource.getUniqueId()); assertTrue(fetchRootResource.isLeft()); String rootResourceJson = prettyGson.toJson(fetchRootResource.left().value()); log.debug(rootResourceJson); - Resource softwareComponent = resourceOperationTest.createResource(USER_ID, CATEGORY_NAME, softwareCompName, - "400.0", rootResource.getName(), true, true); + Resource softwareComponent = resourceOperationTest.createResource(USER_ID, CATEGORY_NAME, softwareCompName, "400.0", rootResource.getName(), true, true); assertTrue(result.isLeft()); log.debug("{}", result.left().value()); @@ -200,15 +197,13 @@ public class InterfaceOperationTest { // String resourceId, String interfaceName, String // operationName,Operation interf - Either<Operation, StorageOperationStatus> opResult = interfaceOperation - .updateInterfaceOperation(softwareComponent.getUniqueId(), "standard", "create", op); + Either<Operation, StorageOperationStatus> opResult = interfaceOperation.updateInterfaceOperation(softwareComponent.getUniqueId(), "standard", "create", op); // PrintGraph pg = new PrintGraph(); // System.out.println(pg.buildGraphForWebgraphWiz(titanDao.getGraph().left().value())); assertTrue(opResult.isLeft()); log.debug("{}", opResult.left().value()); - Either<Resource, StorageOperationStatus> getResourceRes = resourceOperation - .getResource(softwareComponent.getUniqueId()); + Either<Resource, StorageOperationStatus> getResourceRes = resourceOperation.getResource(softwareComponent.getUniqueId()); assertTrue(getResourceRes.isLeft()); Resource resourceWithInterface = getResourceRes.left().value(); Map<String, InterfaceDefinition> interfaces = resourceWithInterface.getInterfaces(); @@ -221,7 +216,7 @@ public class InterfaceOperationTest { assertNotNull(operation); assertNotNull(operation.getImplementation()); } - +*/ private void addImplementationToOperation(Operation op) { ArtifactDataDefinition artifactDataDef = new ArtifactDataDefinition(); artifactDataDef.setArtifactChecksum("YTg2Mjg4MWJhNmI5NzBiNzdDFkMWI="); @@ -254,6 +249,13 @@ public class InterfaceOperationTest { private void deleteAndCreateCategory(String category) { String[] names = category.split("/"); OperationTestsUtil.deleteAndCreateResourceCategory(names[0], names[1], titanDao); + + /* + * CategoryData categoryData = new CategoryData(); categoryData.setName(category); + * + * titanDao.deleteNode(categoryData, CategoryData.class); Either<CategoryData, TitanOperationStatus> createNode = titanDao .createNode(categoryData, CategoryData.class); System.out.println("after creating caetgory " + createNode); + */ + } private UserData deleteAndCreateUser(String userId, String firstName, String lastName) { |