diff options
Diffstat (limited to 'src')
8 files changed, 0 insertions, 992 deletions
diff --git a/src/main/java/org/onap/clamp/clds/camel/CamelProxy.java b/src/main/java/org/onap/clamp/clds/camel/CamelProxy.java deleted file mode 100644 index f6265982b..000000000 --- a/src/main/java/org/onap/clamp/clds/camel/CamelProxy.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -package org.onap.clamp.clds.camel; - -import org.apache.camel.ExchangeProperty; - -/** - * This interface describes the CamelProxy parameters that must be passed to the - * Camel flow. - */ -@FunctionalInterface -public interface CamelProxy { - - /** - * This method is called when invoking a camel flow. - * - * @param actionCommand The action coming from the Clamp UI (like SUBMIT, UPDATE, - * DELETE, ...) - * @param modelProperties The Model properties created based on the BPMN Json and - * Properties Json - * @param modelBpmnProperties The Json with all the properties describing the flow - * @param modelName The model name - * @param controlName The control loop name - * @param docText The Global properties JSON containing YAML (coming from CLamp - * template) - * @param isTest Is a test or not (flag coming from the UI) - * @param userId The user ID coming from the UI - * @param isInsertTestEvent Is a test or not (flag coming from the UI) - * @param eventAction The latest event action in database (like CREATE, SUBMIT, ...) - * @return A string containing the result of the Camel flow execution - */ - String executeAction(@ExchangeProperty("actionCd") String actionCommand, - @ExchangeProperty("modelProp") String modelProperties, - @ExchangeProperty("modelBpmnProp") String modelBpmnProperties, - @ExchangeProperty("modelName") String modelName, @ExchangeProperty("controlName") String controlName, - @ExchangeProperty("docText") String docText, @ExchangeProperty("isTest") boolean isTest, - @ExchangeProperty("userid") String userId, @ExchangeProperty("isInsertTestEvent") boolean isInsertTestEvent, - @ExchangeProperty("eventAction") String eventAction); -} diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcArtifact.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcArtifact.java deleted file mode 100644 index f886ee644..000000000 --- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcArtifact.java +++ /dev/null @@ -1,109 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -package org.onap.clamp.clds.model.sdc; - -public class SdcArtifact { - - private String artifactName; - private String artifactType; - private String artifactUrl; - private String artifactDescription; - private String artifactTimeout; - private String artifactChecksum; - private String artifactUuid; - private String artifactVersion; - private String generatedFromUuid; - - public String getArtifactName() { - return artifactName; - } - - public void setArtifactName(String artifactName) { - this.artifactName = artifactName; - } - - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(String artifactType) { - this.artifactType = artifactType; - } - - public String getArtifactURL() { - return artifactUrl; - } - - public void setArtifactURL(String artifactURL) { - this.artifactUrl = artifactURL; - } - - public String getArtifactDescription() { - return artifactDescription; - } - - public void setArtifactDescription(String artifactDescription) { - this.artifactDescription = artifactDescription; - } - - public String getArtifactTimeout() { - return artifactTimeout; - } - - public void setArtifactTimeout(String artifactTimeout) { - this.artifactTimeout = artifactTimeout; - } - - public String getArtifactChecksum() { - return artifactChecksum; - } - - public void setArtifactChecksum(String artifactChecksum) { - this.artifactChecksum = artifactChecksum; - } - - public String getArtifactUUID() { - return artifactUuid; - } - - public void setArtifactUUID(String artifactUUID) { - this.artifactUuid = artifactUUID; - } - - public String getArtifactVersion() { - return artifactVersion; - } - - public void setArtifactVersion(String artifactVersion) { - this.artifactVersion = artifactVersion; - } - - public String getGeneratedFromUUID() { - return generatedFromUuid; - } - - public void setGeneratedFromUUID(String generatedFromUUID) { - this.generatedFromUuid = generatedFromUUID; - } -} diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java deleted file mode 100644 index 515e77dfe..000000000 --- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java +++ /dev/null @@ -1,171 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -package org.onap.clamp.clds.model.sdc; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -import java.math.BigDecimal; -import java.util.List; - -public class SdcResource implements Comparable<SdcResource> { - - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcResource.class); - protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - - private String resourceInstanceName; - private String resourceName; - private String resourceInvariantUUID; - private String resourceVersion; - private String resoucreType; - private String resourceUuid; - private List<SdcArtifact> artifacts; - - public String getResourceInstanceName() { - return resourceInstanceName; - } - - public void setResourceInstanceName(String resourceInstanceName) { - this.resourceInstanceName = resourceInstanceName; - } - - public String getResourceName() { - return resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public String getResourceInvariantUUID() { - return resourceInvariantUUID; - } - - public void setResourceInvariantUUID(String resourceInvUuid) { - this.resourceInvariantUUID = resourceInvUuid; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public String getResoucreType() { - return resoucreType; - } - - public void setResoucreType(String resoucreType) { - this.resoucreType = resoucreType; - } - - public String getResourceUUID() { - return resourceUuid; - } - - public void setResourceUUID(String resourceUUID) { - this.resourceUuid = resourceUUID; - } - - public List<SdcArtifact> getArtifacts() { - return artifacts; - } - - public void setArtifacts(List<SdcArtifact> artifacts) { - this.artifacts = artifacts; - } - - @Override - public int compareTo(SdcResource in) { - // Compares this object with the specified object for order. - // Returns a negative integer, zero, or a positive integer as this - // object is less than, equal to, or greater than the specified object. - - // first compare based on name - int rtn = resourceInstanceName.compareToIgnoreCase(in.resourceInstanceName); - - if (rtn == 0) { - BigDecimal myVersion = convertVersion(resourceVersion); - BigDecimal inVersion = convertVersion(in.resourceVersion); - rtn = myVersion.compareTo(inVersion); - } - return rtn; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode()); - result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - SdcResource other = (SdcResource) obj; - if (resourceInstanceName == null) { - if (other.resourceInstanceName != null) { - return false; - } - } else if (!resourceInstanceName.equals(other.resourceInstanceName)) { - return false; - } - if (resourceVersion == null) { - if (other.resourceVersion != null) { - return false; - } - } else if (!resourceVersion.equals(other.resourceVersion)) { - return false; - } - return true; - } - - /** - * Convert version String into a BigDecimal. - * - * @param versionText version - * @return version in BigDecimal - */ - private BigDecimal convertVersion(String versionText) { - BigDecimal rtn = BigDecimal.valueOf(0.0); - try { - rtn = new BigDecimal(versionText); - } catch (NumberFormatException nfe) { - logger.warn("SDC version=" + versionText + " is not decimal for name=" + resourceInstanceName); - } - return rtn; - } -} diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java deleted file mode 100644 index 47192a540..000000000 --- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java +++ /dev/null @@ -1,200 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -package org.onap.clamp.clds.model.sdc; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -import java.math.BigDecimal; - -public class SdcResourceBasicInfo implements Comparable<SdcResourceBasicInfo> { - - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcResourceBasicInfo.class); - protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - - private String uuid; - private String invariantUUID; - private String name; - private String version; - private String toscaModelURL; - private String category; - private String subCategory; - private String resourceType; - private String lifecycleState; - private String lastUpdaterUserId; - - @Override - public int compareTo(SdcResourceBasicInfo in) { - // Compares this object with the specified object for order. - // Returns a negative integer, zero, or a positive integer as this - // object is less than, equal to, or greater than the specified object. - // first compare based on name - int rtn = name.compareToIgnoreCase(in.name); - - if (rtn == 0) { - BigDecimal myVersion = convertVersion(version); - BigDecimal inVersion = convertVersion(in.version); - rtn = myVersion.compareTo(inVersion); - } - return rtn; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((version == null) ? 0 : version.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - SdcResourceBasicInfo other = (SdcResourceBasicInfo) obj; - if (name == null) { - if (other.name != null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - if (version == null) { - if (other.version != null) { - return false; - } - } else if (!version.equals(other.version)) { - return false; - } - return true; - } - - /** - * Convert version String into a BigDecimal. - * - * @param version version - * @return version in BigDecimal - */ - private BigDecimal convertVersion(String version) { - BigDecimal rtn = BigDecimal.valueOf(0.0); - try { - rtn = new BigDecimal(version); - } catch (NumberFormatException nfe) { - logger.warn("SDC version=" + version + " is not decimal for name=" + name); - } - return rtn; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getInvariantUUID() { - return invariantUUID; - } - - public void setInvariantUUID(String invariantUUID) { - this.invariantUUID = invariantUUID; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getToscaModelURL() { - return toscaModelURL; - } - - public void setToscaModelURL(String toscaModelURL) { - this.toscaModelURL = toscaModelURL; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getSubCategory() { - return subCategory; - } - - public void setSubCategory(String subCategory) { - this.subCategory = subCategory; - } - - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public String getLifecycleState() { - return lifecycleState; - } - - public void setLifecycleState(String lifecycleState) { - this.lifecycleState = lifecycleState; - } - - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } - - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } - - public EELFLogger getLOGGER() { - return logger; - } -} diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceDetail.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceDetail.java deleted file mode 100644 index e7265ff5d..000000000 --- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceDetail.java +++ /dev/null @@ -1,139 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -package org.onap.clamp.clds.model.sdc; - -import java.util.List; - -public class SdcServiceDetail { - - private String uuid; - private String invariantUUID; - private String name; - private String version; - private String toscaModelURL; - private String category; - private String lifecycleState; - private String lastUpdaterUserId; - private String distributionStatus; - private String lastUpdaterFullName; - private List<SdcResource> resources; - private List<SdcArtifact> artifacts; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getInvariantUUID() { - return invariantUUID; - } - - public void setInvariantUUID(String invariantUUID) { - this.invariantUUID = invariantUUID; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getToscaModelURL() { - return toscaModelURL; - } - - public void setToscaModelURL(String toscaModelURL) { - this.toscaModelURL = toscaModelURL; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getLifecycleState() { - return lifecycleState; - } - - public void setLifecycleState(String lifecycleState) { - this.lifecycleState = lifecycleState; - } - - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } - - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } - - public String getDistributionStatus() { - return distributionStatus; - } - - public void setDistributionStatus(String distributionStatus) { - this.distributionStatus = distributionStatus; - } - - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } - - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } - - public List<SdcResource> getResources() { - return resources; - } - - public void setResources(List<SdcResource> resources) { - this.resources = resources; - } - - public List<SdcArtifact> getArtifacts() { - return artifacts; - } - - public void setArtifacts(List<SdcArtifact> artifacts) { - this.artifacts = artifacts; - } - -} diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceInfo.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceInfo.java deleted file mode 100644 index bb9f3f8a5..000000000 --- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceInfo.java +++ /dev/null @@ -1,191 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -package org.onap.clamp.clds.model.sdc; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -import java.math.BigDecimal; - -public class SdcServiceInfo implements Comparable<SdcServiceInfo> { - - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcServiceInfo.class); - protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - - private String uuid; - private String invariantUUID; - private String name; - private String version; - private String toscaModelURL; - private String category; - private String lifecycleState; - private String lastUpdaterUserId; - private String distributionStatus; - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getInvariantUUID() { - return invariantUUID; - } - - public void setInvariantUUID(String invariantUUID) { - this.invariantUUID = invariantUUID; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getToscaModelURL() { - return toscaModelURL; - } - - public void setToscaModelURL(String toscaModelURL) { - this.toscaModelURL = toscaModelURL; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getLifecycleState() { - return lifecycleState; - } - - public void setLifecycleState(String lifecycleState) { - this.lifecycleState = lifecycleState; - } - - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } - - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } - - public String getDistributionStatus() { - return distributionStatus; - } - - public void setDistributionStatus(String distributionStatus) { - this.distributionStatus = distributionStatus; - } - - /** - * Compare using name and then version. Version is converted to a decimal. - */ - @Override - public int compareTo(SdcServiceInfo in) { - // Compares this object with the specified object for order. - // Returns a negative integer, zero, or a positive integer as this - // object is less than, equal to, or greater than the specified object. - // first compare based on name - int rtn = name.compareToIgnoreCase(in.name); - - if (rtn == 0) { - BigDecimal myVersion = convertVersion(version); - BigDecimal inVersion = convertVersion(in.version); - rtn = myVersion.compareTo(inVersion); - } - - return rtn; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((version == null) ? 0 : version.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - SdcServiceInfo other = (SdcServiceInfo) obj; - if (name == null) { - if (other.name != null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - if (version == null) { - if (other.version != null) { - return false; - } - } else if (!version.equals(other.version)) { - return false; - } - return true; - } - - /** - * Convert version String into a BigDecimal. - * - * @param versionText version - * @return version in BigDecimal - */ - private BigDecimal convertVersion(String versionText) { - try { - return new BigDecimal(versionText); - } catch (NumberFormatException nfe) { - logger.warn("SDC version=" + versionText + " is not decimal for name=" + name); - } - return BigDecimal.valueOf(0.0); - } - -} diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index 3a2cb0926..0e809112a 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -28,18 +28,12 @@ package org.onap.clamp.clds.service; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.google.gson.reflect.TypeToken; -import java.lang.reflect.Type; import java.util.Date; -import java.util.List; import javax.servlet.http.HttpServletRequest; -import org.apache.camel.Produce; -import org.onap.clamp.clds.camel.CamelProxy; import org.onap.clamp.clds.model.CldsInfo; -import org.onap.clamp.clds.model.sdc.SdcServiceInfo; import org.onap.clamp.clds.util.LoggingUtils; import org.onap.clamp.clds.util.ONAPLogConstants; import org.slf4j.event.Level; @@ -52,14 +46,6 @@ import org.springframework.stereotype.Component; */ @Component public class CldsService extends SecureServiceBase { - - /** - * The constant LIST_OF_SDC_SERVICE_INFO_TYPE. - */ - public static final Type LIST_OF_SDC_SERVICE_INFO_TYPE = new TypeToken<List<SdcServiceInfo>>() { - }.getType(); - @Produce(uri = "direct:processSubmit") - private CamelProxy camelProxy; /** * The constant securityLogger. */ diff --git a/src/test/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfoTest.java b/src/test/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfoTest.java deleted file mode 100644 index 5adb0647a..000000000 --- a/src/test/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfoTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - * Modifications copyright (c) 2018 Nokia - * ================================================================================ - * - */ - -package org.onap.clamp.clds.model.sdc; - -import org.assertj.core.api.Assertions; -import org.junit.Test; - -public class SdcResourceBasicInfoTest { - - @Test - public void testHashCode() { - SdcResourceBasicInfo sdc1a = new SdcResourceBasicInfo(); - sdc1a.setName("test1"); - sdc1a.setVersion("1.0"); - - SdcResourceBasicInfo sdc2 = new SdcResourceBasicInfo(); - sdc2.setName("test2"); - sdc2.setVersion("2.0"); - - SdcResourceBasicInfo sdc1b = new SdcResourceBasicInfo(); - sdc1b.setName("test1"); - sdc1b.setVersion("2.0"); - - Assertions.assertThat(sdc1a.hashCode()).isNotEqualTo(sdc1b.hashCode()); - Assertions.assertThat(sdc1b.hashCode()).isNotEqualTo(sdc2.hashCode()); - sdc1b.setVersion("1.0"); - Assertions.assertThat(sdc1a.hashCode()).isEqualTo(sdc1b.hashCode()); - - } - - @Test - public void testCompareTo() { - SdcResourceBasicInfo sdc1a = new SdcResourceBasicInfo(); - sdc1a.setName("test1"); - sdc1a.setVersion("1.0"); - - SdcResourceBasicInfo sdc1b = new SdcResourceBasicInfo(); - sdc1b.setName("test1"); - sdc1b.setVersion("2.0"); - - SdcResourceBasicInfo sdc2 = new SdcResourceBasicInfo(); - sdc2.setName("test2"); - sdc2.setVersion("2.0"); - - Assertions.assertThat(sdc1a.compareTo(sdc1b)).isEqualTo(-1); - Assertions.assertThat(sdc1b.compareTo(sdc1a)).isEqualTo(1); - Assertions.assertThat(sdc1a.compareTo(sdc1a)).isEqualTo(0); - Assertions.assertThat(sdc1a.compareTo(sdc2)).isEqualTo(-1); - } - - @Test - public void testEquals() { - SdcResourceBasicInfo sdc1a = new SdcResourceBasicInfo(); - sdc1a.setName("test1"); - sdc1a.setVersion("1.0"); - - SdcResourceBasicInfo sdc1b = new SdcResourceBasicInfo(); - sdc1b.setName("test1"); - sdc1b.setVersion("2.0"); - - SdcResourceBasicInfo sdc2 = new SdcResourceBasicInfo(); - sdc2.setName("test2"); - sdc2.setVersion("2.0"); - - Assertions.assertThat(sdc1a.equals(sdc1a)).isTrue(); - Assertions.assertThat(sdc1a.equals(sdc1b)).isFalse(); - - sdc1b.setVersion(null); - Assertions.assertThat(sdc1a.equals(sdc1b)).isFalse(); - sdc1b.setVersion("1.0"); - Assertions.assertThat(sdc1a.equals(sdc1b)).isTrue(); - sdc1a.setVersion(null); - sdc1b.setVersion(null); - Assertions.assertThat(sdc1a.equals(sdc1b)).isTrue(); - - sdc1b.setName(null); - Assertions.assertThat(sdc1a.equals(sdc1b)).isFalse(); - sdc1b.setName("test1"); - Assertions.assertThat(sdc1a.equals(sdc1b)).isTrue(); - sdc1a.setName(null); - sdc1b.setName(null); - Assertions.assertThat(sdc1a.equals(sdc1b)).isTrue(); - } - -} |