From 0e4e61f7cd083944f98a4ca7b414826adc68969b Mon Sep 17 00:00:00 2001 From: Bartosz Gardziejewski Date: Tue, 21 Apr 2020 11:29:43 +0200 Subject: Fix checkstyle warnings in netconf simulator Issue-ID: INT-1517 Signed-off-by: Bartosz Gardziejewski Change-Id: I518c4863563217db746ccb5082aef7727a175bc7 --- .../org/onap/netconfsimulator/kafka/Message.java | 31 +++++++++++++++++++++ .../onap/netconfsimulator/kafka/MessageDTO.java | 31 --------------------- .../netconfsimulator/kafka/StoreController.java | 4 +-- .../onap/netconfsimulator/kafka/StoreService.java | 26 +++++++++--------- .../configuration/NetconfConfiguration.java | 32 ++++++++++++++++++++++ .../configuration/NetconfConfigurationTO.java | 32 ---------------------- .../kafka/EmbeddedKafkaConfig.java | 11 ++++---- .../kafka/StoreControllerTest.java | 29 ++++++++++---------- .../netconfsimulator/kafka/StoreServiceTest.java | 26 +++++++++--------- .../NetconfConfigurationReaderTest.java | 2 +- .../NetconfConfigurationServiceTest.java | 20 ++++++++------ .../model/NetconfModelLoaderServiceTest.java | 4 +-- 12 files changed, 126 insertions(+), 122 deletions(-) create mode 100644 netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/Message.java delete mode 100644 netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/MessageDTO.java create mode 100644 netconfsimulator/src/main/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfiguration.java delete mode 100644 netconfsimulator/src/main/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationTO.java (limited to 'netconfsimulator') diff --git a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/Message.java b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/Message.java new file mode 100644 index 0000000..9a7debc --- /dev/null +++ b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/Message.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * Simulator + * ================================================================================ + * Copyright (C) 2019 Nokia. 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.netconfsimulator.kafka; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +class Message { + private long timestamp; + private String configuration; +} diff --git a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/MessageDTO.java b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/MessageDTO.java deleted file mode 100644 index 4311cd6..0000000 --- a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/MessageDTO.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Simulator - * ================================================================================ - * Copyright (C) 2019 Nokia. 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.netconfsimulator.kafka; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -class MessageDTO { - private long timestamp; - private String configuration; -} diff --git a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/StoreController.java b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/StoreController.java index 2a196d9..d4414ee 100644 --- a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/StoreController.java +++ b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/StoreController.java @@ -47,12 +47,12 @@ public class StoreController { } @GetMapping("cm-history") - public List getAllConfigurationChanges() { + public List getAllConfigurationChanges() { return service.getAllMessages(); } @GetMapping("/less") - public List less(@RequestParam(value = "offset", required = false, defaultValue = "${spring.kafka.default-offset}") long offset) { + public List less(@RequestParam(value = "offset", required = false, defaultValue = "${spring.kafka.default-offset}") long offset) { return service.getLastMessages(offset); } diff --git a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/StoreService.java b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/StoreService.java index 5fddff5..1b99220 100644 --- a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/StoreService.java +++ b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/StoreService.java @@ -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. @@ -48,33 +48,33 @@ public class StoreService { this.consumerFactory = consumerFactory; } - List getAllMessages() { - List messages = new ArrayList<>(); - String clientID = Long.toString(Instant.now().getEpochSecond()); - try (Consumer consumer = consumerFactory.createConsumer(clientID, clientID)) { + List getAllMessages() { + List messages = new ArrayList<>(); + String clientId = Long.toString(Instant.now().getEpochSecond()); + try (Consumer consumer = consumerFactory.createConsumer(clientId, clientId)) { consumer.subscribe(TOPICS_TO_SUBSCRIBE); ConsumerRecords consumerRecords = consumer.poll(CONSUMING_DURATION_IN_MS); consumerRecords.forEach( consumerRecord -> - messages.add(new MessageDTO(consumerRecord.timestamp(), consumerRecord.value()))); + messages.add(new Message(consumerRecord.timestamp(), consumerRecord.value()))); log.debug(String.format("consumed %d messages", consumerRecords.count())); - } + } return messages; } - List getLastMessages(long offset) { - List messages = new ArrayList<>(); + List getLastMessages(long offset) { + List messages = new ArrayList<>(); try (Consumer consumer = createConsumer(offset)) { ConsumerRecords consumerRecords = consumer.poll(CONSUMING_DURATION_IN_MS); consumerRecords.forEach(consumerRecord -> - messages.add(new MessageDTO(consumerRecord.timestamp(), consumerRecord.value()))); + messages.add(new Message(consumerRecord.timestamp(), consumerRecord.value()))); } return messages; } private Consumer createConsumer(long offsetFromLastIndex) { - String clientID = Long.toString(Instant.now().getEpochSecond()); - Consumer consumer = consumerFactory.createConsumer(clientID, clientID); + String clientId = Long.toString(Instant.now().getEpochSecond()); + Consumer consumer = consumerFactory.createConsumer(clientId, clientId); consumer.subscribe(TOPICS_TO_SUBSCRIBE); seekConsumerTo(consumer, offsetFromLastIndex); return consumer; diff --git a/netconfsimulator/src/main/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfiguration.java b/netconfsimulator/src/main/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfiguration.java new file mode 100644 index 0000000..51f31ae --- /dev/null +++ b/netconfsimulator/src/main/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfiguration.java @@ -0,0 +1,32 @@ +/* + * ============LICENSE_START======================================================= + * PNF-REGISTRATION-HANDLER + * ================================================================================ + * Copyright (C) 2018 Nokia. 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.netconfsimulator.netconfcore.configuration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class NetconfConfiguration { + + private String configuration; + +} diff --git a/netconfsimulator/src/main/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationTO.java b/netconfsimulator/src/main/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationTO.java deleted file mode 100644 index e43ff69..0000000 --- a/netconfsimulator/src/main/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationTO.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * PNF-REGISTRATION-HANDLER - * ================================================================================ - * Copyright (C) 2018 Nokia. 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.netconfsimulator.netconfcore.configuration; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public class NetconfConfigurationTO { - - private String configuration; - -} diff --git a/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/EmbeddedKafkaConfig.java b/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/EmbeddedKafkaConfig.java index 5ddf2b2..6d487b2 100644 --- a/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/EmbeddedKafkaConfig.java +++ b/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/EmbeddedKafkaConfig.java @@ -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. @@ -22,6 +22,7 @@ package org.onap.netconfsimulator.kafka; import java.util.Map; + import org.apache.kafka.clients.consumer.ConsumerConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -40,20 +41,20 @@ import static org.onap.netconfsimulator.kafka.StoreServiceTest.embeddedKafka; class EmbeddedKafkaConfig { @Bean - KafkaTemplate kafkaTemplate(){ + KafkaTemplate kafkaTemplate() { return new KafkaTemplate<>(producerFactory()); } @Bean @Autowired - ConcurrentKafkaListenerContainerFactory kafkaListenerContainerFactory(ConsumerFactory consumerFactory){ + ConcurrentKafkaListenerContainerFactory kafkaListenerContainerFactory(ConsumerFactory consumerFactory) { ConcurrentKafkaListenerContainerFactory containerFactory = new ConcurrentKafkaListenerContainerFactory<>(); containerFactory.setConsumerFactory(consumerFactory); return containerFactory; } @Bean - ConsumerFactory consumerFactory(){ + ConsumerFactory consumerFactory() { Map consumerProperties = KafkaTestUtils.consumerProps("sender", "false", embeddedKafka.getEmbeddedKafka()); consumerProperties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); diff --git a/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/StoreControllerTest.java b/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/StoreControllerTest.java index 02eec12..bd6fd14 100644 --- a/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/StoreControllerTest.java +++ b/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/StoreControllerTest.java @@ -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. @@ -22,6 +22,7 @@ package org.onap.netconfsimulator.kafka; import java.time.Instant; import java.util.List; + import org.assertj.core.api.Assertions; import org.assertj.core.util.Lists; import org.junit.Test; @@ -39,9 +40,9 @@ public class StoreControllerTest { private static final String MESSAGE_2 = "message 2"; private static final String MESSAGE_1 = "message 1"; - private static final List ALL_MESSAGES = Lists.newArrayList(new MessageDTO(Instant.now().getEpochSecond(), MESSAGE_1), - new MessageDTO(Instant.now().getEpochSecond(), MESSAGE_2), - new MessageDTO(Instant.now().getEpochSecond(), MESSAGE_3)); + private static final List ALL_MESSAGES = Lists.newArrayList(new Message(Instant.now().getEpochSecond(), MESSAGE_1), + new Message(Instant.now().getEpochSecond(), MESSAGE_2), + new Message(Instant.now().getEpochSecond(), MESSAGE_3)); @Mock private StoreService service; @@ -54,33 +55,33 @@ public class StoreControllerTest { public void lessShouldTakeAllMessagesTest() { when(service.getLastMessages(3)).thenReturn(ALL_MESSAGES); - List lessResponse = storeController.less(3); + List lessResponse = storeController.less(3); assertResponseContainsExpectedMessages(lessResponse, 3, MESSAGE_1, MESSAGE_2, MESSAGE_3); } @Test public void lessShouldTakeTwoMessagesTest() { - when(service.getLastMessages(2)).thenReturn(Lists.newArrayList(new MessageDTO(Instant.now().getEpochSecond(), MESSAGE_1))); + when(service.getLastMessages(2)).thenReturn(Lists.newArrayList(new Message(Instant.now().getEpochSecond(), MESSAGE_1))); - List lessResult = storeController.less(2); + List lessResult = storeController.less(2); assertResponseContainsExpectedMessages(lessResult, 1, MESSAGE_1); } @Test - public void shouldGetAllMessages(){ + public void shouldGetAllMessages() { when(service.getAllMessages()).thenReturn(ALL_MESSAGES); - List allMsgResult = storeController.getAllConfigurationChanges(); + List allMsgResult = storeController.getAllConfigurationChanges(); assertResponseContainsExpectedMessages(allMsgResult, 3, MESSAGE_1, MESSAGE_2, MESSAGE_3); } - private void assertResponseContainsExpectedMessages(List actualMessages, int expectedMessageCount, String... expectedMessages){ - Assertions.assertThat(actualMessages.stream().map(MessageDTO::getConfiguration)) - .hasSize(expectedMessageCount) - .containsExactly(expectedMessages); + private void assertResponseContainsExpectedMessages(List actualMessages, int expectedMessageCount, String... expectedMessages) { + Assertions.assertThat(actualMessages.stream().map(Message::getConfiguration)) + .hasSize(expectedMessageCount) + .containsExactly(expectedMessages); } } diff --git a/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/StoreServiceTest.java b/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/StoreServiceTest.java index fd36116..fdba959 100644 --- a/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/StoreServiceTest.java +++ b/netconfsimulator/src/test/java/org/onap/netconfsimulator/kafka/StoreServiceTest.java @@ -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. @@ -59,38 +59,38 @@ public class StoreServiceTest { } @Test - public void testShouldReturnAllAvailableMessages(){ + public void testShouldReturnAllAvailableMessages() { - List actualMessages = service.getAllMessages(); + List actualMessages = service.getAllMessages(); assertResponseContainsExpectedMessages(actualMessages, 3, MESSAGE_1, MESSAGE_2, MESSAGE_3); } @Test - public void testShouldGetLastMessagesRespectingOffset(){ + public void testShouldGetLastMessagesRespectingOffset() { - List wantedLastMsg = service.getLastMessages(1L); + List wantedLastMsg = service.getLastMessages(1L); assertResponseContainsExpectedMessages(wantedLastMsg, 1, MESSAGE_3); } @Test - public void testShouldGetAll3Messages() { - List wantedLastMsgs = service.getLastMessages(3L); + public void testShouldGetAll3Messages() { + List wantedLastMsgs = service.getLastMessages(3L); assertResponseContainsExpectedMessages(wantedLastMsgs, 3, MESSAGE_1, MESSAGE_2, MESSAGE_3); } - private void prepareProducer(){ + private void prepareProducer() { kafkaTemplate.send("config", "message1"); kafkaTemplate.send("config", "message2"); kafkaTemplate.send("config", "message3"); } - private void assertResponseContainsExpectedMessages(List actualMessages, int expectedMessageCount, String... expectedMessages){ - assertThat(actualMessages.stream().map(MessageDTO::getConfiguration)) - .hasSize(expectedMessageCount) - .containsExactly(expectedMessages); + private void assertResponseContainsExpectedMessages(List actualMessages, int expectedMessageCount, String... expectedMessages) { + assertThat(actualMessages.stream().map(Message::getConfiguration)) + .hasSize(expectedMessageCount) + .containsExactly(expectedMessages); } } diff --git a/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationReaderTest.java b/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationReaderTest.java index a0a15b9..7095040 100644 --- a/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationReaderTest.java +++ b/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationReaderTest.java @@ -65,7 +65,7 @@ class NetconfConfigurationReaderTest { } @Test - void properlyReadXML() throws IOException, JNCException { + void properlyReadXml() throws IOException, JNCException { when(netconfSession.getConfig()).thenReturn(nodeSet); when(nodeSet.toXMLString()).thenReturn(EXPECTED_STRING_XML); diff --git a/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationServiceTest.java b/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationServiceTest.java index 6da6572..f42ad84 100644 --- a/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationServiceTest.java +++ b/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationServiceTest.java @@ -28,8 +28,10 @@ import static org.mockito.MockitoAnnotations.initMocks; import com.tailf.jnc.Element; import com.tailf.jnc.JNCException; + import java.io.IOException; import java.nio.file.Files; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; @@ -49,11 +51,11 @@ class NetconfConfigurationServiceTest { @InjectMocks NetconfConfigurationService service; - private static String CURRENT_CONFIG_XML_STRING = - "\n" - + " 100\n" - + " 200\n" - + "\n"; + private static String CURRENT_CONFIG_XML_STRING = + "\n" + + " 100\n" + + " 200\n" + + "\n"; @BeforeEach void setUp() { @@ -71,16 +73,16 @@ class NetconfConfigurationServiceTest { } @Test - void testShouldThrowExceptionWhenCurrentConfigurationDoesNotExists() throws IOException, JNCException{ + void testShouldThrowExceptionWhenCurrentConfigurationDoesNotExists() throws IOException, JNCException { when(reader.getRunningConfig()).thenThrow(JNCException.class); assertThatThrownBy(() -> service.getCurrentConfiguration()).isInstanceOf(JNCException.class); } @Test - void testShouldEditConfigurationSuccessfully() throws IOException, JNCException{ + void testShouldEditConfigurationSuccessfully() throws IOException, JNCException { byte[] bytes = - Files.readAllBytes(ResourceUtils.getFile("classpath:updatedConfig.xml").toPath()); + Files.readAllBytes(ResourceUtils.getFile("classpath:updatedConfig.xml").toPath()); MockMultipartFile editConfigXmlContent = new MockMultipartFile("editConfigXml", bytes); ArgumentCaptor elementCaptor = ArgumentCaptor.forClass(Element.class); doNothing().when(editor).editConfig(elementCaptor.capture()); @@ -93,7 +95,7 @@ class NetconfConfigurationServiceTest { @Test void testShouldRaiseExceptionWhenMultipartFileIsInvalidXmlFile() throws IOException { byte[] bytes = - Files.readAllBytes(ResourceUtils.getFile("classpath:invalidXmlFile.xml").toPath()); + Files.readAllBytes(ResourceUtils.getFile("classpath:invalidXmlFile.xml").toPath()); MockMultipartFile editConfigXmlContent = new MockMultipartFile("editConfigXml", bytes); assertThatThrownBy(() -> service.editCurrentConfiguration(editConfigXmlContent)).isInstanceOf(JNCException.class); diff --git a/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/model/NetconfModelLoaderServiceTest.java b/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/model/NetconfModelLoaderServiceTest.java index a10876b..8d26881 100644 --- a/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/model/NetconfModelLoaderServiceTest.java +++ b/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/model/NetconfModelLoaderServiceTest.java @@ -61,7 +61,6 @@ class NetconfModelLoaderServiceTest { @Test void shouldSendMultipartToServer() throws IOException { //given - String loadModelAddress = modelLoaderService.getBackendAddress(); makeMockClientReturnStatusOk(httpClient, HttpPost.class); ArgumentCaptor postArgumentCaptor = ArgumentCaptor.forClass(HttpPost.class); MultipartFile yangMmodel = mock(MultipartFile.class); @@ -69,6 +68,7 @@ class NetconfModelLoaderServiceTest { String moduleName = "moduleName"; when(yangMmodel.getInputStream()).thenReturn(getEmptyImputStream()); when(initialConfig.getInputStream()).thenReturn(getEmptyImputStream()); + String loadModelAddress = modelLoaderService.getBackendAddress(); //when LoadModelResponse response = modelLoaderService.loadYangModel(yangMmodel, initialConfig, moduleName); @@ -86,9 +86,9 @@ class NetconfModelLoaderServiceTest { void shouldSendDeleteRequestToServer() throws IOException { //given String yangModelName = "sampleModel"; - String deleteModelAddress = modelLoaderService.getDeleteAddress(yangModelName); makeMockClientReturnStatusOk(httpClient, HttpDelete.class); ArgumentCaptor deleteArgumentCaptor = ArgumentCaptor.forClass(HttpDelete.class); + String deleteModelAddress = modelLoaderService.getDeleteAddress(yangModelName); //when LoadModelResponse response = modelLoaderService.deleteYangModel(yangModelName); -- cgit 1.2.3-korg