Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit d8586c01 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

configure integration tests

parent 62272a25
No related branches found
No related tags found
No related merge requests found
Pipeline #78138 passed with warnings
Showing
with 87 additions and 67 deletions
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
~ See the Licence for the specific language governing permissions and limitations under the Licence. ~ See the Licence for the specific language governing permissions and limitations under the Licence.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>eu.europa.ec.edelivery</groupId> <groupId>eu.europa.ec.edelivery</groupId>
<artifactId>smp-modules</artifactId> <artifactId>smp-modules</artifactId>
...@@ -94,19 +95,22 @@ ...@@ -94,19 +95,22 @@
<!-- plugins --> <!-- plugins -->
<frontend-maven-plugin.version>1.9.1</frontend-maven-plugin.version> <frontend-maven-plugin.version>1.9.1</frontend-maven-plugin.version>
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version> <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
<surefire.jvm.args></surefire.jvm.args>
<failsafe.jvm.args></failsafe.jvm.args>
<sonar.jacoco.remotePort>${jacocoRemotePort}</sonar.jacoco.remotePort> <sonar.jacoco.remotePort>${jacocoRemotePort}</sonar.jacoco.remotePort>
<sonar.jacoco.remoteAddress>${jacocoRemoteAddress}</sonar.jacoco.remoteAddress> <sonar.jacoco.remoteAddress>${jacocoRemoteAddress}</sonar.jacoco.remoteAddress>
<sonar.host.url>http://localhost:9000/sonar/</sonar.host.url> <sonar.host.url>http://localhost:9000/sonar/</sonar.host.url>
<sonar.language>java</sonar.language> <sonar.language>java</sonar.language>
<jacoco.append>true</jacoco.append>
<sonar.binaries>target/classes</sonar.binaries> <sonar.binaries>target/classes</sonar.binaries>
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco/jacoco.xml <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</sonar.coverage.jacoco.xmlReportPaths> <sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath>
<jacoco.maven.plugin.version>0.8.6</jacoco.maven.plugin.version>
<jacoco.maven.plugin.version>0.8.9</jacoco.maven.plugin.version>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version> <maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>2.19.1</maven-failsafe-plugin.version> <maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
<sonar.exclusions> <sonar.exclusions>
**/target/**, **/target/**,
**/smp-angular/node_modules/**, **/smp-angular/node_modules/**,
...@@ -123,7 +127,8 @@ ...@@ -123,7 +127,8 @@
</sonar.coverage.exclusions> </sonar.coverage.exclusions>
<!-- latest version compatible with SonarQube 5.6 is: 3.3.0.603--> <!-- latest version compatible with SonarQube 5.6 is: 3.3.0.603-->
<sonar.maven.plugin.version>3.5.0.1254</sonar.maven.plugin.version> <sonar.maven.plugin.version>3.5.0.1254</sonar.maven.plugin.version>
<release.arguments>-Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true</release.arguments> <release.arguments>-Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true
</release.arguments>
<project.scm.id>edelivery-scm</project.scm.id> <project.scm.id>edelivery-scm</project.scm.id>
</properties> </properties>
...@@ -752,9 +757,36 @@ ...@@ -752,9 +757,36 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<!-- make sure methods are always run in same order -->
<runOrder>alphabetical</runOrder> <runOrder>alphabetical</runOrder>
<argLine>-ea ${argLine}</argLine>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<!-- ... fool Sonar to show test success for both unit and integration tests together by
instructing Failsafe to store its test reports to the same directory as Surefire instead of
the default failsafe-reports.
See https://jira.sonarsource.com/browse/SONAR-7526 -->
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<includes>
<include>**/*IT.java</include>
</includes>
<runOrder>alphabetical</runOrder>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- jacoco start --> <!-- jacoco start -->
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
...@@ -773,6 +805,16 @@ ...@@ -773,6 +805,16 @@
<goal>report</goal> <goal>report</goal>
</goals> </goals>
</execution> </execution>
<execution>
<id>jacoco-agent-it</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<destFile>${jacoco.report.it}</destFile>
<propertyName>failsafeArgLine</propertyName>
</configuration>
</execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
......
...@@ -353,7 +353,7 @@ public class UITruststoreService extends BasicKeystoreService { ...@@ -353,7 +353,7 @@ public class UITruststoreService extends BasicKeystoreService {
* *
* @param cert * @param cert
* @throws CertificateException * @throws CertificateException
*/ *
public void checkFullCertificateValidityLegacy(CertificateRO cert) throws CertificateException { public void checkFullCertificateValidityLegacy(CertificateRO cert) throws CertificateException {
// trust data in database // trust data in database
if (cert.getValidFrom() != null && OffsetDateTime.now().isBefore(cert.getValidFrom())) { if (cert.getValidFrom() != null && OffsetDateTime.now().isBefore(cert.getValidFrom())) {
...@@ -391,7 +391,7 @@ public class UITruststoreService extends BasicKeystoreService { ...@@ -391,7 +391,7 @@ public class UITruststoreService extends BasicKeystoreService {
} }
} }
} }
*/
boolean isTruststoreChanged() { boolean isTruststoreChanged() {
File file = getTruststoreFile(); File file = getTruststoreFile();
return !Objects.equals(lastUpdateTrustStoreFile, file) || return !Objects.equals(lastUpdateTrustStoreFile, file) ||
......
...@@ -165,9 +165,10 @@ ...@@ -165,9 +165,10 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> </plugin>
<runOrder>alphabetical</runOrder> <plugin>
</configuration> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
......
...@@ -2,7 +2,6 @@ package eu.europa.ec.edelivery.smp.ui; ...@@ -2,7 +2,6 @@ package eu.europa.ec.edelivery.smp.ui;
import eu.europa.ec.edelivery.smp.data.dao.ConfigurationDao; import eu.europa.ec.edelivery.smp.data.dao.ConfigurationDao;
import eu.europa.ec.edelivery.smp.data.dao.CredentialDao; import eu.europa.ec.edelivery.smp.data.dao.CredentialDao;
import eu.europa.ec.edelivery.smp.data.model.user.DBCredential;
import eu.europa.ec.edelivery.smp.services.ui.UIKeystoreService; import eu.europa.ec.edelivery.smp.services.ui.UIKeystoreService;
import eu.europa.ec.edelivery.smp.test.SmpTestWebAppConfig; import eu.europa.ec.edelivery.smp.test.SmpTestWebAppConfig;
import eu.europa.ec.edelivery.smp.test.testutils.MockMvcUtils; import eu.europa.ec.edelivery.smp.test.testutils.MockMvcUtils;
...@@ -22,8 +21,6 @@ import org.springframework.web.context.WebApplicationContext; ...@@ -22,8 +21,6 @@ import org.springframework.web.context.WebApplicationContext;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Optional;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
...@@ -39,9 +36,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -39,9 +36,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
"classpath:/cleanup-database.sql", "classpath:/cleanup-database.sql",
"classpath:/webapp_integration_test_data.sql"}, "classpath:/webapp_integration_test_data.sql"},
executionPhase = BEFORE_TEST_METHOD) executionPhase = BEFORE_TEST_METHOD)
public class AuthenticationResourceIntegrationTest { public class AuthenticationResourceIT {
private static final Logger LOG = LoggerFactory.getLogger(AuthenticationResourceIntegrationTest.class); private static final Logger LOG = LoggerFactory.getLogger(AuthenticationResourceIT.class);
private static final String PATH = ResourceConstants.CONTEXT_PATH_PUBLIC_SECURITY + "/authentication"; private static final String PATH = ResourceConstants.CONTEXT_PATH_PUBLIC_SECURITY + "/authentication";
......
...@@ -26,7 +26,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder ...@@ -26,7 +26,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
class DocumentEditControllerIntegrationTest extends AbstractControllerTest { class DocumentEditControllerIT extends AbstractControllerTest {
private static final String PATH = CONTEXT_PATH_EDIT_DOCUMENT; private static final String PATH = CONTEXT_PATH_EDIT_DOCUMENT;
@Autowired @Autowired
......
...@@ -28,7 +28,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder ...@@ -28,7 +28,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
public class DomainEditControllerIntegrationTest extends AbstractControllerTest { public class DomainEditControllerIT extends AbstractControllerTest {
private static final String PATH = CONTEXT_PATH_EDIT_DOMAIN; private static final String PATH = CONTEXT_PATH_EDIT_DOMAIN;
@Autowired @Autowired
......
...@@ -30,7 +30,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -30,7 +30,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
* For the test configuration see the webapp_integration_test_data.sql file. * For the test configuration see the webapp_integration_test_data.sql file.
* The system admin user is admin member of domain '1' and group '1'. * The system admin user is admin member of domain '1' and group '1'.
*/ */
public class GroupEditControllerIntegrationTest extends AbstractControllerTest { public class GroupEditControllerIT extends AbstractControllerTest {
private static final String PATH = CONTEXT_PATH_EDIT_GROUP; private static final String PATH = CONTEXT_PATH_EDIT_GROUP;
@Autowired @Autowired
......
...@@ -29,7 +29,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -29,7 +29,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
* For the test configuration see the webapp_integration_test_data.sql file. * For the test configuration see the webapp_integration_test_data.sql file.
* The system admin user is admin member of domain '1' and group '1'. * The system admin user is admin member of domain '1' and group '1'.
*/ */
public class ResourceEditControllerIntegrationTest extends AbstractControllerTest { public class ResourceEditControllerIT extends AbstractControllerTest {
private static final String PATH = CONTEXT_PATH_EDIT_RESOURCE; private static final String PATH = CONTEXT_PATH_EDIT_RESOURCE;
@Autowired @Autowired
......
...@@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
"smp.artifact.version=TestApplicationVersion", "smp.artifact.version=TestApplicationVersion",
"smp.artifact.build.time=2018-11-27 00:00:00", "smp.artifact.build.time=2018-11-27 00:00:00",
}) })
public class ApplicationResourceIntegrationTest { public class ApplicationResourceIT {
private static final String PATH = ResourceConstants.CONTEXT_PATH_PUBLIC_APPLICATION; private static final String PATH = ResourceConstants.CONTEXT_PATH_PUBLIC_APPLICATION;
@Autowired @Autowired
......
...@@ -36,7 +36,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -36,7 +36,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@Sql(scripts = { @Sql(scripts = {
"/cleanup-database.sql", "/cleanup-database.sql",
"/webapp_integration_test_data.sql"}) "/webapp_integration_test_data.sql"})
public class DomainResourceIntegrationTest { public class DomainResourceIT {
private static final String PATH = ResourceConstants.CONTEXT_PATH_PUBLIC_DOMAIN; private static final String PATH = ResourceConstants.CONTEXT_PATH_PUBLIC_DOMAIN;
@Autowired @Autowired
......
...@@ -41,7 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -41,7 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
"classpath:/cleanup-database.sql", "classpath:/cleanup-database.sql",
"classpath:/webapp_integration_test_data.sql"}, "classpath:/webapp_integration_test_data.sql"},
executionPhase = BEFORE_TEST_METHOD) executionPhase = BEFORE_TEST_METHOD)
public class SearchResourceIntegrationTest { public class SearchResourceIT {
@Autowired @Autowired
private WebApplicationContext webAppContext; private WebApplicationContext webAppContext;
......
...@@ -24,7 +24,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder ...@@ -24,7 +24,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
public class UserControllerTest extends AbstractControllerTest { public class UserControllerIT extends AbstractControllerTest {
private static final String PATH = CONTEXT_PATH_PUBLIC_USER; private static final String PATH = CONTEXT_PATH_PUBLIC_USER;
@Autowired @Autowired
......
...@@ -3,7 +3,6 @@ package eu.europa.ec.edelivery.smp.ui.external; ...@@ -3,7 +3,6 @@ package eu.europa.ec.edelivery.smp.ui.external;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.databind.json.JsonMapper;
import eu.europa.ec.edelivery.smp.data.ui.AccessTokenRO; import eu.europa.ec.edelivery.smp.data.ui.AccessTokenRO;
import eu.europa.ec.edelivery.smp.data.ui.CertificateRO;
import eu.europa.ec.edelivery.smp.data.ui.PasswordChangeRO; import eu.europa.ec.edelivery.smp.data.ui.PasswordChangeRO;
import eu.europa.ec.edelivery.smp.data.ui.UserRO; import eu.europa.ec.edelivery.smp.data.ui.UserRO;
import eu.europa.ec.edelivery.smp.test.SmpTestWebAppConfig; import eu.europa.ec.edelivery.smp.test.SmpTestWebAppConfig;
...@@ -23,7 +22,6 @@ import org.springframework.test.web.servlet.MvcResult; ...@@ -23,7 +22,6 @@ import org.springframework.test.web.servlet.MvcResult;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import java.util.UUID;
import static eu.europa.ec.edelivery.smp.test.testutils.MockMvcUtils.*; import static eu.europa.ec.edelivery.smp.test.testutils.MockMvcUtils.*;
import static eu.europa.ec.edelivery.smp.ui.ResourceConstants.CONTEXT_PATH_PUBLIC_SECURITY_USER; import static eu.europa.ec.edelivery.smp.ui.ResourceConstants.CONTEXT_PATH_PUBLIC_SECURITY_USER;
...@@ -44,7 +42,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -44,7 +42,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
"classpath:/cleanup-database.sql", "classpath:/cleanup-database.sql",
"classpath:/webapp_integration_test_data.sql"}, "classpath:/webapp_integration_test_data.sql"},
executionPhase = BEFORE_TEST_METHOD) executionPhase = BEFORE_TEST_METHOD)
public class UserResourceIntegrationTest { public class UserResourceIT {
private static final String PATH_PUBLIC = ResourceConstants.CONTEXT_PATH_PUBLIC_USER; private static final String PATH_PUBLIC = ResourceConstants.CONTEXT_PATH_PUBLIC_USER;
......
package eu.europa.ec.edelivery.smp.ui.internal; package eu.europa.ec.edelivery.smp.ui.internal;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.europa.ec.edelivery.smp.data.dao.DomainDao; import eu.europa.ec.edelivery.smp.data.dao.DomainDao;
import eu.europa.ec.edelivery.smp.data.model.DBDomain; import eu.europa.ec.edelivery.smp.data.model.DBDomain;
import eu.europa.ec.edelivery.smp.data.ui.DeleteEntityValidation;
import eu.europa.ec.edelivery.smp.data.ui.DomainRO; import eu.europa.ec.edelivery.smp.data.ui.DomainRO;
import eu.europa.ec.edelivery.smp.data.ui.UserRO; import eu.europa.ec.edelivery.smp.data.ui.UserRO;
import eu.europa.ec.edelivery.smp.data.ui.enums.EntityROStatus; import eu.europa.ec.edelivery.smp.data.ui.enums.EntityROStatus;
import eu.europa.ec.edelivery.smp.test.SmpTestWebAppConfig;
import eu.europa.ec.edelivery.smp.test.testutils.MockMvcUtils; import eu.europa.ec.edelivery.smp.test.testutils.MockMvcUtils;
import eu.europa.ec.edelivery.smp.ui.AbstractControllerTest;
import eu.europa.ec.edelivery.smp.ui.ResourceConstants; import eu.europa.ec.edelivery.smp.ui.ResourceConstants;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Ignore; import org.junit.jupiter.api.Disabled;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockHttpSession; import org.springframework.mock.web.MockHttpSession;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.MvcResult;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
...@@ -29,24 +21,14 @@ import org.springframework.web.context.WebApplicationContext; ...@@ -29,24 +21,14 @@ import org.springframework.web.context.WebApplicationContext;
import java.util.List; import java.util.List;
import static eu.europa.ec.edelivery.smp.test.testutils.MockMvcUtils.*; import static eu.europa.ec.edelivery.smp.test.testutils.MockMvcUtils.*;
import static org.hamcrest.Matchers.stringContainsInOrder; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.*; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.BEFORE_TEST_METHOD;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringRunner.class) public class DomainAdminResourceIT extends AbstractControllerTest {
@WebAppConfiguration
@DirtiesContext
@ContextConfiguration(classes = {SmpTestWebAppConfig.class})
@Sql(scripts = {
"classpath:/cleanup-database.sql",
"classpath:/webapp_integration_test_data.sql"},
executionPhase = BEFORE_TEST_METHOD)
public class DomainAdminResourceIntegrationTest {
private static final String PATH = ResourceConstants.CONTEXT_PATH_INTERNAL_DOMAIN; private static final String PATH = ResourceConstants.CONTEXT_PATH_INTERNAL_DOMAIN;
@Autowired @Autowired
...@@ -57,13 +39,14 @@ public class DomainAdminResourceIntegrationTest { ...@@ -57,13 +39,14 @@ public class DomainAdminResourceIntegrationTest {
private MockMvc mvc; private MockMvc mvc;
@Before @BeforeEach
public void setup() { public void setup() {
mvc = MockMvcUtils.initializeMockMvc(webAppContext); mvc = MockMvcUtils.initializeMockMvc(webAppContext);
} }
@Test @Test
public void testGetAllDomains() throws Exception { public void testGetAllDomains() throws Exception {
List<DBDomain> domain = domainDao.getAllDomains(); List<DBDomain> domain = domainDao.getAllDomains();
MockHttpSession session = loginWithSystemAdmin(mvc); MockHttpSession session = loginWithSystemAdmin(mvc);
UserRO userRO = MockMvcUtils.getLoggedUserData(mvc, session); UserRO userRO = MockMvcUtils.getLoggedUserData(mvc, session);
...@@ -125,7 +108,7 @@ public class DomainAdminResourceIntegrationTest { ...@@ -125,7 +108,7 @@ public class DomainAdminResourceIntegrationTest {
public void updateDomainSmlIntegrationData() throws Exception { public void updateDomainSmlIntegrationData() throws Exception {
String domainCode = "domainTwo"; String domainCode = "domainTwo";
MockHttpSession session = loginWithSystemAdmin(mvc); MockHttpSession session = loginWithSystemAdmin(mvc);
UserRO userRO = (UserRO)session.getAttribute(MOCK_LOGGED_USER); UserRO userRO = (UserRO) session.getAttribute(MOCK_LOGGED_USER);
DomainRO domainToUpdate = getDomain(domainCode, userRO, session); DomainRO domainToUpdate = getDomain(domainCode, userRO, session);
domainToUpdate.setSmlSubdomain("NewCode"); domainToUpdate.setSmlSubdomain("NewCode");
...@@ -145,7 +128,7 @@ public class DomainAdminResourceIntegrationTest { ...@@ -145,7 +128,7 @@ public class DomainAdminResourceIntegrationTest {
} }
@Test @Test
@Ignore @Disabled
public void updateDomainDataAddNewResourceDef() throws Exception { public void updateDomainDataAddNewResourceDef() throws Exception {
// set the webapp_integration_test_data.sql for resourceDefID // set the webapp_integration_test_data.sql for resourceDefID
String resourceDefID = "edelivery-oasis-cppa"; String resourceDefID = "edelivery-oasis-cppa";
...@@ -194,7 +177,7 @@ public class DomainAdminResourceIntegrationTest { ...@@ -194,7 +177,7 @@ public class DomainAdminResourceIntegrationTest {
.content("[2]")) // delete domain with id 2 .content("[2]")) // delete domain with id 2
.andExpect(status().isOk()).andReturn(); .andExpect(status().isOk()).andReturn();
//them //then
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
DeleteEntityValidation res = mapper.readValue(result.getResponse().getContentAsString(), DeleteEntityValidation.class); DeleteEntityValidation res = mapper.readValue(result.getResponse().getContentAsString(), DeleteEntityValidation.class);
...@@ -290,8 +273,8 @@ public class DomainAdminResourceIntegrationTest { ...@@ -290,8 +273,8 @@ public class DomainAdminResourceIntegrationTest {
} }
private String entitiToString(Object object ) throws Exception { private String entitiToString(Object object) throws Exception {
return serializeObject(object); return serializeObject(object);
} }
......
...@@ -27,7 +27,7 @@ import static org.springframework.security.test.web.servlet.request.SecurityMock ...@@ -27,7 +27,7 @@ import static org.springframework.security.test.web.servlet.request.SecurityMock
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
public class KeystoreResourceIntegrationTest extends AbstractControllerTest { public class KeystoreAdminControllerIT extends AbstractControllerTest {
private static final String PATH = CONTEXT_PATH_INTERNAL_KEYSTORE; private static final String PATH = CONTEXT_PATH_INTERNAL_KEYSTORE;
Path keystore = Paths.get("src", "test", "resources", "keystores", "smp-keystore.jks"); Path keystore = Paths.get("src", "test", "resources", "keystores", "smp-keystore.jks");
......
...@@ -9,7 +9,7 @@ import eu.europa.ec.edelivery.smp.services.ui.UITruststoreService; ...@@ -9,7 +9,7 @@ import eu.europa.ec.edelivery.smp.services.ui.UITruststoreService;
import eu.europa.ec.edelivery.smp.test.SmpTestWebAppConfig; import eu.europa.ec.edelivery.smp.test.SmpTestWebAppConfig;
import eu.europa.ec.edelivery.smp.test.testutils.X509CertificateTestUtils; import eu.europa.ec.edelivery.smp.test.testutils.X509CertificateTestUtils;
import eu.europa.ec.edelivery.smp.ui.AbstractControllerTest; import eu.europa.ec.edelivery.smp.ui.AbstractControllerTest;
import eu.europa.ec.edelivery.smp.ui.external.UserResourceIntegrationTest; import eu.europa.ec.edelivery.smp.ui.external.UserResourceIT;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.hamcrest.CoreMatchers; import org.hamcrest.CoreMatchers;
import org.junit.Ignore; import org.junit.Ignore;
...@@ -36,7 +36,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -36,7 +36,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@ContextConfiguration(classes = {SmpTestWebAppConfig.class, UITruststoreService.class}) @ContextConfiguration(classes = {SmpTestWebAppConfig.class, UITruststoreService.class})
public class TruststoreAdminResourceIntegrationTest extends AbstractControllerTest { public class TruststoreAdminControllerIT extends AbstractControllerTest {
private static final String PATH_INTERNAL = CONTEXT_PATH_INTERNAL_TRUSTSTORE; private static final String PATH_INTERNAL = CONTEXT_PATH_INTERNAL_TRUSTSTORE;
private static final String PATH_PUBLIC = CONTEXT_PATH_PUBLIC_TRUSTSTORE; private static final String PATH_PUBLIC = CONTEXT_PATH_PUBLIC_TRUSTSTORE;
...@@ -77,7 +77,7 @@ public class TruststoreAdminResourceIntegrationTest extends AbstractControllerTe ...@@ -77,7 +77,7 @@ public class TruststoreAdminResourceIntegrationTest extends AbstractControllerTe
@Test @Test
public void validateCertificateSystemAdmin() throws Exception { public void validateCertificateSystemAdmin() throws Exception {
byte[] buff = IOUtils.toByteArray(UserResourceIntegrationTest.class.getResourceAsStream("/SMPtest.crt")); byte[] buff = IOUtils.toByteArray(UserResourceIT.class.getResourceAsStream("/SMPtest.crt"));
// login // login
MockHttpSession session = loginWithSystemAdmin(mvc); MockHttpSession session = loginWithSystemAdmin(mvc);
// when update data // when update data
...@@ -129,7 +129,7 @@ public class TruststoreAdminResourceIntegrationTest extends AbstractControllerTe ...@@ -129,7 +129,7 @@ public class TruststoreAdminResourceIntegrationTest extends AbstractControllerTe
@Test @Test
public void uploadCertificateInvalidUser() throws Exception { public void uploadCertificateInvalidUser() throws Exception {
byte[] buff = IOUtils.toByteArray(UserResourceIntegrationTest.class.getResourceAsStream("/SMPtest.crt")); byte[] buff = IOUtils.toByteArray(UserResourceIT.class.getResourceAsStream("/SMPtest.crt"));
// id and logged user not match // id and logged user not match
// given when // given when
mvc.perform(post(PATH_PUBLIC + "/34556655/validate-certificate") mvc.perform(post(PATH_PUBLIC + "/34556655/validate-certificate")
...@@ -176,7 +176,7 @@ public class TruststoreAdminResourceIntegrationTest extends AbstractControllerTe ...@@ -176,7 +176,7 @@ public class TruststoreAdminResourceIntegrationTest extends AbstractControllerTe
MockHttpSession session = loginWithSystemAdmin(mvc); MockHttpSession session = loginWithSystemAdmin(mvc);
UserRO userRO = getLoggedUserData(mvc, session); UserRO userRO = getLoggedUserData(mvc, session);
byte[] buff = IOUtils.toByteArray(UserResourceIntegrationTest.class.getResourceAsStream("/SMPtest.crt")); byte[] buff = IOUtils.toByteArray(UserResourceIT.class.getResourceAsStream("/SMPtest.crt"));
int countStart = uiTruststoreService.getNormalizedTrustedList().size(); int countStart = uiTruststoreService.getNormalizedTrustedList().size();
MvcResult prepRes = mvc.perform(post(PATH_INTERNAL + "/" + userRO.getUserId() + "/upload-certificate") MvcResult prepRes = mvc.perform(post(PATH_INTERNAL + "/" + userRO.getUserId() + "/upload-certificate")
......
...@@ -21,7 +21,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder ...@@ -21,7 +21,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
public class UserAdminControllerIntegrationTest extends AbstractControllerTest { public class UserAdminControllerIT extends AbstractControllerTest {
private static final String PATH_INTERNAL = ResourceConstants.CONTEXT_PATH_INTERNAL_USER; private static final String PATH_INTERNAL = ResourceConstants.CONTEXT_PATH_INTERNAL_USER;
...@@ -74,7 +74,6 @@ public class UserAdminControllerIntegrationTest extends AbstractControllerTest { ...@@ -74,7 +74,6 @@ public class UserAdminControllerIntegrationTest extends AbstractControllerTest {
assertFalse(dev.getListIds().isEmpty()); assertFalse(dev.getListIds().isEmpty());
assertFalse(dev.getListDeleteNotPermitedIds().isEmpty()); assertFalse(dev.getListDeleteNotPermitedIds().isEmpty());
} }
@Test @Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment