<groupId>org.onap.aai.model-loader</groupId>
<artifactId>model-loader</artifactId>
<name>aai-model-loader</name>
- <version>1.12.0-SNAPSHOT</version>
+ <version>1.13.5-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<start-class>org.onap.aai.modelloader.service.ModelLoaderApplication</start-class>
<nexusproxy>https://nexus.onap.org</nexusproxy>
<docker.location>${basedir}/target</docker.location>
- <spring-boot.version>2.3.12.RELEASE</spring-boot.version>
+ <spring-boot.version>2.4.13</spring-boot.version>
<apache.commons-text.version>1.10.0</apache.commons-text.version>
<commons-compress.version>1.22</commons-compress.version>
<hamcrest-all.version>1.3</hamcrest-all.version>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>${logback.version}</version><!--$NO-MVN-MAN-VER$ -->
+ <version>${logback.version}</version>
+ <!--$NO-MVN-MAN-VER$ -->
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
- <version>${logback.version}</version><!--$NO-MVN-MAN-VER$ -->
+ <version>${logback.version}</version>
+ <!--$NO-MVN-MAN-VER$ -->
</dependency>
<dependency>
<groupId>org.onap.sdc.sdc-distribution-client</groupId>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
- <version>20131018</version><!--$NO-MVN-MAN-VER$ -->
+ <version>20131018</version>
+ <!--$NO-MVN-MAN-VER$ -->
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
</dependency>
<!-- Test dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>${hamcrest-all.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
#server.ssl.keyStoreType=
#server.ssl.keyAlias=
-server.tomcat.max-threads=200
+server.tomcat.threads.max=200
# The minimum number of threads always kept alive
-server.tomcat.min-spare-threads=25
+server.tomcat.threads.min-spare=25
# Spring Boot logging
logging.config=${logback.configurationFile}
*/
package org.onap.aai.modelloader;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for ModelLoaderApplication class.
*/
package org.onap.aai.modelloader.config;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import java.io.File;
import java.io.FileInputStream;
import java.util.List;
import java.util.Properties;
import org.eclipse.jetty.util.security.Password;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.restclient.AaiRestClient;
import org.onap.sdc.utils.ArtifactTypeEnum;
ModelLoaderConfig config = new ModelLoaderConfig(props, null);
AaiRestClient aaiClient = new AaiRestClient(config);
- assertFalse("Empty AAI Password should result in no basic authentication", aaiClient.useBasicAuth());
+ assertFalse(aaiClient.useBasicAuth(), "Empty AAI Password should result in no basic authentication");
props.load(new FileInputStream("src/test/resources/model-loader-no-auth-password.properties"));
config = new ModelLoaderConfig(props, null);
aaiClient = new AaiRestClient(config);
- assertFalse("No AAI Password should result in no basic authentication", aaiClient.useBasicAuth());
+ assertFalse(aaiClient.useBasicAuth(), "No AAI Password should result in no basic authentication");
}
@Test
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.Set;
import java.util.stream.Collectors;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.ArtifactType;
import org.onap.aai.modelloader.extraction.InvalidArchiveException;
List<Artifact> vnfcArtifacts = new VnfCatalogExtractor().extract(
new ArtifactTestUtils().loadResource("compressedArtifacts/noVnfcFilesArchive.csar"),
"noVnfcFilesArchive.csar");
- assertTrue("No VNFC files should have been extracted, but " + vnfcArtifacts.size() + " were found.",
- vnfcArtifacts.isEmpty());
+ assertTrue(vnfcArtifacts.isEmpty(),
+ "No VNFC files should have been extracted, but " + vnfcArtifacts.size() + " were found.");
}
@Test
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for NotificationDataImpl class.
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.isEmptyString;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.entity.Artifact;
public class ModelSorterTest {
assertThat(new ModelSorter().sort(Arrays.asList(nq1, nq2, artifact)), is(expected));
}
- @Test(expected = BabelArtifactParsingException.class)
+ @Test
public void circularDependency() throws BabelArtifactParsingException {
- List<Artifact> modelList = new ArrayList<Artifact>();
- modelList.add(buildTestModel("aaaa", "1111", "bbbb|1111"));
- modelList.add(buildTestModel("bbbb", "1111", "aaaa|1111"));
- new ModelSorter().sort(modelList);
+ assertThrows(BabelArtifactParsingException.class, () -> {
+ List<Artifact> modelList = new ArrayList<Artifact>();
+ modelList.add(buildTestModel("aaaa", "1111", "bbbb|1111"));
+ modelList.add(buildTestModel("bbbb", "1111", "aaaa|1111"));
+ new ModelSorter().sort(modelList);
+ });
}
private ModelArtifact buildTestModel() {
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import javax.ws.rs.core.Response;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
@Mock
private AaiRestClient aaiClient;
- @Before
+ @BeforeEach
public void setupMocks() {
MockitoAnnotations.initMocks(this);
}
import java.nio.file.Paths;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.entity.Artifact;
import org.springframework.util.CollectionUtils;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.isEmptyString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.entity.Artifact;
public class TestNamedQueryArtifactParser {
*/
package org.onap.aai.modelloader.extraction;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.onap.aai.modelloader.fixture.NotificationDataFixtureBuilder.getEmptyNotificationData;
import static org.onap.aai.modelloader.fixture.NotificationDataFixtureBuilder.getNotificationDataWithOneResource;
import static org.onap.aai.modelloader.fixture.NotificationDataFixtureBuilder.getNotificationDataWithOneService;
import java.util.ArrayList;
import java.util.List;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.fixture.ArtifactInfoBuilder;
import org.onap.aai.modelloader.fixture.MockNotificationDataImpl;
import org.onap.sdc.api.notification.IArtifactInfo;
private ArtifactInfoExtractor extractor;
- @Before
+ @BeforeEach
public void setup() {
extractor = new ArtifactInfoExtractor();
}
- @After
+ @AfterEach
public void tearDown() {
extractor = null;
}
}
private void doEmptyArtifactsTest(INotificationData notificationData) {
- assertTrue("The list returned should have been empty", extractor.extract(notificationData).isEmpty());
+ assertTrue(extractor.extract(notificationData).isEmpty(), "The list returned should have been empty");
}
@Test
List<IArtifactInfo> artifacts = extractor.extract(getNotificationDataWithOneService());
- assertEquals("One artifact should have been returned", 1, artifacts.size());
- assertEquals("The actual artifact did not match the expected one", expected, artifacts.get(0));
+ assertEquals(1, artifacts.size(), "One artifact should have been returned");
+ assertEquals(expected, artifacts.get(0), "The actual artifact did not match the expected one");
}
@Test
List<IArtifactInfo> artifacts = extractor.extract(getNotificationDataWithOneResource());
- assertEquals("One artifact should have been returned", 1, artifacts.size());
- assertEquals("The actual artifact did not match the expected one", expectedArtifacts, artifacts);
+ assertEquals(1, artifacts.size(), "One artifact should have been returned");
+ assertEquals(expectedArtifacts, artifacts, "The actual artifact did not match the expected one");
}
@Test
List<IArtifactInfo> artifacts = extractor.extract(getNotificationDataWithOneServiceAndResources());
- assertEquals("Two artifact should have been returned", 2, artifacts.size());
- assertEquals("The actual artifact did not match the expected one", expectedArtifacts, artifacts);
+ assertEquals(2, artifacts.size(), "Two artifact should have been returned");
+ assertEquals(expectedArtifacts, artifacts, "The actual artifact did not match the expected one");
}
}
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import java.util.List;
import java.util.Properties;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
private BabelServiceClientFactory mockClientFactory;
private VnfCatalogExtractor mockVnfCatalogExtractor;
- @Before
+ @BeforeEach
public void setup() throws Exception {
mockBabelClient = mock(BabelServiceClient.class);
mockDistributionClient = mock(IDistributionClient.class);
assertThat(downloadManager.downloadArtifacts(data, data.getServiceArtifacts(), modelArtifacts, catalogFiles),
is(true));
- assertEquals("There should have been some catalog files", 2, catalogFiles.size());
+ assertEquals(2, catalogFiles.size(), "There should have been some catalog files");
}
@Test
assertThat(downloadManager.downloadArtifacts(data, data.getServiceArtifacts(), modelArtifacts, catalogFiles),
is(true));
- assertEquals("There should have been some catalog files", 3, catalogFiles.size());
+ assertEquals(3, catalogFiles.size(), "There should have been some catalog files");
}
@Test
assertThat(downloadManager.downloadArtifacts(data, data.getServiceArtifacts(), modelArtifacts, catalogFiles),
is(true));
- assertEquals("There should not have been any catalog files", 0, catalogFiles.size());
+ assertEquals(0, catalogFiles.size(), "There should not have been any catalog files");
}
@Test
import java.util.List;
import java.util.Properties;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
private ModelArtifactHandler mockModelArtifactHandler;
private VnfCatalogArtifactHandler mockVnfCatalogArtifactHandler;
- @Before
+ @BeforeEach
public void setup() throws IOException {
configProperties = new Properties();
configProperties.load(this.getClass().getClassLoader().getResourceAsStream(CONFIG_FILE));
ReflectionTestUtils.setField(manager, "vnfCatalogArtifactHandler", mockVnfCatalogArtifactHandler);
}
- @After
+ @AfterEach
public void tearDown() {
configProperties = null;
mockModelArtifactHandler = null;
import java.util.Properties;
import org.hamcrest.collection.IsEmptyCollection;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
private BabelArtifactConverter mockBabelArtifactConverter;
private BabelServiceClientFactory mockClientFactory;
- @Before
+ @BeforeEach
public void setup() throws Exception {
mockBabelClient = mock(BabelServiceClient.class);
mockDistributionClient = mock(IDistributionClient.class);
ReflectionTestUtils.setField(downloadManager, "babelArtifactConverter", mockBabelArtifactConverter);
}
- @After
+ @AfterEach
public void tearDown() {
downloadManager = null;
mockDistributionClient = null;
*/
package org.onap.aai.modelloader.notification;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+
+import org.junit.jupiter.api.Test;
import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.ArtifactType;
*/
public class TestBabelArtifactConverter {
- @Test(expected = NullPointerException.class)
+ @Test
public void convert_nullToscaFiles() throws BabelArtifactParsingException {
- new BabelArtifactConverter().convertToModel(null);
- fail("An instance of ArtifactGenerationException should have been thrown");
+ assertThrows(NullPointerException.class, () -> {
+ new BabelArtifactConverter().convertToModel(null);
+ fail("An instance of ArtifactGenerationException should have been thrown");
+ });
}
@Test
public void testEmptyToscaFiles() throws BabelArtifactParsingException {
- assertTrue("Nothing should have been returned",
- new BabelArtifactConverter().convertToModel(new ArrayList<>()).isEmpty());
+ assertTrue(new BabelArtifactConverter().convertToModel(new ArrayList<>()).isEmpty(),
+ "Nothing should have been returned");
}
- @Test(expected = BabelArtifactParsingException.class)
+ @Test
public void testInvalidXml() throws IOException, BabelArtifactParsingException {
- byte[] problemXml =
- "<model xmlns=\"http://org.openecomp.aai.inventory/v10\"><rubbish>This is some xml that should cause the model artifact parser to throw an erorr</rubbish></model>"
- .getBytes();
+ assertThrows(BabelArtifactParsingException.class, () -> {
+ byte[] problemXml =
+ "<model xmlns=\"http://org.openecomp.aai.inventory/v10\"><rubbish>This is some xml that should cause the model artifact parser to throw an erorr</rubbish></model>"
+ .getBytes();
- INotificationData data = NotificationDataFixtureBuilder.getNotificationDataWithToscaCsarFile();
+ INotificationData data = NotificationDataFixtureBuilder.getNotificationDataWithToscaCsarFile();
- List<BabelArtifact> toscaArtifacts = setupTest(problemXml, data);
+ List<BabelArtifact> toscaArtifacts = setupTest(problemXml, data);
- new BabelArtifactConverter().convertToModel(toscaArtifacts);
- fail("An instance of ModelArtifactParsingException should have been thrown");
+ new BabelArtifactConverter().convertToModel(toscaArtifacts);
+ fail("An instance of ModelArtifactParsingException should have been thrown");
+ });
}
private List<BabelArtifact> setupTest(byte[] xml, INotificationData data) throws IOException {
List<Artifact> modelArtifacts = new BabelArtifactConverter().convertToModel(toscaArtifacts);
- assertEquals("There should have been 1 artifact", 1, modelArtifacts.size());
+ assertEquals(1, modelArtifacts.size(), "There should have been 1 artifact");
assertEquals(new String(xml), modelArtifacts.get(0).getPayload());
assertEquals(ArtifactType.MODEL, modelArtifacts.get(0).getType());
}
import java.util.List;
import java.util.Properties;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.entity.model.BabelArtifactParsingException;
private IDistributionClient mockDistributionClient;
private NotificationPublisher mockNotificationPublisher;
- @Before
+ @BeforeEach
public void setup() throws IOException {
configProperties = new Properties();
configProperties.load(this.getClass().getClassLoader().getResourceAsStream(CONFIG_FILE));
ReflectionTestUtils.setField(eventCallback, "notificationPublisher", mockNotificationPublisher);
}
- @After
+ @AfterEach
public void tearDown() {
config = null;
configProperties = null;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for NotificationDataImpl class
*/
package org.onap.aai.modelloader.notification;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.onap.sdc.api.IDistributionClient;
System.setProperty("CONFIG_HOME", "src/test/resources");
}
- @Before
+ @BeforeEach
public void setupMocks() {
MockitoAnnotations.initMocks(this);
when(client.getConfiguration()).thenReturn(config);
*/
package org.onap.aai.modelloader.restclient;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.File;
import java.io.IOException;
import static javax.servlet.http.HttpServletResponse.SC_OK;
import static org.apache.commons.io.IOUtils.write;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.nio.charset.Charset;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
/**
private Server server;
private AaiRestClient aaiClient;
- @Before
+ @BeforeEach
public void startJetty() throws Exception {
server = new Server(8080);
server.setHandler(getMockHandler());
aaiClient = new AaiRestClient(config);
}
- @After
+ @AfterEach
public void stopJetty() throws Exception {
server.stop();
}
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.service.HttpsBabelServiceClientFactory;
private Server server;
private String responseBody;
- @Before
+ @BeforeEach
public void startJetty() throws Exception {
List<BabelArtifact> response = new ArrayList<>();
response.add(new BabelArtifact("", null, ""));
server.start();
}
- @After
+ @AfterEach
public void stopJetty() throws Exception {
server.stop();
}
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for NotificationDataImpl class
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.Base64;
import javax.ws.rs.core.Response;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.util.ArtifactTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringRunner;
/**
* Tests for the ModelLoaderService class.
*
*/
-@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ModelLoaderService.class, MockBabelServiceClientFactory.class})
@TestPropertySource(properties = {"CONFIG_HOME=src/test/resources",})
public class TestModelLoaderService {
@Autowired
private ModelLoaderService service;
- @After
+ @AfterEach
public void shutdown() {
service.preShutdownOperations();
}
import javax.ws.rs.core.Response;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.util.ArtifactTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringRunner;
/**
* Tests for the ModelLoaderService class.
*
*/
-@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ModelLoaderService.class, HttpsBabelServiceClientFactory.class})
@TestPropertySource(properties = {"CONFIG_HOME=src/test/resources",})
public class TestModelLoaderServiceWithSdc {
@Autowired
private ModelLoaderService service;
- @After
+ @AfterEach
public void shutdown() {
service.preShutdownOperations();
}
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.gizmo.GizmoBulkPayload;
public class TestGizmoTranslator {
- @Test(expected = IOException.class)
+ @Test
public void translateInvalidXml() throws IOException {
- GizmoTranslator.translate("not valid XML");
+ assertThrows(IOException.class, () -> {
+ GizmoTranslator.translate("not valid XML");
+ });
}
@Test
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
# because they are used in Jenkins, whose plug-in doesn't support
major=1
-minor=12
-patch=0
+minor=13
+patch=5
base_version=${major}.${minor}.${patch}