Skip to content

Commit

Permalink
Merge pull request #120 from hycomsa/118
Browse files Browse the repository at this point in the history
Resolves #118, resolves #119
  • Loading branch information
kulasekp authored Feb 25, 2020
2 parents f5f7e90 + 09c920e commit 8339d79
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ addons:
before_install:
- cd src
script:
- mvn verify org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar
- mvn clean verify sonar:sonar -Pcoverage
cache:
directories:
- "$HOME/.m2/repository"
Expand Down
47 changes: 47 additions & 0 deletions src/mokka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
</dependency>
</dependencies>
</profile>

</profiles>

<!-- Package as an executable jar -->
Expand Down Expand Up @@ -282,6 +283,52 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/integration-test/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-resource</id>
<phase>generate-test-resources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/integration-test/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import pl.hycom.mokka.AbstractTest;
import pl.hycom.mokka.Application;
import pl.hycom.mokka.emulator.logs.model.Log;

import java.sql.Timestamp;
Expand All @@ -25,8 +27,11 @@
* @author Kamil Adamiec ([email protected])
*/
@DirtiesContext
@ActiveProfiles("test")
@AutoConfigureMockMvc
public class LogsControllerIntegrationTest extends AbstractTest {
@AutoConfigureTestDatabase
@SpringBootTest(classes = Application.class)
public class LogsControllerIT {

private static final String GET_LOGS_URI = "/logs";

Expand Down Expand Up @@ -91,3 +96,6 @@ private MockHttpServletRequestBuilder asyncRequest(MockHttpServletRequestBuilder
return builder.header("x-requested-with", "XMLHttpRequest");
}
}



Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.annotation.DirtiesContext;
import pl.hycom.mokka.AbstractTest;
import org.springframework.test.context.ActiveProfiles;

import static io.restassured.RestAssured.expect;

Expand All @@ -17,8 +18,10 @@
* @author Mariusz Krysztofowicz ([email protected])
*/
@DirtiesContext
@ActiveProfiles("test")
@AutoConfigureTestDatabase
@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)
public class FileControllerTest extends AbstractTest {
public class FileControllerIT {
@Value("${local.server.port}")
protected int serverPort;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package pl.hycom.mokka.service.impl;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.client.RestClientTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.client.MockRestServiceServer;
import pl.hycom.mokka.service.payment.DefaultPaymentStatusService;
import pl.hycom.mokka.service.payment.pojo.BlueMediaPayment;
Expand All @@ -21,7 +19,7 @@
*/
@RestClientTest(DefaultPaymentStatusService.class)
@ActiveProfiles("test")
public class DefaultPaymentStatusServiceTest{
public class DefaultPaymentStatusServiceIT {

@Autowired
private DefaultPaymentStatusService defaultPaymentStatusService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
@WebMvcTest(PaymentController.class)
@ActiveProfiles("test")
public class PaymentControllerTest {
public class PaymentControllerIT {

private static final String REDIRECT = "redirect:";

Expand Down
15 changes: 0 additions & 15 deletions src/mokka/src/test/java/pl/hycom/mokka/AbstractTest.java

This file was deleted.

28 changes: 28 additions & 0 deletions src/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,32 @@
<java.version>1.8</java.version>
</properties>

<profiles>
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 8339d79

Please sign in to comment.