Commit 3807c1ae authored by Nikolaos Kyriakoulis's avatar Nikolaos Kyriakoulis
Browse files

Added @AutoConfigureTestDatabase annotation in ServiceCatalogIntegrationTest...

Added @AutoConfigureTestDatabase annotation in ServiceCatalogIntegrationTest and ServiceSpecificationApiControllerTest
parent 782556b5
Loading
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
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.http.MediaType;
@@ -103,7 +104,7 @@ import net.minidev.json.JSONObject;
@RunWith(SpringRunner.class)
@Transactional
@SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.MOCK , classes = OpenAPISpringBoot.class)
//@AutoConfigureTestDatabase //this automatically uses h2
@AutoConfigureTestDatabase //this automatically uses h2
@AutoConfigureMockMvc 
@ActiveProfiles("testing")
//@TestPropertySource(
@@ -113,9 +114,7 @@ public class ServiceCatalogIntegrationTest {

	private static final transient Log logger = LogFactory.getLog( ServiceCatalogIntegrationTest.class.getName());

	private static final int FIXED_BOOTSTRAPS_SPECS = 3;

	private static final int FIXED_BOOTSTRAPS_REFS = 1;
	private static final int FIXED_BOOTSTRAPS_SPECS = 1;

    @Autowired
    private MockMvc mvc;
@@ -163,10 +162,10 @@ public class ServiceCatalogIntegrationTest {
		assertThat( categRepoService.findByName( "Generic Services" )  ).isNotNull() ;
		
		ServiceCategory categ = categRepoService.findByName( "Generic Services" );
		assertThat( categ.getServiceCandidateRefs().size() ).isEqualTo( FIXED_BOOTSTRAPS_REFS );
		assertThat( categ.getServiceCandidateRefs().size() ).isEqualTo( FIXED_BOOTSTRAPS_SPECS );
		
		ServiceCategory categ2 = categRepoService.findByIdEager( categ.getId() );
		assertThat( categ2.getServiceCandidateRefs().size() ).isEqualTo( FIXED_BOOTSTRAPS_REFS );
		assertThat( categ2.getServiceCandidateRefs().size() ).isEqualTo( FIXED_BOOTSTRAPS_SPECS );
		
		boolean vinnisbFound = false;
		boolean gstFound = false;
@@ -1015,7 +1014,7 @@ public class ServiceCatalogIntegrationTest {
		
		ServiceCategory categ = categRepoService.findByName( "Generic Services" );
		ServiceCategory categ2 = categRepoService.findByIdEager( categ.getId() );
		assertThat( categ2.getServiceCandidateRefs().size() ).isEqualTo( FIXED_BOOTSTRAPS_REFS );
		assertThat( categ2.getServiceCandidateRefs().size() ).isEqualTo( FIXED_BOOTSTRAPS_SPECS );
		
		ServiceSpecification spec = this.specRepoService.findByNameAndVersion("A GST(NEST) Service Example", "5.0.0" );
		assertThat( spec ).isNotNull();
+3 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
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.http.HttpHeaders;
@@ -47,11 +48,12 @@ import org.springframework.web.context.WebApplicationContext;
@RunWith(SpringRunner.class)
@Transactional
@SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.MOCK , classes = OpenAPISpringBoot.class)
@AutoConfigureTestDatabase //this automatically uses h2
@AutoConfigureMockMvc
@ActiveProfiles("testing")
public class ServiceSpecificationApiControllerTest {

    private static final int FIXED_BOOTSTRAPS_SPECS = 3;
    private static final int FIXED_BOOTSTRAPS_SPECS = 1;

    @Autowired
    private MockMvc mvc;