Add unit tests to increase the sonar coverage
[aai/model-loader.git] / src / test / java / org / onap / aai / modelloader / notification / TestConfiguration.java
diff --git a/src/test/java/org/onap/aai/modelloader/notification/TestConfiguration.java b/src/test/java/org/onap/aai/modelloader/notification/TestConfiguration.java
new file mode 100644 (file)
index 0000000..cf971a1
--- /dev/null
@@ -0,0 +1,295 @@
+/**\r
+ * ============LICENSE_START=======================================================\r
+ * org.onap.aai\r
+ * ================================================================================\r
+ * Copyright © 2017 AT&T Intellectual Property.\r
+ * Copyright © 2017 Amdocs\r
+ * All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ *\r
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
+ */\r
+package org.onap.aai.modelloader.notification;\r
+\r
+import org.openecomp.sdc.api.consumer.IConfiguration;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+public class TestConfiguration implements IConfiguration{\r
+\r
+\r
+    private String asdcAddress;\r
+    private String user;\r
+    private String password;\r
+    private int pollingInterval = 15;\r
+    private int pollingTimeout = 15;\r
+    private List<String> relevantArtifactTypes;\r
+    private String consumerGroup;\r
+    private String environmentName;\r
+    private String comsumerID;\r
+    private String keyStorePath;\r
+    private String keyStorePassword;\r
+    private boolean activateServerTLSAuth;\r
+    private boolean isFilterInEmptyResources;\r
+    private boolean useHttpsWithDmaap;\r
+\r
+    public TestConfiguration(IConfiguration other) {\r
+        this.asdcAddress = other.getAsdcAddress();\r
+        this.comsumerID = other.getConsumerID();\r
+        this.consumerGroup = other.getConsumerGroup();\r
+        this.environmentName = other.getEnvironmentName();\r
+        this.password = other.getPassword();\r
+        this.pollingInterval = other.getPollingInterval();\r
+        this.pollingTimeout = other.getPollingTimeout();\r
+        this.relevantArtifactTypes = other.getRelevantArtifactTypes();\r
+        this.user = other.getUser();\r
+        this.keyStorePath = other.getKeyStorePath();\r
+        this.keyStorePassword = other.getKeyStorePassword();\r
+        this.activateServerTLSAuth = other.activateServerTLSAuth();\r
+        this.isFilterInEmptyResources = other.isFilterInEmptyResources();\r
+    }\r
+\r
+    public TestConfiguration() {\r
+        this.asdcAddress = "localhost:8443";\r
+        this.comsumerID = "mso-123456";\r
+        this.consumerGroup = "mso-group";\r
+        this.environmentName = "PROD";\r
+        this.password = "password";\r
+        this.pollingInterval = 20;\r
+        this.pollingTimeout = 20;\r
+        this.relevantArtifactTypes = new ArrayList<String>();\r
+        this.relevantArtifactTypes.add("HEAT");\r
+        this.user = "mso-user";\r
+        this.keyStorePath = "etc/asdc-client.jks";\r
+        this.keyStorePassword = "Aa123456";\r
+        this.activateServerTLSAuth = false;\r
+        this.isFilterInEmptyResources = false;\r
+    }\r
+\r
+    @Override\r
+    public String getAsdcAddress() {\r
+        return asdcAddress;\r
+    }\r
+\r
+    @Override\r
+    public String getUser() {\r
+        return user;\r
+    }\r
+\r
+    @Override\r
+    public String getPassword() {\r
+        return password;\r
+    }\r
+\r
+    @Override\r
+    public int getPollingInterval() {\r
+        return pollingInterval;\r
+    }\r
+\r
+    @Override\r
+    public int getPollingTimeout() {\r
+        return pollingTimeout;\r
+    }\r
+\r
+    @Override\r
+    public List<String> getRelevantArtifactTypes() {\r
+        return relevantArtifactTypes;\r
+    }\r
+\r
+    @Override\r
+    public String getConsumerGroup() {\r
+        return consumerGroup;\r
+    }\r
+\r
+    @Override\r
+    public String getEnvironmentName() {\r
+        return environmentName;\r
+    }\r
+\r
+    @Override\r
+    public String getConsumerID() {\r
+        return comsumerID;\r
+    }\r
+\r
+    @Override\r
+    public String getKeyStorePath() {\r
+        return keyStorePath;\r
+    }\r
+\r
+    @Override\r
+    public String getKeyStorePassword() {\r
+        return keyStorePassword;\r
+    }\r
+\r
+    public String getComsumerID() {\r
+        return comsumerID;\r
+    }\r
+\r
+    public void setComsumerID(String comsumerID) {\r
+        this.comsumerID = comsumerID;\r
+    }\r
+\r
+    public void setAsdcAddress(String asdcAddress) {\r
+        this.asdcAddress = asdcAddress;\r
+    }\r
+\r
+    public void setUser(String user) {\r
+        this.user = user;\r
+    }\r
+\r
+    public void setPassword(String password) {\r
+        this.password = password;\r
+    }\r
+\r
+    public void setPollingInterval(int pollingInterval) {\r
+        this.pollingInterval = pollingInterval;\r
+    }\r
+\r
+    public void setPollingTimeout(int pollingTimeout) {\r
+        this.pollingTimeout = pollingTimeout;\r
+    }\r
+\r
+    public void setRelevantArtifactTypes(List<String> relevantArtifactTypes) {\r
+        this.relevantArtifactTypes = relevantArtifactTypes;\r
+    }\r
+\r
+    public void setConsumerGroup(String consumerGroup) {\r
+        this.consumerGroup = consumerGroup;\r
+    }\r
+\r
+    public void setEnvironmentName(String environmentName) {\r
+        this.environmentName = environmentName;\r
+    }\r
+\r
+    public void setKeyStorePath(String keyStorePath) {\r
+        this.keyStorePath = keyStorePath;\r
+    }\r
+\r
+    public void setKeyStorePassword(String keyStorePassword) {\r
+        this.keyStorePassword = keyStorePassword;\r
+    }\r
+\r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = 1;\r
+        result = prime * result + ((asdcAddress == null) ? 0 : asdcAddress.hashCode());\r
+        result = prime * result + ((comsumerID == null) ? 0 : comsumerID.hashCode());\r
+        result = prime * result + ((consumerGroup == null) ? 0 : consumerGroup.hashCode());\r
+        result = prime * result + ((environmentName == null) ? 0 : environmentName.hashCode());\r
+        result = prime * result + ((password == null) ? 0 : password.hashCode());\r
+        result = prime * result + pollingInterval;\r
+        result = prime * result + pollingTimeout;\r
+        result = prime * result + ((relevantArtifactTypes == null) ? 0 : relevantArtifactTypes.hashCode());\r
+        result = prime * result + ((user == null) ? 0 : user.hashCode());\r
+        return result;\r
+    }\r
+\r
+    @Override\r
+    public boolean activateServerTLSAuth() {\r
+\r
+        return activateServerTLSAuth;\r
+    }\r
+\r
+    public void setactivateServerTLSAuth(boolean activateServerTLSAuth) {\r
+        this.activateServerTLSAuth = activateServerTLSAuth;\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if (this == obj)\r
+            return true;\r
+        if (obj == null)\r
+            return false;\r
+        if (getClass() != obj.getClass())\r
+            return false;\r
+        TestConfiguration other = (TestConfiguration) obj;\r
+        if (asdcAddress == null) {\r
+            if (other.asdcAddress != null)\r
+                return false;\r
+        } else if (!asdcAddress.equals(other.asdcAddress))\r
+            return false;\r
+        if (comsumerID == null) {\r
+            if (other.comsumerID != null)\r
+                return false;\r
+        } else if (!comsumerID.equals(other.comsumerID))\r
+            return false;\r
+        if (consumerGroup == null) {\r
+            if (other.consumerGroup != null)\r
+                return false;\r
+        } else if (!consumerGroup.equals(other.consumerGroup))\r
+            return false;\r
+        if (environmentName == null) {\r
+            if (other.environmentName != null)\r
+                return false;\r
+        } else if (!environmentName.equals(other.environmentName))\r
+            return false;\r
+        if (password == null) {\r
+            if (other.password != null)\r
+                return false;\r
+        } else if (!password.equals(other.password))\r
+            return false;\r
+        if (pollingInterval != other.pollingInterval)\r
+            return false;\r
+        if (pollingTimeout != other.pollingTimeout)\r
+            return false;\r
+        if (relevantArtifactTypes == null) {\r
+            if (other.relevantArtifactTypes != null)\r
+                return false;\r
+        } else if (!relevantArtifactTypes.equals(other.relevantArtifactTypes))\r
+            return false;\r
+        if (user == null) {\r
+            if (other.user != null)\r
+                return false;\r
+        } else if (!user.equals(other.user))\r
+            return false;\r
+        if (keyStorePath == null) {\r
+            if (other.keyStorePath != null)\r
+                return false;\r
+        } else if (!keyStorePath.equals(other.keyStorePath))\r
+            return false;\r
+        if (keyStorePassword == null) {\r
+            if (other.keyStorePassword != null)\r
+                return false;\r
+        } else if (!keyStorePassword.equals(other.keyStorePassword))\r
+            return false;\r
+\r
+        return true;\r
+    }\r
+\r
+    @Override\r
+    public String toString() {\r
+        return "TestConfiguration [asdcAddress=" + asdcAddress + ", user=" + user + ", password=" + password +\r
+                ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout +\r
+                ", relevantArtifactTypes=" + relevantArtifactTypes + ", consumerGroup=" + consumerGroup +\r
+                ", environmentName=" + environmentName + ", comsumerID=" + comsumerID + "]";\r
+    }\r
+\r
+    @Override\r
+    public boolean isFilterInEmptyResources() {\r
+        return isFilterInEmptyResources;\r
+    }\r
+\r
+\r
+    public void setFilterInEmptyResources(boolean isFilterInEmptyResources) {\r
+        this.isFilterInEmptyResources = isFilterInEmptyResources;\r
+    }\r
+\r
+    @Override\r
+    public Boolean isUseHttpsWithDmaap() {\r
+        return this.useHttpsWithDmaap;\r
+    }\r
+}\r