From a4df7bfbef1e4a51c21ee323e6d69df490bea196 Mon Sep 17 00:00:00 2001 From: Francis Toth Date: Thu, 25 Jun 2020 07:45:19 -0400 Subject: Fix typo in package name and classes Signed-off-by: Francis Toth Change-Id: I55a6efeb4a0c2b4734dc3a091afbc6295599c74b Issue-ID: SDC-2499 --- .../impl/validator/ArtifactToolBLTest.java | 2 +- .../impl/validator/ValidationToolBLTest.java | 4 +- .../config/ValidationToolConfigurationTest.java | 14 ++-- .../ArtifactValidatorExecutorContract.java | 75 ---------------------- .../IArtifactValidatorExecutorContract.java | 50 --------------- .../NodeToscaArtifactsValidatorExecutorTest.java | 36 ----------- ...ServiceToscaArtifactsValidatorExecutorTest.java | 36 ----------- .../executers/ServiceValidatorExecuterTest.java | 48 -------------- .../TopologyTemplateValidatorExecuterTest.java | 65 ------------------- .../VFToscaArtifactValidatorExecutorTest.java | 36 ----------- .../executers/VfValidatorExecuterTest.java | 53 --------------- .../ArtifactValidatorExecutorContract.java | 75 ++++++++++++++++++++++ .../IArtifactValidatorExecutorContract.java | 50 +++++++++++++++ .../NodeToscaArtifactsValidatorExecutorTest.java | 36 +++++++++++ ...ServiceToscaArtifactsValidatorExecutorTest.java | 36 +++++++++++ .../executor/ServiceValidatorExecutorTest.java | 48 ++++++++++++++ .../TopologyTemplateValidatorExecutorTest.java | 65 +++++++++++++++++++ .../VFToscaArtifactValidatorExecutorTest.java | 36 +++++++++++ .../executor/VfValidatorExecutorTest.java | 53 +++++++++++++++ 19 files changed, 409 insertions(+), 409 deletions(-) delete mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecutorContract.java delete mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecutorContract.java delete mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecutorTest.java delete mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java delete mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java delete mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java delete mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java delete mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/IArtifactValidatorExecutorContract.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutorTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutorTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceValidatorExecutorTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/TopologyTemplateValidatorExecutorTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutorTest.java create mode 100644 asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VfValidatorExecutorTest.java (limited to 'asdctool/src/test/java/org') diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java index 47952f8d5c..138629b113 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java @@ -25,7 +25,7 @@ import static org.mockito.Mockito.mock; import java.util.ArrayList; import java.util.LinkedList; import org.junit.Test; -import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecutor; +import org.openecomp.sdc.asdctool.impl.validator.executor.NodeToscaArtifactsValidatorExecutor; import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java index ddea391ab1..74a252c5aa 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java @@ -21,7 +21,7 @@ package org.openecomp.sdc.asdctool.impl.validator; import org.junit.Test; -import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceValidatorExecuter; +import org.openecomp.sdc.asdctool.impl.validator.executor.ServiceValidatorExecutor; import org.openecomp.sdc.asdctool.impl.validator.report.Report; import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; @@ -44,7 +44,7 @@ public class ValidationToolBLTest { JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); ValidationToolBL testSubject = createTestSubject(); testSubject.validators = new LinkedList<>(); - testSubject.validators.add(new ServiceValidatorExecuter(janusGraphDaoMock)); + testSubject.validators.add(new ServiceValidatorExecutor(janusGraphDaoMock)); Report report = Report.make(); testSubject.validateAll(report, makeTxtFile(makeConsoleWriter())); } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java index 1903f0f1e7..47798f6777 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java @@ -23,11 +23,11 @@ package org.openecomp.sdc.asdctool.impl.validator.config; import org.junit.Test; import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL; import org.openecomp.sdc.asdctool.impl.validator.ValidationToolBL; -import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecutor; -import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceToscaArtifactsValidatorExecutor; -import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceValidatorExecuter; -import org.openecomp.sdc.asdctool.impl.validator.executers.VFToscaArtifactValidatorExecutor; -import org.openecomp.sdc.asdctool.impl.validator.executers.VfValidatorExecuter; +import org.openecomp.sdc.asdctool.impl.validator.executor.NodeToscaArtifactsValidatorExecutor; +import org.openecomp.sdc.asdctool.impl.validator.executor.ServiceToscaArtifactsValidatorExecutor; +import org.openecomp.sdc.asdctool.impl.validator.executor.ServiceValidatorExecutor; +import org.openecomp.sdc.asdctool.impl.validator.executor.VFToscaArtifactValidatorExecutor; +import org.openecomp.sdc.asdctool.impl.validator.executor.VfValidatorExecutor; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ArtifactValidationUtils; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifactValidationTask; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.VfArtifactValidationTask; @@ -57,7 +57,7 @@ public class ValidationToolConfigurationTest { @Test public void testBasicServiceValidator() { ValidationToolConfiguration testSubject; - ServiceValidatorExecuter result; + ServiceValidatorExecutor result; JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); // default test @@ -111,7 +111,7 @@ public class ValidationToolConfigurationTest { @Test public void testBasicVfValidator() { ValidationToolConfiguration testSubject; - VfValidatorExecuter result; + VfValidatorExecutor result; JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); // default test diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecutorContract.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecutorContract.java deleted file mode 100644 index 8564bb8251..0000000000 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecutorContract.java +++ /dev/null @@ -1,75 +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.impl.validator.executers; - -import static org.mockito.Mockito.mock; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; -import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; -import org.testng.Assert; - -public interface ArtifactValidatorExecutorContract { - - ArtifactValidatorExecutor createTestSubject( - JanusGraphDao janusGraphDao, - ToscaOperationFacade toscaOperationFacade - ); - - @Test - default void testGetVerticesToValidate() { - JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); - ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class); - final ArtifactValidatorExecutor testSubject = createTestSubject(janusGraphDaoMock, toscaOperationFacade); - - VertexTypeEnum type = null; - Map hasProps = null; - Assertions.assertThrows(NullPointerException.class, () -> - testSubject.getVerticesToValidate(type, hasProps) - ); - } - - @Test - default void testValidate() { - JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); - ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class); - final ArtifactValidatorExecutor testSubject = createTestSubject(janusGraphDaoMock, toscaOperationFacade); - - LinkedList linkedList = new LinkedList(); - linkedList.add(new Resource()); - - Map> vertices = new HashMap<>(); - vertices.put("stam", linkedList); - - // Initially no outputFilePath was passed to this function (hence it is set to null) - // TODO: Fix this null and see if the argument is used by this function - Assert.assertFalse(testSubject.validate(vertices, null)); - } -} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecutorContract.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecutorContract.java deleted file mode 100644 index 39a1bbef0c..0000000000 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecutorContract.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2020 Bell 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.impl.validator.executers; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; -import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; - -import static org.mockito.Mockito.mock; - -public abstract class IArtifactValidatorExecutorContract { - - protected abstract IArtifactValidatorExecutor createTestSubject( - JanusGraphDao janusGraphDao, - ToscaOperationFacade toscaOperationFacade - ); - - private IArtifactValidatorExecutor createTestSubject() { - return createTestSubject(mock(JanusGraphDao.class), mock(ToscaOperationFacade.class)); - } - - @Test - public void testExecuteValidations() { - Assertions.assertThrows(NullPointerException.class, () -> - // Initially no outputFilePath was passed to this function (hence it is set to null) - // TODO: Fix this null and see if the argument is used by this function - createTestSubject().executeValidations(null) - ); - } -} - diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecutorTest.java deleted file mode 100644 index 3870a98d78..0000000000 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecutorTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2020 Bell 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.impl.validator.executers; - -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; -import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; - -public class NodeToscaArtifactsValidatorExecutorTest - extends IArtifactValidatorExecutorContract implements ArtifactValidatorExecutorContract { - - @Override - public NodeToscaArtifactsValidatorExecutor createTestSubject( - JanusGraphDao janusGraphDao, - ToscaOperationFacade toscaOperationFacade - ) { - return new NodeToscaArtifactsValidatorExecutor(janusGraphDao, toscaOperationFacade); - } -} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java deleted file mode 100644 index 7998c52ea4..0000000000 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java +++ /dev/null @@ -1,36 +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.impl.validator.executers; - -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; -import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; - -public class ServiceToscaArtifactsValidatorExecutorTest - extends IArtifactValidatorExecutorContract implements ArtifactValidatorExecutorContract { - - @Override - public ServiceToscaArtifactsValidatorExecutor createTestSubject( - JanusGraphDao janusGraphDao, - ToscaOperationFacade toscaOperationFacade - ) { - return new ServiceToscaArtifactsValidatorExecutor(janusGraphDao, toscaOperationFacade); - } -} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java deleted file mode 100644 index 41fb048757..0000000000 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java +++ /dev/null @@ -1,48 +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.impl.validator.executers; - -import static org.mockito.Mockito.mock; -import static org.openecomp.sdc.asdctool.impl.validator.report.ReportFile.makeTxtFile; -import static org.openecomp.sdc.asdctool.impl.validator.report.ReportFileWriterTestFactory.makeConsoleWriter; - -import org.junit.Test; -import org.openecomp.sdc.asdctool.impl.validator.report.Report; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; - -public class ServiceValidatorExecuterTest { - - private ServiceValidatorExecuter createTestSubject() { - JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); - return new ServiceValidatorExecuter(janusGraphDaoMock); - } - - @Test - public void testGetName() { - createTestSubject().getName(); - } - - @Test(expected = NullPointerException.class) - public void testExecuteValidations() { - Report report = Report.make(); - createTestSubject().executeValidations(report, makeTxtFile(makeConsoleWriter())); - } -} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java deleted file mode 100644 index d74aaa49a2..0000000000 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java +++ /dev/null @@ -1,65 +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.impl.validator.executers; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; - -import static org.mockito.Mockito.mock; - -public class TopologyTemplateValidatorExecuterTest { - - private TopologyTemplateValidatorExecuter createTestSubject() { - JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); - return new TopologyTemplateValidatorExecuter(janusGraphDaoMock); - } - - @Test - public void testSetName() { - TopologyTemplateValidatorExecuter testSubject; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setName(name); - } - - @Test - public void testGetName() { - TopologyTemplateValidatorExecuter testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getName(); - } - - @Test - public void testGetVerticesToValidate() { - TopologyTemplateValidatorExecuter testSubject; - - // default test - testSubject = createTestSubject(); - Assertions.assertThrows(NullPointerException.class, () -> testSubject.getVerticesToValidate(ComponentTypeEnum.PRODUCT)); - } -} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java deleted file mode 100644 index ae6dcc1623..0000000000 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java +++ /dev/null @@ -1,36 +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.impl.validator.executers; - -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; -import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; - -public class VFToscaArtifactValidatorExecutorTest - extends IArtifactValidatorExecutorContract implements ArtifactValidatorExecutorContract { - - @Override - public VFToscaArtifactValidatorExecutor createTestSubject( - JanusGraphDao janusGraphDao, - ToscaOperationFacade toscaOperationFacade - ) { - return new VFToscaArtifactValidatorExecutor(janusGraphDao, toscaOperationFacade); - } -} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java deleted file mode 100644 index aa388f68b7..0000000000 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java +++ /dev/null @@ -1,53 +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.impl.validator.executers; - -import static org.mockito.Mockito.mock; -import static org.openecomp.sdc.asdctool.impl.validator.report.ReportFile.makeTxtFile; -import static org.openecomp.sdc.asdctool.impl.validator.report.ReportFileWriterTestFactory.makeConsoleWriter; - -import java.util.ArrayList; -import java.util.List; -import org.junit.Test; -import org.openecomp.sdc.asdctool.impl.validator.report.Report; -import org.openecomp.sdc.asdctool.impl.validator.tasks.VfValidationTask; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; - -public class VfValidatorExecuterTest { - - private VfValidatorExecuter createTestSubject() { - List validationTasks = new ArrayList<>(); - JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); - - return new VfValidatorExecuter(validationTasks, janusGraphDaoMock); - } - - @Test - public void testGetName() { - createTestSubject().getName(); - } - - @Test(expected = NullPointerException.class) - public void testExecuteValidations() { - Report report = Report.make(); - createTestSubject().executeValidations(report, makeTxtFile(makeConsoleWriter())); - } -} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java new file mode 100644 index 0000000000..3a325fcb09 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java @@ -0,0 +1,75 @@ +/*- + * ============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.impl.validator.executor; + +import static org.mockito.Mockito.mock; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.testng.Assert; + +public interface ArtifactValidatorExecutorContract { + + ArtifactValidatorExecutor createTestSubject( + JanusGraphDao janusGraphDao, + ToscaOperationFacade toscaOperationFacade + ); + + @Test + default void testGetVerticesToValidate() { + JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); + ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class); + final ArtifactValidatorExecutor testSubject = createTestSubject(janusGraphDaoMock, toscaOperationFacade); + + VertexTypeEnum type = null; + Map hasProps = null; + Assertions.assertThrows(NullPointerException.class, () -> + testSubject.getVerticesToValidate(type, hasProps) + ); + } + + @Test + default void testValidate() { + JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); + ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class); + final ArtifactValidatorExecutor testSubject = createTestSubject(janusGraphDaoMock, toscaOperationFacade); + + LinkedList linkedList = new LinkedList(); + linkedList.add(new Resource()); + + Map> vertices = new HashMap<>(); + vertices.put("stam", linkedList); + + // Initially no outputFilePath was passed to this function (hence it is set to null) + // TODO: Fix this null and see if the argument is used by this function + Assert.assertFalse(testSubject.validate(vertices, null)); + } +} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/IArtifactValidatorExecutorContract.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/IArtifactValidatorExecutorContract.java new file mode 100644 index 0000000000..35c6ac1173 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/IArtifactValidatorExecutorContract.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020 Bell 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.impl.validator.executor; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; + +import static org.mockito.Mockito.mock; + +public abstract class IArtifactValidatorExecutorContract { + + protected abstract IArtifactValidatorExecutor createTestSubject( + JanusGraphDao janusGraphDao, + ToscaOperationFacade toscaOperationFacade + ); + + private IArtifactValidatorExecutor createTestSubject() { + return createTestSubject(mock(JanusGraphDao.class), mock(ToscaOperationFacade.class)); + } + + @Test + public void testExecuteValidations() { + Assertions.assertThrows(NullPointerException.class, () -> + // Initially no outputFilePath was passed to this function (hence it is set to null) + // TODO: Fix this null and see if the argument is used by this function + createTestSubject().executeValidations(null) + ); + } +} + diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutorTest.java new file mode 100644 index 0000000000..b189b27d97 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutorTest.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020 Bell 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.impl.validator.executor; + +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; + +public class NodeToscaArtifactsValidatorExecutorTest + extends IArtifactValidatorExecutorContract implements ArtifactValidatorExecutorContract { + + @Override + public NodeToscaArtifactsValidatorExecutor createTestSubject( + JanusGraphDao janusGraphDao, + ToscaOperationFacade toscaOperationFacade + ) { + return new NodeToscaArtifactsValidatorExecutor(janusGraphDao, toscaOperationFacade); + } +} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutorTest.java new file mode 100644 index 0000000000..ef35d45e63 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutorTest.java @@ -0,0 +1,36 @@ +/*- + * ============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.impl.validator.executor; + +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; + +public class ServiceToscaArtifactsValidatorExecutorTest + extends IArtifactValidatorExecutorContract implements ArtifactValidatorExecutorContract { + + @Override + public ServiceToscaArtifactsValidatorExecutor createTestSubject( + JanusGraphDao janusGraphDao, + ToscaOperationFacade toscaOperationFacade + ) { + return new ServiceToscaArtifactsValidatorExecutor(janusGraphDao, toscaOperationFacade); + } +} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceValidatorExecutorTest.java new file mode 100644 index 0000000000..bc0eb25da2 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceValidatorExecutorTest.java @@ -0,0 +1,48 @@ +/*- + * ============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.impl.validator.executor; + +import static org.mockito.Mockito.mock; +import static org.openecomp.sdc.asdctool.impl.validator.report.ReportFile.makeTxtFile; +import static org.openecomp.sdc.asdctool.impl.validator.report.ReportFileWriterTestFactory.makeConsoleWriter; + +import org.junit.Test; +import org.openecomp.sdc.asdctool.impl.validator.report.Report; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; + +public class ServiceValidatorExecutorTest { + + private ServiceValidatorExecutor createTestSubject() { + JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); + return new ServiceValidatorExecutor(janusGraphDaoMock); + } + + @Test + public void testGetName() { + createTestSubject().getName(); + } + + @Test(expected = NullPointerException.class) + public void testExecuteValidations() { + Report report = Report.make(); + createTestSubject().executeValidations(report, makeTxtFile(makeConsoleWriter())); + } +} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/TopologyTemplateValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/TopologyTemplateValidatorExecutorTest.java new file mode 100644 index 0000000000..57e99c3865 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/TopologyTemplateValidatorExecutorTest.java @@ -0,0 +1,65 @@ +/*- + * ============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.impl.validator.executor; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; + +import static org.mockito.Mockito.mock; + +public class TopologyTemplateValidatorExecutorTest { + + private TopologyTemplateValidatorExecutor createTestSubject() { + JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); + return new TopologyTemplateValidatorExecutor(janusGraphDaoMock); + } + + @Test + public void testSetName() { + TopologyTemplateValidatorExecutor testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testGetName() { + TopologyTemplateValidatorExecutor testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testGetVerticesToValidate() { + TopologyTemplateValidatorExecutor testSubject; + + // default test + testSubject = createTestSubject(); + Assertions.assertThrows(NullPointerException.class, () -> testSubject.getVerticesToValidate(ComponentTypeEnum.PRODUCT)); + } +} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutorTest.java new file mode 100644 index 0000000000..3beec33e50 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutorTest.java @@ -0,0 +1,36 @@ +/*- + * ============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.impl.validator.executor; + +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; + +public class VFToscaArtifactValidatorExecutorTest + extends IArtifactValidatorExecutorContract implements ArtifactValidatorExecutorContract { + + @Override + public VFToscaArtifactValidatorExecutor createTestSubject( + JanusGraphDao janusGraphDao, + ToscaOperationFacade toscaOperationFacade + ) { + return new VFToscaArtifactValidatorExecutor(janusGraphDao, toscaOperationFacade); + } +} diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VfValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VfValidatorExecutorTest.java new file mode 100644 index 0000000000..c40f660d45 --- /dev/null +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VfValidatorExecutorTest.java @@ -0,0 +1,53 @@ +/*- + * ============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.impl.validator.executor; + +import static org.mockito.Mockito.mock; +import static org.openecomp.sdc.asdctool.impl.validator.report.ReportFile.makeTxtFile; +import static org.openecomp.sdc.asdctool.impl.validator.report.ReportFileWriterTestFactory.makeConsoleWriter; + +import java.util.ArrayList; +import java.util.List; +import org.junit.Test; +import org.openecomp.sdc.asdctool.impl.validator.report.Report; +import org.openecomp.sdc.asdctool.impl.validator.tasks.VfValidationTask; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; + +public class VfValidatorExecutorTest { + + private VfValidatorExecutor createTestSubject() { + List validationTasks = new ArrayList<>(); + JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class); + + return new VfValidatorExecutor(validationTasks, janusGraphDaoMock); + } + + @Test + public void testGetName() { + createTestSubject().getName(); + } + + @Test(expected = NullPointerException.class) + public void testExecuteValidations() { + Report report = Report.make(); + createTestSubject().executeValidations(report, makeTxtFile(makeConsoleWriter())); + } +} -- cgit 1.2.3-korg