Skip to content
Snippets Groups Projects
Commit bc3f28a8 authored by tranoris's avatar tranoris
Browse files

Merge branch '4-fix-rulesintegrationtest-unit-test' into 'develop'

Fixed rulesintegrationtest

See merge request !4
parents 44445797 caa489a8
No related branches found
No related tags found
2 merge requests!7Merging 2024Q2_RC into main, creating 2024Q2 Release,!4Fixed rulesintegrationtest
Pipeline #4133 passed
......@@ -96,11 +96,6 @@
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
......@@ -114,8 +109,6 @@
</dependency>
<!-- activeMQ -->
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -137,6 +130,7 @@
<artifactId>pooled-jms</artifactId>
</dependency>
<!-- Camel -->
<dependency>
<groupId>org.apache.camel.springboot</groupId>
......@@ -174,16 +168,13 @@
<artifactId>camel-stream</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- security -->
<!-- security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
......@@ -225,9 +216,6 @@
<!-- database -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
......@@ -254,8 +242,6 @@
<!-- Testing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......@@ -288,7 +274,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
......@@ -296,6 +281,13 @@
</dependency>
<!--javax.jms -->
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
<build>
......
......@@ -30,11 +30,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import org.apache.commons.io.IOUtils;
import org.etsi.osl.oas.AlarmHandling;
import org.etsi.osl.oas.OasSpingBoot;
import org.etsi.osl.oas.model.Action;
import org.etsi.osl.oas.model.ActionCharacteristic;
import org.etsi.osl.oas.model.ActionParam;
......@@ -101,7 +98,7 @@ public class RulesIntegrationTest {
@WithMockUser(username = "osadmin", roles = { "ADMIN", "USER" })
@Test
public void testRuleCreateAndUpdate() throws UnsupportedEncodingException, IOException, Exception {
public void testRuleCreateAndUpdate() throws Exception {
ActionSpecificationCreate actionCreate = new ActionSpecificationCreate();
actionCreate.setName("scaleEqually");
......@@ -211,7 +208,7 @@ public class RulesIntegrationTest {
scope.setEntityUUID("UUIDREFTEST2");
rule.setScope(scope);
responseRule = mvc
mvc
.perform(MockMvcRequestBuilders.post("/assuranceServicesManagement/v1/ruleSpecification")
.with(SecurityMockMvcRequestPostProcessors.csrf()).contentType(MediaType.APPLICATION_JSON)
.content(toJson(rule)))
......@@ -229,7 +226,7 @@ public class RulesIntegrationTest {
@WithMockUser(username = "osadmin", roles = { "ADMIN", "USER" })
@Test
public void testRuleCreateFromFiles() throws UnsupportedEncodingException, IOException, Exception {
public void testRuleCreateFromFiles() throws Exception {
File faction = new File( "src/test/resources/testAction.json" );
InputStream in = new FileInputStream( faction );
......@@ -422,22 +419,10 @@ public class RulesIntegrationTest {
return mapper.writeValueAsBytes(object);
}
static String toJsonString(Object object) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
return mapper.writeValueAsString(object);
}
static <T> T toJsonObj(String content, Class<T> valueType) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
return mapper.readValue(content, valueType);
}
static <T> T toJsonObj(InputStream content, Class<T> valueType) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
return mapper.readValue(content, valueType);
}
}
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