Improve test coverage 47/118547/2
authorvasraz <vasyl.razinkov@est.tech>
Thu, 25 Feb 2021 20:30:39 +0000 (20:30 +0000)
committerChristophe Closset <christophe.closset@intl.att.com>
Fri, 26 Feb 2021 13:18:29 +0000 (13:18 +0000)
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3490
Change-Id: Idb71d433834a8612a5434c84c7f0fdef5573cea2

asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMock.java
asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMockTest.java [deleted file]
catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/IDistributionEngine.java
catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/DistributionEngineMock.java
catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FetchContextTest.java [deleted file]

index dde7f6a..7b90e75 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
 package org.openecomp.sdc.asdctool.migration.config.mocks;
 
 import org.openecomp.sdc.be.components.distribution.engine.IDistributionEngine;
-import org.openecomp.sdc.be.components.distribution.engine.INotificationData;
-import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
 import org.springframework.stereotype.Component;
 
-import java.util.List;
-
 @Component("distributionEngine")
 public class DistributionEngineMock implements IDistributionEngine {
-    @Override
-    public boolean isActive() {
-        return false;
-    }
-
-    @Override
-    public ActionStatus notifyService(String distributionId, Service service, INotificationData notificationData, String envName, User modifier) {
-        return null;
-    }
-
-    @Override
-    public ActionStatus notifyService(String distributionId, Service service, INotificationData notificationData, String envId, String envName, User modifier) {
-        return null;
-    }
-
-    @Override
-    public StorageOperationStatus isEnvironmentAvailable(String envName) {
-        return null;
-    }
-
-    @Override
-    public StorageOperationStatus isEnvironmentAvailable() {
-        return null;
-    }
-
-    @Override
-    public void disableEnvironment(String envName) {
-
-    }
-
-    @Override
-    public StorageOperationStatus isReadyForDistribution(String envName) {
-        return null;
-    }
-
-    @Override
-    public INotificationData buildServiceForDistribution(Service service, String distributionId, String workloadContext) {
-        return null;
-    }
-
-    @Override
-    public OperationalEnvironmentEntry getEnvironmentById(String opEnvId) {
-        return null;
-    }
-
-    @Override
-    public OperationalEnvironmentEntry getEnvironmentByDmaapUebAddress(List<String> dmaapUebAddress) {
-        return null;
-    }
 
 }
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMockTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/config/mocks/DistributionEngineMockTest.java
deleted file mode 100644 (file)
index 4c6f448..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 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.openecomp.sdc.asdctool.migration.config.mocks;
-
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.openecomp.sdc.be.components.distribution.engine.INotificationData;
-import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
-
-@Ignore("This class does not test anything, there is not a single assertion and the code with reflection fails")
-public class DistributionEngineMockTest {
-
-    private DistributionEngineMock createTestSubject() {
-        return new DistributionEngineMock();
-    }
-
-    @Test
-    public void testIsActive() throws Exception {
-        DistributionEngineMock testSubject;
-        boolean result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.isActive();
-        Assert.assertNotNull(result);
-    }
-
-    @Test
-    public void testNotifyService() throws Exception {
-        DistributionEngineMock testSubject;
-        String distributionId = "";
-        Service service = null;
-        INotificationData notificationData = null;
-        String envName = "";
-        String userId = "";
-        ActionStatus result;
-        User modifierName = new User();
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.notifyService(distributionId, service, notificationData, envName, userId, modifierName);
-        Assert.assertNotNull(result);
-    }
-
-    @Test
-    public void testNotifyService_1() throws Exception {
-        DistributionEngineMock testSubject;
-        String distributionId = "";
-        Service service = null;
-        INotificationData notificationData = null;
-        String envId = "";
-        String envName = "";
-        String userId = "";
-        User modifierName = new User();
-        ActionStatus result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.notifyService(distributionId, service, notificationData, envId, envName,
-            modifierName);
-        Assert.assertNotNull(result);
-    }
-
-    @Test
-    public void testIsEnvironmentAvailable() throws Exception {
-        DistributionEngineMock testSubject;
-        String envName = "";
-        StorageOperationStatus result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.isEnvironmentAvailable(envName);
-        Assert.assertNotNull(result);
-    }
-
-    @Test
-    public void testIsEnvironmentAvailable_1() throws Exception {
-        DistributionEngineMock testSubject;
-        StorageOperationStatus result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.isEnvironmentAvailable();
-        Assert.assertNotNull(result);
-    }
-
-    @Test
-    public void testDisableEnvironment() throws Exception {
-        DistributionEngineMock testSubject;
-        String envName = "";
-
-        // default test
-        testSubject = createTestSubject();
-        testSubject.disableEnvironment(envName);
-    }
-
-    @Test
-    public void testIsReadyForDistribution() throws Exception {
-        DistributionEngineMock testSubject;
-        Service service = null;
-        String envName = "";
-        StorageOperationStatus result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.isReadyForDistribution(envName);
-        Assert.assertNotNull(result);
-    }
-
-    @Test
-    public void testBuildServiceForDistribution() throws Exception {
-        DistributionEngineMock testSubject;
-        Service service = null;
-        String distributionId = "";
-        String workloadContext = "";
-        INotificationData result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.buildServiceForDistribution(service, distributionId, workloadContext);
-        Assert.assertNotNull(result);
-    }
-
-    @Test
-    public void testGetEnvironmentById() throws Exception {
-        DistributionEngineMock testSubject;
-        String opEnvId = "";
-        OperationalEnvironmentEntry result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.getEnvironmentById(opEnvId);
-        Assert.assertNotNull(result);
-    }
-}
index 1c58112..2136463 100644 (file)
 
 package org.openecomp.sdc.be.components.distribution.engine;
 
