+ @Test
+ public void testCreateNodeTypesElse(){
+ String yamlName = "group.yml";
+ Service service =createServiceObject(false);
+ boolean needLock = true;
+ Map<String, EnumMap<ArtifactsBusinessLogic.ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = new HashMap<>();
+ EnumMap<ArtifactsBusinessLogic.ArtifactOperationEnum, List<ArtifactDefinition>> enumListEnumMap =
+ new EnumMap<>(ArtifactsBusinessLogic.ArtifactOperationEnum.class);
+ List<ArtifactDefinition> artifactDefinitions = new ArrayList<>();
+ ArtifactDefinition artifactDefinition = new ArtifactDefinition();
+ artifactDefinition.setArtifactName("artifactName");
+ artifactDefinitions.add(artifactDefinition);
+ enumListEnumMap.put(ArtifactsBusinessLogic.ArtifactOperationEnum.CREATE,
+ artifactDefinitions);
+ nodeTypesArtifactsToHandle.put("nodeTyp",enumListEnumMap);
+ List<ArtifactDefinition> nodeTypesNewCreatedArtifacts = new ArrayList<>();
+ Map<String, NodeTypeInfo> nodeTypesInfo = getNodeTypesInfo();
+ CsarInfo csarInfo = getCsarInfo();
+ Map<String, Object> mapToConvert =new HashMap<>();
+ Map<String, Object> nodeTypes =new HashMap<>();
+ NodeTypeInfo nodeTypeInfo = new NodeTypeInfo();
+ nodeTypesInfo.put("nodeTyp",nodeTypeInfo);
+ nodeTypes.put("org.openecomp.resource.derivedFrom.zxjTestImportServiceAb0.test",
+ nodeTypeInfo);
+
+ try {
+ sIB1.createNodeTypes(yamlName, service, needLock, nodeTypesArtifactsToHandle,
+ nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo, mapToConvert,
+ nodeTypes);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected Resource createNewResource(){
+ Resource newResource = createParseResourceObject(false);
+ newResource.setVersion("1.0");
+ newResource.setInvariantUUID("");
+ newResource.setLifecycleState(null);
+ newResource.setUUID("");
+ newResource.setNormalizedName("");
+ newResource.setSystemName("");
+ newResource.setCsarUUID("");
+ newResource.setImportedToscaChecksum("");
+ newResource.setDerivedFromGenericType("");
+ newResource.setDerivedFromGenericVersion("");
+ Map<String, ArtifactDefinition> toscaArtifacts = new HashMap<>();
+ ArtifactDefinition artifactDefinition = new ArtifactDefinition();
+ artifactDefinition.setArtifactName("artifactDefinition");
+ toscaArtifacts.put("toscaArtifactsMap",artifactDefinition);
+ Map<String, InterfaceDefinition> interfaces = new HashMap<>();
+ InterfaceDefinition interfaceDefinition = new InterfaceDefinition();
+ interfaceDefinition.setOwnerId("OwnerId");
+ interfaces.put("interfacesMap",interfaceDefinition);
+ newResource.setInterfaces(interfaces);
+ newResource.setToscaArtifacts(toscaArtifacts);
+ newResource.setProperties(getProperties());
+ return newResource;
+ }
+
+ protected Resource createOldResource(){
+ Resource newResource = createParseResourceObject(false);
+ newResource.setVersion("1.0");
+ newResource.setInvariantUUID("552e8f6c-340c-4fb4-8a82-fe7732fd8010");
+ newResource.setLifecycleState(LifecycleStateEnum.CERTIFIED);
+ newResource.setUUID("13065b80-ca96-4331-b643-d28aeaf961cb");
+ newResource.setNormalizedName("NormalizedName");
+ newResource.setSystemName("default");
+ newResource.setCsarUUID("CsarUUID");
+ newResource.setImportedToscaChecksum("ImportedToscaChecksum");
+ newResource.setDerivedFromGenericType("DerivedFromGenericType");
+ newResource.setDerivedFromGenericVersion("0.1");
+ Map<String, ArtifactDefinition> toscaArtifacts = new HashMap<>();
+ ArtifactDefinition artifactDefinition = new ArtifactDefinition();
+ artifactDefinition.setArtifactName("tosca_simple_yaml_1_1");
+ toscaArtifacts.put("tosca_definitions_version",artifactDefinition);
+ Map<String, InterfaceDefinition> interfaces = new HashMap<>();
+ InterfaceDefinition interfaceDefinition = new InterfaceDefinition();
+ interfaceDefinition.setDescription("Invoked upon receipt of an Instantiate VNF request");
+ interfaces.put("tosca_simple_yaml_1_1",interfaceDefinition);
+ newResource.setInterfaces(interfaces);
+ newResource.setToscaArtifacts(toscaArtifacts);
+ List<PropertyDefinition> properties = new ArrayList<>();
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setName("tosca_simple_yaml_1_1");
+ properties.add(propertyDefinition);
+ newResource.setProperties(properties);
+ return newResource;
+ }
+