diff options
author | 2018-03-09 10:00:26 +0000 | |
---|---|---|
committer | 2018-03-09 10:00:26 +0000 | |
commit | f3b28a0aafd83a57d42afbf23c9f6fbe6f546db3 (patch) | |
tree | 5ecb2b2a78ab3139828db18de5f2a76d76c77519 /packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator | |
parent | 8d0b9eb56af520d28c423da76c0f0be02cb453c7 (diff) | |
parent | 327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e (diff) |
Merge "Reduce log noise/warnings format to conventions"
Diffstat (limited to 'packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator')
7 files changed, 401 insertions, 399 deletions
diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java index 3cb5a97d09..933216e611 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java @@ -48,28 +48,28 @@ import org.openecomp.mso.asdc.installer.IVfModuleData; public class DistributionClientEmulator implements IDistributionClient { - private String resourcePath; + private String resourcePath; - private List<IVfModuleData> listVFModuleMetaData; + private List<IVfModuleData> listVFModuleMetaData; - private List<IDistributionStatusMessage> distributionMessageReceived = new LinkedList<>(); + private List<IDistributionStatusMessage> distributionMessageReceived = new LinkedList<>(); - public DistributionClientEmulator(String notifFolderInResource) { + public DistributionClientEmulator(String notifFolderInResource) { - resourcePath = notifFolderInResource; - } + resourcePath = notifFolderInResource; + } - public List<IDistributionStatusMessage> getDistributionMessageReceived() { - return distributionMessageReceived; - } - - @Override - public List<IVfModuleMetadata> decodeVfModuleArtifact(byte[] arg0) { - return null; - } + public List<IDistributionStatusMessage> getDistributionMessageReceived() { + return distributionMessageReceived; + } + + @Override + public List<IVfModuleMetadata> decodeVfModuleArtifact(byte[] arg0) { + return null; + } /* @Override - public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) { + public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) { try { listVFModuleMetaData = new ObjectMapper().readValue(arg0, new TypeReference<List<JsonVfModuleMetaData>>(){}); return listVFModuleMetaData; @@ -84,91 +84,91 @@ public class DistributionClientEmulator implements IDistributionClient { return null; } */ - public List<IVfModuleData> getListVFModuleMetaData() { - return listVFModuleMetaData; - } + public List<IVfModuleData> getListVFModuleMetaData() { + return listVFModuleMetaData; + } @Override - public IDistributionClientDownloadResult download (IArtifactInfo arg0) { - - - //String filename = resourcePath+"/artifacts/"+arg0.getArtifactURL(); - String filename = arg0.getArtifactURL(); - System.out.println("Emulating the download from resources files:"+filename); - - InputStream inputStream = null; - - if(arg0.getArtifactName().equals("service_Rg516VmmscSrvc_csar.csar")){ - try{ - inputStream = new FileInputStream(System.getProperty("java.io.tmpdir") + File.separator + "service_Rg516VmmscSrvc_csar.csar"); - }catch(Exception e){ - System.out.println("Error " + e.getMessage()); - } - }else{ - - inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath + filename); - } + public IDistributionClientDownloadResult download(IArtifactInfo arg0) { - if (inputStream == null) { - System.out.println("InputStream is NULL for:"+filename); - } - try { - return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(),arg0.getArtifactName(),IOUtils.toByteArray(inputStream)); - } catch (IOException e) { - - e.printStackTrace(); - } - return null; - } - @Override - public IConfiguration getConfiguration() { - return null; - } - - @Override - public IDistributionClientResult init(IConfiguration arg0, INotificationCallback arg1) { - return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - } - - @Override - public IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage arg0) { - this.distributionMessageReceived.add(arg0); - return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - } - - @Override - public IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage arg0, String arg1) { - this.distributionMessageReceived.add(arg0); - return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - } - - @Override - public IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage arg0) { - this.distributionMessageReceived.add(arg0); - return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - } - - @Override - public IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage arg0, String arg1) { - this.distributionMessageReceived.add(arg0); - return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - } - - @Override - public IDistributionClientResult start() { - return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - } - - @Override - public IDistributionClientResult stop() { - return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - - } - - @Override - public IDistributionClientResult updateConfiguration(IConfiguration arg0) { - return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - } + //String filename = resourcePath+"/artifacts/"+arg0.getArtifactURL(); + String filename = arg0.getArtifactURL(); + System.out.println("Emulating the download from resources files:" + filename); + + InputStream inputStream = null; + + if (arg0.getArtifactName().equals("service_Rg516VmmscSrvc_csar.csar")) { + try { + inputStream = new FileInputStream(System.getProperty("java.io.tmpdir") + File.separator + "service_Rg516VmmscSrvc_csar.csar"); + } catch (Exception e) { + System.out.println("Error " + e.getMessage()); + } + } else { + + inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath + filename); + } + + if (inputStream == null) { + System.out.println("InputStream is NULL for:" + filename); + } + try { + return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(), arg0.getArtifactName(), IOUtils.toByteArray(inputStream)); + } catch (IOException e) { + + e.printStackTrace(); + } + return null; + } + + @Override + public IConfiguration getConfiguration() { + return null; + } + + @Override + public IDistributionClientResult init(IConfiguration arg0, INotificationCallback arg1) { + return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + } + + @Override + public IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage arg0) { + this.distributionMessageReceived.add(arg0); + return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + } + + @Override + public IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage arg0, String arg1) { + this.distributionMessageReceived.add(arg0); + return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + } + + @Override + public IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage arg0) { + this.distributionMessageReceived.add(arg0); + return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + } + + @Override + public IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage arg0, String arg1) { + this.distributionMessageReceived.add(arg0); + return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + } + + @Override + public IDistributionClientResult start() { + return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + } + + @Override + public IDistributionClientResult stop() { + return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + + } + + @Override + public IDistributionClientResult updateConfiguration(IConfiguration arg0) { + return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name()); + } } diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfo.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfo.java index 90511033dd..e998778a26 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfo.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfo.java @@ -19,6 +19,7 @@ */ package org.openecomp.mso.global_tests.asdc.notif_emulator; + import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -31,92 +32,91 @@ import org.openecomp.sdc.api.notification.IArtifactInfo; public class JsonArtifactInfo implements IArtifactInfo { - @JsonIgnore - private Map<String,IArtifactInfo> artifactsMapByUUID = new HashMap<>(); - - @JsonIgnore - private Map<String,Object> attributesMap = new HashMap<>(); - - public JsonArtifactInfo() { - - } - - public synchronized void addArtifactToUUIDMap (List<JsonArtifactInfo> artifactList) { - for (JsonArtifactInfo artifact:artifactList) { - artifactsMapByUUID.put(artifact.getArtifactUUID(), artifact); - } - - } - - @SuppressWarnings("unused") - @JsonAnySetter - public final void setAttribute(String attrName, Object attrValue) { - if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) { - this.attributesMap.put(attrName,attrValue); - } - } - - - - public Map<String, IArtifactInfo> getArtifactsMapByUUID() { - return artifactsMapByUUID; - } - - @Override - public String getArtifactChecksum() { - return (String)attributesMap.get("artifactCheckSum"); - } - - @Override - public String getArtifactDescription() { - return (String)attributesMap.get("artifactDescription"); - } - - @Override - public String getArtifactName() { - return (String)attributesMap.get("artifactName"); - } - - @Override - public Integer getArtifactTimeout() { - return (Integer)attributesMap.get("artifactTimeout"); - } - - @Override - public String getArtifactType() { - return (String)attributesMap.get("artifactType"); - } - - @Override - public String getArtifactURL() { - return (String)attributesMap.get("artifactURL"); - } - - @Override - public String getArtifactUUID() { - return (String)attributesMap.get("artifactUUID"); - } - - @Override - public String getArtifactVersion() { - return (String)attributesMap.get("artifactVersion"); - } - - @Override - public IArtifactInfo getGeneratedArtifact () { - return artifactsMapByUUID.get(attributesMap.get("generatedArtifact")); - } - - @Override - public List<IArtifactInfo> getRelatedArtifacts() { - List<IArtifactInfo> listArtifacts = new LinkedList<>(); - List<String> uuidList = (List<String>)attributesMap.get("relatedArtifact"); - if (uuidList != null) { - for(String uuid:uuidList) { - listArtifacts.add(artifactsMapByUUID.get(uuid)); - } - } - return listArtifacts; - } + @JsonIgnore + private Map<String, IArtifactInfo> artifactsMapByUUID = new HashMap<>(); + + @JsonIgnore + private Map<String, Object> attributesMap = new HashMap<>(); + + public JsonArtifactInfo() { + + } + + public synchronized void addArtifactToUUIDMap(List<JsonArtifactInfo> artifactList) { + for (JsonArtifactInfo artifact : artifactList) { + artifactsMapByUUID.put(artifact.getArtifactUUID(), artifact); + } + + } + + @SuppressWarnings("unused") + @JsonAnySetter + public final void setAttribute(String attrName, Object attrValue) { + if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) { + this.attributesMap.put(attrName, attrValue); + } + } + + + public Map<String, IArtifactInfo> getArtifactsMapByUUID() { + return artifactsMapByUUID; + } + + @Override + public String getArtifactChecksum() { + return (String) attributesMap.get("artifactCheckSum"); + } + + @Override + public String getArtifactDescription() { + return (String) attributesMap.get("artifactDescription"); + } + + @Override + public String getArtifactName() { + return (String) attributesMap.get("artifactName"); + } + + @Override + public Integer getArtifactTimeout() { + return (Integer) attributesMap.get("artifactTimeout"); + } + + @Override + public String getArtifactType() { + return (String) attributesMap.get("artifactType"); + } + + @Override + public String getArtifactURL() { + return (String) attributesMap.get("artifactURL"); + } + + @Override + public String getArtifactUUID() { + return (String) attributesMap.get("artifactUUID"); + } + + @Override + public String getArtifactVersion() { + return (String) attributesMap.get("artifactVersion"); + } + + @Override + public IArtifactInfo getGeneratedArtifact() { + return artifactsMapByUUID.get(attributesMap.get("generatedArtifact")); + } + + @Override + public List<IArtifactInfo> getRelatedArtifacts() { + List<IArtifactInfo> listArtifacts = new LinkedList<>(); + List<String> uuidList = (List<String>) attributesMap.get("relatedArtifact"); + if (uuidList != null) { + for (String uuid : uuidList) { + listArtifacts.add(artifactsMapByUUID.get(uuid)); + } + } + return listArtifacts; + } } diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfoDeserializer.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfoDeserializer.java index 010c9ac2a7..c1213763df 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfoDeserializer.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonArtifactInfoDeserializer.java @@ -30,19 +30,20 @@ import org.codehaus.jackson.map.JsonDeserializer; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.type.TypeReference; -public class JsonArtifactInfoDeserializer extends JsonDeserializer<List<JsonArtifactInfo>>{ +public class JsonArtifactInfoDeserializer extends JsonDeserializer<List<JsonArtifactInfo>> { - @Override - public List<JsonArtifactInfo> deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - List<JsonArtifactInfo> jsonArtifactInfoList = new ObjectMapper().readValue(jp, new TypeReference<List<JsonArtifactInfo>>(){}); + @Override + public List<JsonArtifactInfo> deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + List<JsonArtifactInfo> jsonArtifactInfoList = new ObjectMapper().readValue(jp, new TypeReference<List<JsonArtifactInfo>>() { + }); - // For each artifact add the list of artifact retrieved - // This could be used later to index by UUID - for (JsonArtifactInfo artifactInfo:jsonArtifactInfoList) { - artifactInfo.addArtifactToUUIDMap(jsonArtifactInfoList); - } - return jsonArtifactInfoList; - } + // For each artifact add the list of artifact retrieved + // This could be used later to index by UUID + for (JsonArtifactInfo artifactInfo : jsonArtifactInfoList) { + artifactInfo.addArtifactToUUIDMap(jsonArtifactInfoList); + } + return jsonArtifactInfoList; + } } diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonNotificationData.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonNotificationData.java index cf041afd6c..7622a43a7b 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonNotificationData.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonNotificationData.java @@ -40,89 +40,89 @@ import org.openecomp.sdc.api.notification.IResourceInstance; public class JsonNotificationData implements INotificationData { - @JsonIgnore - private Map<String,Object> attributesMap = new HashMap<>(); - - @JsonProperty("serviceArtifacts") - @JsonDeserialize(using=JsonArtifactInfoDeserializer.class) - private List<IArtifactInfo> serviceArtifacts; - - @JsonProperty("resources") - @JsonDeserialize(using=JsonResourceInfoDeserializer.class) - private List<IResourceInstance> resourcesList; - - public JsonNotificationData() { - - } - - /** - * Method instantiate a INotificationData implementation from a JSON file. - * - * @param notifFilePath The file path in String - * @return A JsonNotificationData instance - * @throws IOException in case of the file is not readable or not accessible - */ - public static JsonNotificationData instantiateNotifFromJsonFile(String notifFilePath) throws IOException { - - InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(notifFilePath+"/notif-structure.json"); - - if (is == null) { - throw new FileExistsException("Resource Path does not exist: "+notifFilePath); - } - ObjectMapper mapper = new ObjectMapper(); - return mapper.readValue(is, JsonNotificationData.class); - } - - @SuppressWarnings("unused") - @JsonAnySetter - public final void setAttribute(String attrName, Object attrValue) { - if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) { - this.attributesMap.put(attrName,attrValue); - } - } - - @Override - public IArtifactInfo getArtifactMetadataByUUID(String arg0) { - return null; - } - - @Override - public String getDistributionID() { - return (String)this.attributesMap.get("distributionID"); - } - - @Override - public List<IResourceInstance> getResources() { - return resourcesList; - } - - @Override - public List<IArtifactInfo> getServiceArtifacts() { - return this.serviceArtifacts; - } - - @Override - public String getServiceDescription() { - return (String)this.attributesMap.get("serviceDescription"); - } - - @Override - public String getServiceInvariantUUID() { - return (String)this.attributesMap.get("serviceInvariantUUID"); - } - - @Override - public String getServiceName() { - return (String)this.attributesMap.get("serviceName"); - } - - @Override - public String getServiceUUID() { - return (String)this.attributesMap.get("serviceUUID"); - } - - @Override - public String getServiceVersion() { - return (String)this.attributesMap.get("serviceVersion"); - } + @JsonIgnore + private Map<String, Object> attributesMap = new HashMap<>(); + + @JsonProperty("serviceArtifacts") + @JsonDeserialize(using = JsonArtifactInfoDeserializer.class) + private List<IArtifactInfo> serviceArtifacts; + + @JsonProperty("resources") + @JsonDeserialize(using = JsonResourceInfoDeserializer.class) + private List<IResourceInstance> resourcesList; + + public JsonNotificationData() { + + } + + /** + * Method instantiate a INotificationData implementation from a JSON file. + * + * @param notifFilePath The file path in String + * @return A JsonNotificationData instance + * @throws IOException in case of the file is not readable or not accessible + */ + public static JsonNotificationData instantiateNotifFromJsonFile(String notifFilePath) throws IOException { + + InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(notifFilePath + "/notif-structure.json"); + + if (is == null) { + throw new FileExistsException("Resource Path does not exist: " + notifFilePath); + } + ObjectMapper mapper = new ObjectMapper(); + return mapper.readValue(is, JsonNotificationData.class); + } + + @SuppressWarnings("unused") + @JsonAnySetter + public final void setAttribute(String attrName, Object attrValue) { + if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) { + this.attributesMap.put(attrName, attrValue); + } + } + + @Override + public IArtifactInfo getArtifactMetadataByUUID(String arg0) { + return null; + } + + @Override + public String getDistributionID() { + return (String) this.attributesMap.get("distributionID"); + } + + @Override + public List<IResourceInstance> getResources() { + return resourcesList; + } + + @Override + public List<IArtifactInfo> getServiceArtifacts() { + return this.serviceArtifacts; + } + + @Override + public String getServiceDescription() { + return (String) this.attributesMap.get("serviceDescription"); + } + + @Override + public String getServiceInvariantUUID() { + return (String) this.attributesMap.get("serviceInvariantUUID"); + } + + @Override + public String getServiceName() { + return (String) this.attributesMap.get("serviceName"); + } + + @Override + public String getServiceUUID() { + return (String) this.attributesMap.get("serviceUUID"); + } + + @Override + public String getServiceVersion() { + return (String) this.attributesMap.get("serviceVersion"); + } } diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java index af49ee0d37..a717238bb9 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java @@ -34,72 +34,72 @@ import org.openecomp.sdc.api.notification.IResourceInstance; public class JsonResourceInfo implements IResourceInstance { - @JsonIgnore - private Map<String,Object> attributesMap = new HashMap<>(); - - @JsonProperty("artifacts") - @JsonDeserialize(using=JsonArtifactInfoDeserializer.class) - private List<IArtifactInfo> artifacts; - - public JsonResourceInfo() { - - } - - @Override - public List<IArtifactInfo> getArtifacts() { - return artifacts; - } - - @Override - public String getResourceInstanceName() { - return (String)attributesMap.get("resourceInstanceName"); - } - - @Override - public String getResourceInvariantUUID() { - return (String)attributesMap.get("resourceInvariantUUID"); - } - - @Override - public String getResourceName() { - return (String)attributesMap.get("resourceName"); - } - - @Override - public String getResourceType() { - return (String)attributesMap.get("resourceType"); - } - - @Override - public String getResourceUUID() { - return (String)attributesMap.get("resourceUUID"); - } - - @Override - public String getResourceVersion() { - return (String)attributesMap.get("resourceVersion"); - } - - @Override - public String getResourceCustomizationUUID() { - return (String)attributesMap.get("resourceCustomizationUUID"); - } - - @Override - public String getSubcategory() { - return (String)attributesMap.get("subCategory"); - } - - @Override - public String getCategory() { - return (String)attributesMap.get("category"); - } - - @SuppressWarnings("unused") - @JsonAnySetter - public final void setAttribute(String attrName, Object attrValue) { - if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) { - this.attributesMap.put(attrName,attrValue); - } - } + @JsonIgnore + private Map<String, Object> attributesMap = new HashMap<>(); + + @JsonProperty("artifacts") + @JsonDeserialize(using = JsonArtifactInfoDeserializer.class) + private List<IArtifactInfo> artifacts; + + public JsonResourceInfo() { + + } + + @Override + public List<IArtifactInfo> getArtifacts() { + return artifacts; + } + + @Override + public String getResourceInstanceName() { + return (String) attributesMap.get("resourceInstanceName"); + } + + @Override + public String getResourceInvariantUUID() { + return (String) attributesMap.get("resourceInvariantUUID"); + } + + @Override + public String getResourceName() { + return (String) attributesMap.get("resourceName"); + } + + @Override + public String getResourceType() { + return (String) attributesMap.get("resourceType"); + } + + @Override + public String getResourceUUID() { + return (String) attributesMap.get("resourceUUID"); + } + + @Override + public String getResourceVersion() { + return (String) attributesMap.get("resourceVersion"); + } + + @Override + public String getResourceCustomizationUUID() { + return (String) attributesMap.get("resourceCustomizationUUID"); + } + + @Override + public String getSubcategory() { + return (String) attributesMap.get("subCategory"); + } + + @Override + public String getCategory() { + return (String) attributesMap.get("category"); + } + + @SuppressWarnings("unused") + @JsonAnySetter + public final void setAttribute(String attrName, Object attrValue) { + if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) { + this.attributesMap.put(attrName, attrValue); + } + } } diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfoDeserializer.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfoDeserializer.java index 5b18a2cbc9..b1cf82af63 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfoDeserializer.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfoDeserializer.java @@ -30,14 +30,15 @@ import org.codehaus.jackson.map.JsonDeserializer; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.type.TypeReference; -public class JsonResourceInfoDeserializer extends JsonDeserializer<List<JsonResourceInfo>>{ +public class JsonResourceInfoDeserializer extends JsonDeserializer<List<JsonResourceInfo>> { - @Override - public List<JsonResourceInfo> deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - List<JsonResourceInfo> jsonResourceInfoList = new ObjectMapper().readValue(jp, new TypeReference<List<JsonResourceInfo>>(){}); - - return jsonResourceInfoList; - } + @Override + public List<JsonResourceInfo> deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + List<JsonResourceInfo> jsonResourceInfoList = new ObjectMapper().readValue(jp, new TypeReference<List<JsonResourceInfo>>() { + }); + + return jsonResourceInfoList; + } } diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonVfModuleMetaData.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonVfModuleMetaData.java index 08d9895a53..08fd140bda 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonVfModuleMetaData.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonVfModuleMetaData.java @@ -31,53 +31,53 @@ import org.openecomp.sdc.api.notification.IVfModuleMetadata; public class JsonVfModuleMetaData implements IVfModuleMetadata { - @JsonProperty("artifacts") - private List<String> artifacts; - - @JsonIgnore - private Map<String,Object> attributesMap = new HashMap<>(); - - @Override - public List<String> getArtifacts() { - return artifacts; - } + @JsonProperty("artifacts") + private List<String> artifacts; - @Override - public String getVfModuleModelDescription() { - return (String)attributesMap.get("vfModuleModelDescription"); - } + @JsonIgnore + private Map<String, Object> attributesMap = new HashMap<>(); - @Override - public String getVfModuleModelInvariantUUID() { - return (String)attributesMap.get("vfModuleModelInvariantUUID"); - } + @Override + public List<String> getArtifacts() { + return artifacts; + } - @Override - public String getVfModuleModelName() { - return (String)attributesMap.get("vfModuleModelName"); - } + @Override + public String getVfModuleModelDescription() { + return (String) attributesMap.get("vfModuleModelDescription"); + } - @Override - public String getVfModuleModelUUID() { - return (String)attributesMap.get("vfModuleModelUUID"); - } + @Override + public String getVfModuleModelInvariantUUID() { + return (String) attributesMap.get("vfModuleModelInvariantUUID"); + } - @Override - public String getVfModuleModelVersion() { - return (String)attributesMap.get("vfModuleModelVersion"); - } + @Override + public String getVfModuleModelName() { + return (String) attributesMap.get("vfModuleModelName"); + } - @Override - public boolean isBase() { - return (boolean)attributesMap.get("isBase"); - } - - @SuppressWarnings("unused") - @JsonAnySetter - public final void setAttribute(String attrName, Object attrValue) { - if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) { - this.attributesMap.put(attrName,attrValue); - } - } + @Override + public String getVfModuleModelUUID() { + return (String) attributesMap.get("vfModuleModelUUID"); + } + + @Override + public String getVfModuleModelVersion() { + return (String) attributesMap.get("vfModuleModelVersion"); + } + + @Override + public boolean isBase() { + return (boolean) attributesMap.get("isBase"); + } + + @SuppressWarnings("unused") + @JsonAnySetter + public final void setAttribute(String attrName, Object attrValue) { + if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) { + this.attributesMap.put(attrName, attrValue); + } + } } |