+import java.util.List;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.model.Service;
 import org.openecomp.sdc.be.model.User;
 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
 import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
 
-import java.util.List;
-
 public interface IDistributionEngine {
 
-    boolean isActive();
+    default boolean isActive() {
+        return false;
+    }
 
-    ActionStatus notifyService(String distributionId, Service service, INotificationData notificationData, String envName, User modifier);
+    default ActionStatus notifyService(String distributionId, Service service, INotificationData notificationData, String envName, User modifier) {
+        return null;
+    }
 
-    ActionStatus notifyService(String distributionId, Service service, INotificationData notificationData, String envId, String envName, User modifier);
+    default ActionStatus notifyService(String distributionId, Service service, INotificationData notificationData, String envId, String envName,
+                                       User modifier) {
+        return null;
+    }
 
-    StorageOperationStatus isEnvironmentAvailable(String envName);
+    default StorageOperationStatus isEnvironmentAvailable(String envName) {
+        return null;
+    }
 
-    StorageOperationStatus isEnvironmentAvailable();
+    default StorageOperationStatus isEnvironmentAvailable() {
+        return null;
+    }
 
     /**
      * Currently, it used for tests. For real implementation we need cancel the initialization task and the polling task.
      *
      * @param envName
      */
-    void disableEnvironment(String envName);
+    default void disableEnvironment(String envName) {
+    }
 
-    StorageOperationStatus isReadyForDistribution(String envName);
+    default StorageOperationStatus isReadyForDistribution(String envName) {
+        return null;
+    }
 
-    INotificationData buildServiceForDistribution(Service service, String distributionId, String workloadContext);
+    default INotificationData buildServiceForDistribution(Service service, String distributionId, String workloadContext) {
+        return null;
+    }
 
-    OperationalEnvironmentEntry getEnvironmentById(String opEnvId);
+    default OperationalEnvironmentEntry getEnvironmentById(String opEnvId) {
+        return null;
+    }
 
-    OperationalEnvironmentEntry getEnvironmentByDmaapUebAddress(List<String> dmaapUebAddress);
+    default OperationalEnvironmentEntry getEnvironmentByDmaapUebAddress(List<String> dmaapUebAddress) {
+        return null;
+    }
 }
index 8ec71ad..6bdc1e1 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
 package org.openecomp.sdc.be.components.path.beans;
 
 import org.openecomp.sdc.be.components.distribution.engine.IDistributionEngine;
-import org.openecomp.sdc.be.components.distribution.engine.INotificationData;
-import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
-
-import java.util.List;
 
 public class DistributionEngineMock implements IDistributionEngine {
-    @Override
-    public boolean isActive() {
-        return false;
-    }
-
-    @Override
-    public ActionStatus notifyService(String distributionId, Service service, INotificationData notificationData, String envName, User modifier) {
-        return null;
-    }
-
-    @Override
-    public ActionStatus notifyService(String distributionId, Service service, INotificationData notificationData, String envId, String envName, User modifier) {
-        return null;
-    }
-
-    @Override
-    public StorageOperationStatus isEnvironmentAvailable(String envName) {
-        return null;
-    }
-
-    @Override
-    public StorageOperationStatus isEnvironmentAvailable() {
-        return null;
-    }
-
-    @Override
-    public void disableEnvironment(String envName) {
-
-    }
-
-    @Override
-    public StorageOperationStatus isReadyForDistribution(String envName) {
-        return null;
-    }
-
-    @Override
-    public INotificationData buildServiceForDistribution(Service service, String distributionId, String workloadContext) {
-        return null;
-    }
-
-    @Override
-    public OperationalEnvironmentEntry getEnvironmentById(String opEnvId) {
-        return null;
-    }
-
-    @Override
-    public OperationalEnvironmentEntry getEnvironmentByDmaapUebAddress(List<String> dmaapUebAddress) {
-        return null;
-    }
 
 }
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FetchContextTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FetchContextTest.java
deleted file mode 100644 (file)
index 431f8ec..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2020 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.openecomp.sdc.be.dao.model;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-//import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class FetchContextTest {
-       @Ignore
-       @Test 
-       public void shouldHaveValidGettersAndSetters(){
-               //assertThat(FetchContextTest.class, hasValidGettersAndSetters());
-               assertTrue(false);
-       }
-}
\ No newline at end of file