diff options
author | 2019-11-22 18:06:08 -0500 | |
---|---|---|
committer | 2019-11-26 21:32:38 +0000 | |
commit | 341db21b2ac0a14a1ed2b8bf7930914dda054bfe (patch) | |
tree | 113bba965b06cfe3a8af3a0a527d1a41c9faf0f9 /ms/sdclistener/application/src/test | |
parent | d274e5fc552cf9ae25500f504f0434981cf3accf (diff) |
Formatting Code base with ktlint
No Business logic change, just the code format.
Competible with IntelliJ: https://github.com/pinterest/ktlint#option-3
To format run: mvn process-sources -P format
Issue-ID: CCSDK-1947
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Change-Id: Ic9e9209fb7023d77f434693ad5a01229f8d09331
Diffstat (limited to 'ms/sdclistener/application/src/test')
4 files changed, 33 insertions, 20 deletions
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java index 1e6d7cbae..e08b6134c 100644 --- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java @@ -13,9 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.onap.ccsdk.cds.sdclistener; -import mockit.*; +import mockit.Expectations; +import mockit.Injectable; +import mockit.Mock; +import mockit.MockUp; +import mockit.Tested; +import mockit.VerificationsInOrder; import mockit.integration.junit4.JMockit; import org.junit.Test; import org.junit.runner.RunWith; @@ -36,11 +42,11 @@ public class SdcListenerClientTest { @Test public void testInitCdsClientSuccesfully(@Injectable IDistributionClient distributionClient, - @Injectable SdcListenerConfiguration configuration, - @Injectable SdcListenerNotificationCallback notification, - @Injectable SdcListenerDto sdcListenerDto) throws SdcListenerException { + @Injectable SdcListenerConfiguration configuration, + @Injectable SdcListenerNotificationCallback notification, + @Injectable SdcListenerDto sdcListenerDto) throws SdcListenerException { - //Arrange + //Arrange new MockUp<DistributionClientFactory>() { @Mock public IDistributionClient createDistributionClient() { @@ -70,6 +76,7 @@ public class SdcListenerClientTest { public IDistributionClientResult getResult() { return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, - DistributionActionResultEnum.SUCCESS.name()); + DistributionActionResultEnum.SUCCESS.name()); } + } diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java index 01ffe1ba9..26757a657 100644 --- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.onap.ccsdk.cds.sdclistener; -import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -23,6 +23,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import static org.junit.Assert.assertEquals; + @RunWith(SpringRunner.class) @EnableConfigurationProperties(SdcListenerConfiguration.class) @SpringBootTest(classes = {SdcListenerConfigurationTest.class}) @@ -45,4 +47,5 @@ public class SdcListenerConfigurationTest { assertEquals(listenerConfiguration.getConsumerID(), "cds-id-local"); assertEquals(listenerConfiguration.activateServerTLSAuth(), false); } + } diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java index 7a92c0040..8a4bb2224 100644 --- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.onap.ccsdk.cds.sdclistener.handler; import com.google.protobuf.ByteString; @@ -107,7 +108,6 @@ public class BluePrintProcessorHandlerTest { byte[] bytes = FileUtils.readFileToByteArray(file); FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build(); - return BluePrintUploadInput.newBuilder() .setCommonHeader(CommonHeader.newBuilder() .setRequestId(UUID.randomUUID().toString()) @@ -124,4 +124,5 @@ public class BluePrintProcessorHandlerTest { .setStatus(Status.newBuilder().setMessage(SUCCESS_MSG).setCode(200).build()) .build(); } + } diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java index 25b5098ab..5d25ac2bf 100644 --- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.onap.ccsdk.cds.sdclistener.service; import org.apache.commons.io.FileUtils; @@ -50,8 +51,8 @@ import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK; @RunWith(SpringRunner.class) @EnableConfigurationProperties({SdcListenerAuthClientInterceptor.class, - BluePrintProcesssorHandler.class, SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class, - SdcListenerConfiguration.class}) + BluePrintProcesssorHandler.class, SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class, + SdcListenerConfiguration.class}) @SpringBootTest(classes = {ListenerServiceImplTest.class}) public class ListenerServiceImplTest { @@ -63,7 +64,6 @@ public class ListenerServiceImplTest { private static final String DISTRIBUTION_ID = "1"; private static final String URL = "/sdc/v1/artifact"; - private String csarArchivePath; private Path tempDirectoryPath; @@ -105,18 +105,18 @@ public class ListenerServiceImplTest { Mockito.when(listenerDto.getDistributionId()).thenReturn(DISTRIBUTION_ID); Mockito.when(listenerDto.getArtifactUrl()).thenReturn(URL); Mockito.doCallRealMethod().when(status) - .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT); + .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT); // Act listenerService.extractBluePrint(WRONG_CSAR_SAMPLE, tempDirectoryPath.toString()); // Verify Mockito.verify(status) - .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT); + .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT); } @Test - public void storeCsarArtifactToFileSuccessfully() throws IOException { + public void storeCsarArtifactToFileSuccessfully() throws IOException { // Arrange DistributionClientDownloadResultStubImpl resultStub = new DistributionClientDownloadResultStubImpl(); @@ -130,11 +130,11 @@ public class ListenerServiceImplTest { private String checkFileExists(Path path) throws IOException { return Files.walk(path) - .filter(Files::isRegularFile) - .map(Path::toFile) - .findAny() - .get() - .getName(); + .filter(Files :: isRegularFile) + .map(Path :: toFile) + .findAny() + .get() + .getName(); } public byte[] convertFileToByteArray(File file) { @@ -147,7 +147,7 @@ public class ListenerServiceImplTest { } public class DistributionClientDownloadResultStubImpl extends DistributionClientResultStubImpl implements - IDistributionClientDownloadResult { + IDistributionClientDownloadResult { public DistributionClientDownloadResultStubImpl() { } @@ -164,5 +164,7 @@ public class ListenerServiceImplTest { public String getArtifactFilename() { return "MackArtifactName.csar"; } + } + } |