X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fmodelloader%2Fservice%2FModelController.java;h=09219828cfd9be5e2897cd85e722e0a204f7643b;hb=refs%2Fheads%2Fmaster;hp=4e883aa8d1d8d22e597062a176ea1450546209c5;hpb=e63280ff44773d68d4c542187864415fbf6b0547;p=aai%2Fmodel-loader.git diff --git a/src/main/java/org/onap/aai/modelloader/service/ModelController.java b/src/main/java/org/onap/aai/modelloader/service/ModelController.java index 4e883aa..233f2ab 100644 --- a/src/main/java/org/onap/aai/modelloader/service/ModelController.java +++ b/src/main/java/org/onap/aai/modelloader/service/ModelController.java @@ -29,6 +29,7 @@ import org.onap.aai.cl.api.Logger; import org.onap.aai.cl.eelf.LoggerFactory; import org.onap.aai.modelloader.config.ModelLoaderConfig; import org.onap.aai.modelloader.entity.Artifact; +import org.onap.aai.modelloader.entity.ArtifactType; import org.onap.aai.modelloader.notification.ArtifactDownloadManager; import org.onap.aai.modelloader.notification.NotificationDataImpl; import org.onap.aai.modelloader.notification.NotificationPublisher; @@ -103,11 +104,16 @@ public class ModelController { logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT, "Generating XML models from test artifact"); + List artifacts = artifactDownloadManager.processToscaArtifacts(csarFile, artifactInfo, "test-transaction-id", modelVersion); List modelArtifacts = new ArrayList<>(); List catalogArtifacts = new ArrayList<>(); - - artifactDownloadManager.processToscaArtifacts(modelArtifacts, - catalogArtifacts, csarFile, artifactInfo, "test-transaction-id", modelVersion); + for(Artifact artifact : artifacts) { + if(artifact.getType().equals(ArtifactType.MODEL)) { + modelArtifacts.add(artifact); + } else { + catalogArtifacts.add(artifact); + } + } logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT, "Loading xml models from test artifacts: " + modelArtifacts.size() + " model(s) and " + catalogArtifacts.size() + " catalog(s)"); @@ -115,7 +121,7 @@ public class ModelController { NotificationDataImpl notificationData = new NotificationDataImpl(); notificationData.setDistributionID("TestDistributionID"); boolean success = - artifactDeploymentManager.deploy(notificationData, modelArtifacts, catalogArtifacts); + artifactDeploymentManager.deploy(notificationData.getDistributionID(), modelArtifacts, catalogArtifacts); logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT, "Deployment success was " + success); response = success ? ResponseEntity.ok().build() : ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build(); } catch (Exception e) {