diff --git a/src/test/java/it/reply/orchestrator/command/BaseRankCloudProviderCommandTest.java b/src/test/java/it/reply/orchestrator/command/BaseRankCloudProviderCommandTest.java index 9c994956cc..891738475d 100644 --- a/src/test/java/it/reply/orchestrator/command/BaseRankCloudProviderCommandTest.java +++ b/src/test/java/it/reply/orchestrator/command/BaseRankCloudProviderCommandTest.java @@ -1,6 +1,6 @@ package it.reply.orchestrator.command; -import it.reply.orchestrator.config.WebAppConfigurationAware; +import it.reply.orchestrator.config.specific.WebAppConfigurationAware; import it.reply.orchestrator.dto.RankCloudProvidersMessage; import it.reply.orchestrator.service.WorkflowConstants; import it.reply.orchestrator.service.commands.BaseRankCloudProvidersCommand; diff --git a/src/test/java/it/reply/orchestrator/command/NotifyCommandTest.java b/src/test/java/it/reply/orchestrator/command/NotifyCommandTest.java index 725484959a..c1f3b0e5ef 100644 --- a/src/test/java/it/reply/orchestrator/command/NotifyCommandTest.java +++ b/src/test/java/it/reply/orchestrator/command/NotifyCommandTest.java @@ -8,7 +8,7 @@ import com.github.springtestdbunit.annotation.DatabaseSetup; import com.github.springtestdbunit.annotation.DatabaseTearDown; -import it.reply.orchestrator.config.WebAppConfigurationAware; +import it.reply.orchestrator.config.specific.WebAppConfigurationAware; import it.reply.orchestrator.service.commands.Notify; import it.reply.workflowmanager.utils.Constants; diff --git a/src/test/java/it/reply/orchestrator/config/ApplicationConfigTest.java b/src/test/java/it/reply/orchestrator/config/ApplicationConfigTest.java index 11c5f4f679..a0a8b948cb 100644 --- a/src/test/java/it/reply/orchestrator/config/ApplicationConfigTest.java +++ b/src/test/java/it/reply/orchestrator/config/ApplicationConfigTest.java @@ -3,10 +3,13 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.FilterType; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; @Configuration -@ComponentScan(basePackages = { "it.reply.orchestrator", "it.reply.workflowmanager" }) +@ComponentScan(basePackages = { "it.reply.orchestrator", "it.reply.workflowmanager" }, + excludeFilters = { @ComponentScan.Filter(type = FilterType.REGEX, + pattern = "it.reply.orchestrator.config.specific.*") }) public class ApplicationConfigTest { @Bean diff --git a/src/test/java/it/reply/orchestrator/config/WebAppConfigurationAware.java b/src/test/java/it/reply/orchestrator/config/WebAppConfigurationAware.java deleted file mode 100644 index eb33ad1984..0000000000 --- a/src/test/java/it/reply/orchestrator/config/WebAppConfigurationAware.java +++ /dev/null @@ -1,52 +0,0 @@ -package it.reply.orchestrator.config; - -import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; - -import com.github.springtestdbunit.DbUnitTestExecutionListener; - -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestExecutionListeners; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; -import org.springframework.test.context.transaction.TransactionalTestExecutionListener; -import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.web.context.WebApplicationContext; - -import javax.inject.Inject; - -@RunWith(SpringJUnit4ClassRunner.class) -@WebAppConfiguration -@ContextConfiguration(classes = { ApplicationConfig.class, WebAppInitializer.class, - WebMvcConfig.class, PersistenceConfigTest.class, WorklfowPersistenceConfigTest.class }) -@TestPropertySource(locations = { "classpath:application-test.properties" }) -@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, - TransactionalTestExecutionListener.class, DbUnitTestExecutionListener.class }) -public abstract class WebAppConfigurationAware { - - @Inject - protected WebApplicationContext wac; - protected MockMvc mockMvc; - - @BeforeClass - public static void generalSetup() { - System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, - "bitronix.tm.jndi.BitronixInitialContextFactory"); - } - - @AfterClass - public static void generalCleanup() { - System.clearProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY); - } - - @Before - public void before() { - this.mockMvc = webAppContextSetup(this.wac).build(); - } - -} diff --git a/src/test/java/it/reply/orchestrator/config/specific/WebAppConfigurationAware.java b/src/test/java/it/reply/orchestrator/config/specific/WebAppConfigurationAware.java new file mode 100644 index 0000000000..5906595b84 --- /dev/null +++ b/src/test/java/it/reply/orchestrator/config/specific/WebAppConfigurationAware.java @@ -0,0 +1,90 @@ +package it.reply.orchestrator.config.specific; + +import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; + +import com.github.springtestdbunit.DbUnitTestExecutionListener; + +import it.reply.orchestrator.config.ApplicationConfig; +import it.reply.orchestrator.config.PersistenceConfigTest; +import it.reply.orchestrator.config.WebAppInitializer; +import it.reply.orchestrator.config.WebMvcConfig; +import it.reply.orchestrator.config.WorkflowConfigProducerBean; +import it.reply.orchestrator.config.WorklfowPersistenceConfigTest; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.ContextHierarchy; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.web.context.WebApplicationContext; + +import javax.inject.Inject; + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextHierarchy({ + @ContextConfiguration(name = "baseContext", + classes = { ApplicationConfig.class, WebAppInitializer.class, WebMvcConfig.class, + PersistenceConfigTest.class, WorklfowPersistenceConfigTest.class }), + @ContextConfiguration(name = "workflowContext", + classes = { WebAppConfigurationAware.Config.class }) }) +@TestPropertySource(locations = { "classpath:application-test.properties" }) +@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, + TransactionalTestExecutionListener.class, DbUnitTestExecutionListener.class }) +public abstract class WebAppConfigurationAware { + + private static final Logger LOG = LogManager.getLogger(WebAppConfigurationAware.class); + + @Inject + protected WebApplicationContext wac; + protected MockMvc mockMvc; + + @BeforeClass + public static void generalSetup() { + System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, + "bitronix.tm.jndi.BitronixInitialContextFactory"); + } + + @AfterClass + public static void generalCleanup() { + System.clearProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY); + } + + @Before + public void before() { + this.mockMvc = webAppContextSetup(this.wac).build(); + } + + @Configuration + static class Config { + @Bean + @Primary + public WorkflowConfigProducerBean produceWorkflowConfigProducerBean() { + return new WorkflowConfigProducerBean() { + + @Override + public int getExecutorServiceThreadPoolSize() { + // Disable jBPM Executor Service during Unit Tests (to avoid transaction/concurrency + // issues) + LOG.warn( + "Disable jBPM Executor Service during Unit Tests (to avoid transaction/concurrency issues)"); + return 0; + } + + }; + } + } +} diff --git a/src/test/java/it/reply/orchestrator/config/specific/WebAppConfigurationAwareIT.java b/src/test/java/it/reply/orchestrator/config/specific/WebAppConfigurationAwareIT.java new file mode 100644 index 0000000000..e23d180ed7 --- /dev/null +++ b/src/test/java/it/reply/orchestrator/config/specific/WebAppConfigurationAwareIT.java @@ -0,0 +1,34 @@ +package it.reply.orchestrator.config.specific; + +import it.reply.orchestrator.IntegrationTest; + +import org.junit.experimental.categories.Category; + +@Category(IntegrationTest.class) +// @ContextHierarchy({ @ContextConfiguration(name = "workflowContext", +// classes = { WebAppConfigurationAwareIT.Config.class }, inheritLocations = false) }) +public abstract class WebAppConfigurationAwareIT extends WebAppConfigurationAware { + + /** + * The override is not working - enable in the future. + */ + // private static final Logger LOG = LogManager.getLogger(WebAppConfigurationAware.class); + // + // @Configuration + // static class Config { + // @Bean + // @Primary + // public WorkflowConfigProducerBean produceWorkflowConfigProducerBean() { + // return new WorkflowConfigProducerBean() { + // + // @Override + // public int getExecutorServiceThreadPoolSize() { + // // Enable jBPM Executor Service during Integration Tests + // LOG.warn("Enable jBPM Executor Service during Integration Tests"); + // return 2; + // } + // + // }; + // } + // } +} diff --git a/src/test/java/it/reply/orchestrator/controller/DeploymentControllerTest.java b/src/test/java/it/reply/orchestrator/controller/DeploymentControllerTest.java index 5847a981c6..76b45cf224 100644 --- a/src/test/java/it/reply/orchestrator/controller/DeploymentControllerTest.java +++ b/src/test/java/it/reply/orchestrator/controller/DeploymentControllerTest.java @@ -23,7 +23,7 @@ import com.github.springtestdbunit.annotation.DatabaseSetup; import com.github.springtestdbunit.annotation.DatabaseTearDown; -import it.reply.orchestrator.config.WebAppConfigurationAware; +import it.reply.orchestrator.config.specific.WebAppConfigurationAware; import it.reply.orchestrator.dto.request.DeploymentRequest; import it.reply.orchestrator.util.TestUtil; import it.reply.orchestrator.utils.CommonUtils; diff --git a/src/test/java/it/reply/orchestrator/controller/ResourceControllerTest.java b/src/test/java/it/reply/orchestrator/controller/ResourceControllerTest.java index 09f53169b6..408ba04deb 100644 --- a/src/test/java/it/reply/orchestrator/controller/ResourceControllerTest.java +++ b/src/test/java/it/reply/orchestrator/controller/ResourceControllerTest.java @@ -17,7 +17,7 @@ import com.github.springtestdbunit.annotation.DatabaseSetup; import com.github.springtestdbunit.annotation.DatabaseTearDown; -import it.reply.orchestrator.config.WebAppConfigurationAware; +import it.reply.orchestrator.config.specific.WebAppConfigurationAware; import org.junit.Before; import org.junit.Rule; diff --git a/src/test/java/it/reply/orchestrator/controller/TemplateControllerTest.java b/src/test/java/it/reply/orchestrator/controller/TemplateControllerTest.java index 1e3f36bff3..964baa481a 100644 --- a/src/test/java/it/reply/orchestrator/controller/TemplateControllerTest.java +++ b/src/test/java/it/reply/orchestrator/controller/TemplateControllerTest.java @@ -15,7 +15,7 @@ import es.upv.i3m.grycap.file.NoNullOrEmptyFile; import es.upv.i3m.grycap.file.Utf8File; -import it.reply.orchestrator.config.WebAppConfigurationAware; +import it.reply.orchestrator.config.specific.WebAppConfigurationAware; import org.junit.Before; import org.junit.Rule; diff --git a/src/test/java/it/reply/orchestrator/dal/ResourceRepositoryTest.java b/src/test/java/it/reply/orchestrator/dal/ResourceRepositoryTest.java index f9dadc578f..44a513afec 100644 --- a/src/test/java/it/reply/orchestrator/dal/ResourceRepositoryTest.java +++ b/src/test/java/it/reply/orchestrator/dal/ResourceRepositoryTest.java @@ -7,7 +7,7 @@ import com.github.springtestdbunit.annotation.DatabaseSetup; import com.github.springtestdbunit.annotation.DatabaseTearDown; -import it.reply.orchestrator.config.WebAppConfigurationAware; +import it.reply.orchestrator.config.specific.WebAppConfigurationAware; import it.reply.orchestrator.dal.entity.Resource; import it.reply.orchestrator.dal.repository.ResourceRepository; diff --git a/src/test/java/it/reply/orchestrator/service/ChronosServiceTest.java b/src/test/java/it/reply/orchestrator/service/ChronosServiceTest.java index 8e8742529b..89ad82d0a7 100644 --- a/src/test/java/it/reply/orchestrator/service/ChronosServiceTest.java +++ b/src/test/java/it/reply/orchestrator/service/ChronosServiceTest.java @@ -1,25 +1,25 @@ -package it.reply.orchestrator.service; - -import it.reply.orchestrator.config.WebAppConfigurationAware; -import it.reply.orchestrator.service.commands.chronos.DeployOnChronos; - -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -public class ChronosServiceTest extends WebAppConfigurationAware { - - @Autowired - private DeployOnChronos service; - - private String deploymentId = "deployment_id"; - - @Test - public void customizeTemplateWithDeplymentIdSuccessfully() throws Exception { - - // service.chronosHelloWorld(deploymentId, false); - // service.chronosHelloWorld(deploymentId, true); - - // assertEquals(deploymentId, templateDeploymentId); - } - -} +// package it.reply.orchestrator.service; +// +// import it.reply.orchestrator.config.specific.WebAppConfigurationAwareIT; +// import it.reply.orchestrator.service.commands.chronos.DeployOnChronos; +// +// import org.junit.Test; +// import org.springframework.beans.factory.annotation.Autowired; +// +// public class ChronosServiceTest extends WebAppConfigurationAwareIT { +// +// @Autowired +// private DeployOnChronos service; +// +// private String deploymentId = "deployment_id"; +// +// @Test +// public void customizeTemplateWithDeplymentIdSuccessfully() throws Exception { +// +// // service.chronosHelloWorld(deploymentId, false); +// // service.chronosHelloWorld(deploymentId, true); +// +// // assertEquals(deploymentId, templateDeploymentId); +// } +// +// } diff --git a/src/test/java/it/reply/orchestrator/service/CloudProviderRankerServiceTest.java b/src/test/java/it/reply/orchestrator/service/CloudProviderRankerServiceTest.java index f791f79e72..66243a56f4 100644 --- a/src/test/java/it/reply/orchestrator/service/CloudProviderRankerServiceTest.java +++ b/src/test/java/it/reply/orchestrator/service/CloudProviderRankerServiceTest.java @@ -5,7 +5,7 @@ import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; -import it.reply.orchestrator.config.WebAppConfigurationAware; +import it.reply.orchestrator.config.specific.WebAppConfigurationAwareIT; import it.reply.orchestrator.dto.ranker.CloudProviderRankerRequest; import it.reply.orchestrator.dto.ranker.RankedCloudProvider; import it.reply.utils.json.JsonUtility; @@ -21,7 +21,7 @@ import java.util.Arrays; import java.util.List; -public class CloudProviderRankerServiceTest extends WebAppConfigurationAware { +public class CloudProviderRankerServiceTest extends WebAppConfigurationAwareIT { @Autowired private CloudProviderRankerService cloudProviderRankerService; diff --git a/src/test/java/it/reply/orchestrator/service/CmdbServiceIT.java b/src/test/java/it/reply/orchestrator/service/CmdbServiceIT.java index 8dfafed687..7554e61436 100644 --- a/src/test/java/it/reply/orchestrator/service/CmdbServiceIT.java +++ b/src/test/java/it/reply/orchestrator/service/CmdbServiceIT.java @@ -1,79 +1,76 @@ -package it.reply.orchestrator.service; - -import static org.junit.Assert.assertEquals; - -import it.reply.orchestrator.IntegrationTest; -import it.reply.orchestrator.config.WebAppConfigurationAware; -import it.reply.orchestrator.dto.cmdb.Data; -import it.reply.orchestrator.dto.cmdb.Provider; -import it.reply.orchestrator.dto.cmdb.ProviderData; -import it.reply.orchestrator.dto.cmdb.Service; -import it.reply.orchestrator.dto.cmdb.Type; - -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.client.RestTemplate; - -@Category(IntegrationTest.class) -public class CmdbServiceIT extends WebAppConfigurationAware { - - private final String recasId = "4401ac5dc8cfbbb737b0a02575e6f4bc"; - private final String recasProviderName = "provider-RECAS-BARI"; - - @Autowired - private CmdbService service; - - // private MockRestServiceServer mockServer; - - @Autowired - private RestTemplate restTemplate; - - @Before - public void setUp() { - // mockServer = MockRestServiceServer.createServer(restTemplate); - } - - @Test - public void getServiceTest() throws Exception { - - // mockServer.expect(requestTo("http://test-server.com")).andExpect(method(HttpMethod.POST)) - // .andRespond(withSuccess()); - - Service serviceRecas = service.getServiceById(recasId); - Data data = new Data().withServiceType("eu.egi.cloud.vm-management.openstack") - .withEndpoint("http://cloud.recas.ba.infn.it:5000/v2.0") - .withProviderId("provider-RECAS-BARI").withType(Type.COMPUTE); - - Service service = new Service().withId(recasId).withRev("1-256d36283315ea9bb045e6d5038657b6") - .withType("service").withData(data); - - assertEquals(service, serviceRecas); - - // mockServer.verify(); - - } - - @Test - public void getProviderTest() throws Exception { - - // mockServer.expect(requestTo("http://test-server.com")).andExpect(method(HttpMethod.POST)) - // .andRespond(withSuccess()); - - Provider providerRecas = service.getProviderById(recasProviderName); - ProviderData data = - new ProviderData().withId("476").withPrimaryKey("83757G0").withName("RECAS-BARI") - .withCountry("Italy").withCountryCode("IT").withRoc("NGI_IT").withSubgrid("") - .withGiisUrl("ldap://cloud-bdii.recas.ba.infn.it:2170/GLUE2DomainID=RECAS-BARI,o=glue"); - - Provider provider = new Provider().withId(recasProviderName) - .withRev("1-c7dbe4d8be30aa4c0f14d3ad0411d962").withType("provider").withData(data); - - assertEquals(provider, providerRecas); - - // mockServer.verify(); - - } - -} +// package it.reply.orchestrator.service; +// +// import static org.junit.Assert.assertEquals; +// +// import it.reply.orchestrator.config.specific.WebAppConfigurationAwareIT; +// import it.reply.orchestrator.dto.cmdb.Data; +// import it.reply.orchestrator.dto.cmdb.Provider; +// import it.reply.orchestrator.dto.cmdb.ProviderData; +// import it.reply.orchestrator.dto.cmdb.Service; +// import it.reply.orchestrator.dto.cmdb.Type; +// +// import org.junit.Before; +// import org.junit.Test; +// import org.springframework.beans.factory.annotation.Autowired; +// import org.springframework.web.client.RestTemplate; +// +// public class CmdbServiceIT extends WebAppConfigurationAwareIT { +// +// private final String recasId = "4401ac5dc8cfbbb737b0a02575e6f4bc"; +// private final String recasProviderName = "provider-RECAS-BARI"; +// +// @Autowired +// private CmdbService service; +// +// // private MockRestServiceServer mockServer; +// +// @Autowired +// private RestTemplate restTemplate; +// +// @Before +// public void setUp() { +// // mockServer = MockRestServiceServer.createServer(restTemplate); +// } +// +// @Test +// public void getServiceTest() throws Exception { +// +// // mockServer.expect(requestTo("http://test-server.com")).andExpect(method(HttpMethod.POST)) +// // .andRespond(withSuccess()); +// +// Service serviceRecas = service.getServiceById(recasId); +// Data data = new Data().withServiceType("eu.egi.cloud.vm-management.openstack") +// .withEndpoint("http://cloud.recas.ba.infn.it:5000/v2.0") +// .withProviderId("provider-RECAS-BARI").withType(Type.COMPUTE); +// +// Service service = new Service().withId(recasId).withRev("1-256d36283315ea9bb045e6d5038657b6") +// .withType("service").withData(data); +// +// assertEquals(service, serviceRecas); +// +// // mockServer.verify(); +// +// } +// +// @Test +// public void getProviderTest() throws Exception { +// +// // mockServer.expect(requestTo("http://test-server.com")).andExpect(method(HttpMethod.POST)) +// // .andRespond(withSuccess()); +// +// Provider providerRecas = service.getProviderById(recasProviderName); +// ProviderData data = +// new ProviderData().withId("476").withPrimaryKey("83757G0").withName("RECAS-BARI") +// .withCountry("Italy").withCountryCode("IT").withRoc("NGI_IT").withSubgrid("") +// .withGiisUrl("ldap://cloud-bdii.recas.ba.infn.it:2170/GLUE2DomainID=RECAS-BARI,o=glue"); +// +// Provider provider = new Provider().withId(recasProviderName) +// .withRev("1-c7dbe4d8be30aa4c0f14d3ad0411d962").withType("provider").withData(data); +// +// assertEquals(provider, providerRecas); +// +// // mockServer.verify(); +// +// } +// +// } diff --git a/src/test/java/it/reply/orchestrator/service/ResourceServiceTest.java b/src/test/java/it/reply/orchestrator/service/ResourceServiceTest.java index 89bb6056e6..d3bc407238 100644 --- a/src/test/java/it/reply/orchestrator/service/ResourceServiceTest.java +++ b/src/test/java/it/reply/orchestrator/service/ResourceServiceTest.java @@ -5,7 +5,7 @@ import com.github.springtestdbunit.annotation.DatabaseSetup; import com.github.springtestdbunit.annotation.DatabaseTearDown; -import it.reply.orchestrator.config.WebAppConfigurationAware; +import it.reply.orchestrator.config.specific.WebAppConfigurationAware; import it.reply.orchestrator.dal.entity.Resource; import it.reply.orchestrator.exception.http.NotFoundException; diff --git a/src/test/java/it/reply/orchestrator/service/SlamServiceIT.java b/src/test/java/it/reply/orchestrator/service/SlamServiceIT.java index 2008a55b95..e0124672fd 100644 --- a/src/test/java/it/reply/orchestrator/service/SlamServiceIT.java +++ b/src/test/java/it/reply/orchestrator/service/SlamServiceIT.java @@ -1,44 +1,41 @@ -package it.reply.orchestrator.service; - -import static org.junit.Assert.assertEquals; - -import it.reply.orchestrator.IntegrationTest; -import it.reply.orchestrator.config.WebAppConfigurationAware; -import it.reply.orchestrator.dto.slam.SlamPreferences; - -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.springframework.beans.factory.annotation.Autowired; - -@Category(IntegrationTest.class) -public class SlamServiceIT extends WebAppConfigurationAware { - - @Autowired - private SlamService service; - - // private MockRestServiceServer mockServer; - - // @Autowired - // private RestTemplate restTemplate; - - @Before - public void setUp() { - // mockServer = MockRestServiceServer.createServer(restTemplate); - } - - @Test - public void getPreferencesTest() throws Exception { - - // mockServer.expect(requestTo("http://test-server.com")).andExpect(method(HttpMethod.POST)) - // .andRespond(withSuccess()); - - SlamPreferences pref = service.getCustomerPreferences(); - - assertEquals("4401ac5dc8cfbbb737b0a02575ee3b58", pref.getSla().get(0).getId()); - - // mockServer.verify(); - - } - -} +// package it.reply.orchestrator.service; +// +// import static org.junit.Assert.assertEquals; +// +// import it.reply.orchestrator.config.specific.WebAppConfigurationAwareIT; +// import it.reply.orchestrator.dto.slam.SlamPreferences; +// +// import org.junit.Before; +// import org.junit.Test; +// import org.springframework.beans.factory.annotation.Autowired; +// +// public class SlamServiceIT extends WebAppConfigurationAwareIT { +// +// @Autowired +// private SlamService service; +// +// // private MockRestServiceServer mockServer; +// +// // @Autowired +// // private RestTemplate restTemplate; +// +// @Before +// public void setUp() { +// // mockServer = MockRestServiceServer.createServer(restTemplate); +// } +// +// @Test +// public void getPreferencesTest() throws Exception { +// +// // mockServer.expect(requestTo("http://test-server.com")).andExpect(method(HttpMethod.POST)) +// // .andRespond(withSuccess()); +// +// SlamPreferences pref = service.getCustomerPreferences(); +// +// assertEquals("4401ac5dc8cfbbb737b0a02575ee3b58", pref.getSla().get(0).getId()); +// +// // mockServer.verify(); +// +// } +// +// } diff --git a/src/test/java/it/reply/orchestrator/service/ToscaServiceTest.java b/src/test/java/it/reply/orchestrator/service/ToscaServiceTest.java index 2cff1c0d45..ad92a424e4 100644 --- a/src/test/java/it/reply/orchestrator/service/ToscaServiceTest.java +++ b/src/test/java/it/reply/orchestrator/service/ToscaServiceTest.java @@ -17,7 +17,7 @@ import es.upv.i3m.grycap.file.Utf8File; import es.upv.i3m.grycap.im.exceptions.FileException; -import it.reply.orchestrator.config.WebAppConfigurationAware; +import it.reply.orchestrator.config.specific.WebAppConfigurationAware; import it.reply.orchestrator.exception.service.ToscaException; import org.junit.Rule;