Loading vessels-view/src/main/resources/application.properties +1 −2 Original line number Diff line number Diff line Loading @@ -5,8 +5,7 @@ server.servlet.path=/vessels/view vesseltracking.activity.id=999 documentation.VESSEL_HOST=redmic.es${server.servlet.context-path}${server.servlet.path} documentation.VESSELTYPE_HOST=${documentation.VESSEL_HOST}${controller.mapping.vesseltype} documentation.VESSELTRACKING_HOST=${documentation.VESSEL_HOST}${controller.mapping.vesseltracking} spring.profiles.active=@spring.profiles.active@ info.vessels-view.name=@project.name@ Loading vessels-view/src/test/java/es/redmic/test/vesselsview/integration/controller/VesselControllerTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.util.Arrays; import java.util.Map; import javax.annotation.PostConstruct; Loading @@ -33,6 +34,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import es.redmic.models.es.common.query.dto.MetadataQueryDTO; import es.redmic.models.es.common.query.dto.MgetDTO; import es.redmic.testutils.documentation.DocumentationViewBaseTest; import es.redmic.testutils.utils.JsonToBeanTestUtil; import es.redmic.vesselsview.VesselsViewApplication; import es.redmic.vesselsview.model.vessel.Vessel; import es.redmic.vesselsview.model.vesseltype.VesselType; Loading Loading @@ -226,21 +228,21 @@ public class VesselControllerTest extends DocumentationViewBaseTest { // @formatter:on } @SuppressWarnings("unchecked") @Test public void getFilterSchema_Return200_WhenSchemaIsAvailable() throws Exception { // @formatter:off Map<String, Object> schemaExpected = (Map<String, Object>) JsonToBeanTestUtil .getBean("/data/schemas/vesselqueryschema.json", Map.class); this.mockMvc.perform(get(filterSchemaPath) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.success", is(true))) .andExpect(jsonPath("$.body", notNullValue())) .andExpect(jsonPath("$.body.schema", notNullValue())) .andExpect(jsonPath("$.body.schema.properties", notNullValue())) .andExpect(jsonPath("$.body.schema.properties.postFilter", notNullValue())) .andExpect(jsonPath("$.body.schema.properties.aggs", notNullValue())); // TODO: aumentar el nivel de checkeo .andExpect(jsonPath("$.body", is(schemaExpected))); // @formatter:on } } vessels-view/src/test/java/es/redmic/test/vesselsview/integration/controller/VesselTrackingControllerTest.java +12 −9 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.UUID; import javax.annotation.PostConstruct; Loading Loading @@ -39,6 +40,7 @@ import com.vividsolutions.jts.geom.Point; import es.redmic.models.es.common.query.dto.DataQueryDTO; import es.redmic.models.es.common.query.dto.MgetDTO; import es.redmic.testutils.documentation.DocumentationViewBaseTest; import es.redmic.testutils.utils.JsonToBeanTestUtil; import es.redmic.vesselsview.VesselsViewApplication; import es.redmic.vesselsview.model.vessel.Vessel; import es.redmic.vesselsview.model.vesseltracking.VesselTracking; Loading @@ -54,8 +56,8 @@ public class VesselTrackingControllerTest extends DocumentationViewBaseTest { public final static String PREFIX = "vesseltracking-mmsi-tstamp-", MMSI = "1234", USER = "1"; @Value("${documentation.VESSELTRACKING_HOST}") private String VESSELTRACKING_HOST; @Value("${documentation.VESSEL_HOST}") private String HOST; @Value("${controller.mapping.vesseltracking}") private String VESSELTRACKING_PATH; Loading Loading @@ -136,7 +138,7 @@ public class VesselTrackingControllerTest extends DocumentationViewBaseTest { .webAppContextSetup(webApplicationContext) .addFilters(springSecurityFilterChain) .apply(documentationConfiguration(this.restDocumentation) .uris().withScheme(SCHEME).withHost(VESSELTRACKING_HOST.replace("{activityId}", ACTIVITY_ID)) .uris().withScheme(SCHEME).withHost(HOST.replace("{activityId}", ACTIVITY_ID)) .withPort(PORT)) .alwaysDo(this.document).build(); Loading @@ -149,7 +151,7 @@ public class VesselTrackingControllerTest extends DocumentationViewBaseTest { } @Test public void getVessel_Return200_WhenItemExist() throws Exception { public void getVesselTracking_Return200_WhenItemExist() throws Exception { // @formatter:off Loading Loading @@ -243,9 +245,13 @@ public class VesselTrackingControllerTest extends DocumentationViewBaseTest { // @formatter:on } @SuppressWarnings("unchecked") @Test public void getFilterSchema_Return200_WhenSchemaIsAvailable() throws Exception { Map<String, Object> schemaExpected = (Map<String, Object>) JsonToBeanTestUtil .getBean("/data/schemas/vesseltrackingqueryschema.json", Map.class); // @formatter:off this.mockMvc.perform(get(url + filterSchemaPath) Loading @@ -253,11 +259,8 @@ public class VesselTrackingControllerTest extends DocumentationViewBaseTest { .andExpect(status().isOk()) .andExpect(jsonPath("$.success", is(true))) .andExpect(jsonPath("$.body", notNullValue())) .andExpect(jsonPath("$.body.schema", notNullValue())) .andExpect(jsonPath("$.body.schema.properties", notNullValue())) .andExpect(jsonPath("$.body.schema.properties.postFilter", notNullValue())) .andExpect(jsonPath("$.body.schema.properties.aggs", notNullValue())); // TODO: aumentar el nivel de checkeo .andExpect(jsonPath("$.body", notNullValue())) .andExpect(jsonPath("$.body", is(schemaExpected))); // @formatter:on } } vessels-view/src/test/java/es/redmic/test/vesselsview/integration/controller/VesselTypeControllerTest.java +11 −8 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.util.Arrays; import java.util.Map; import javax.annotation.PostConstruct; Loading @@ -33,6 +34,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import es.redmic.models.es.common.query.dto.MgetDTO; import es.redmic.models.es.common.query.dto.SimpleQueryDTO; import es.redmic.testutils.documentation.DocumentationViewBaseTest; import es.redmic.testutils.utils.JsonToBeanTestUtil; import es.redmic.vesselsview.VesselsViewApplication; import es.redmic.vesselsview.model.vesseltype.VesselType; import es.redmic.vesselsview.repository.vesseltype.VesselTypeESRepository; Loading @@ -43,8 +45,8 @@ import es.redmic.vesselsview.repository.vesseltype.VesselTypeESRepository; @DirtiesContext public class VesselTypeControllerTest extends DocumentationViewBaseTest { @Value("${documentation.VESSELTYPE_HOST}") private String VESSELTYPE_HOST; @Value("${documentation.VESSEL_HOST}") private String HOST; @Value("${controller.mapping.vesseltype}") private String VESSELTYPE_PATH; Loading Loading @@ -82,7 +84,7 @@ public class VesselTypeControllerTest extends DocumentationViewBaseTest { .webAppContextSetup(webApplicationContext) .addFilters(springSecurityFilterChain) .apply(documentationConfiguration(this.restDocumentation) .uris().withScheme(SCHEME).withHost(VESSELTYPE_HOST).withPort(PORT)) .uris().withScheme(SCHEME).withHost(HOST).withPort(PORT)) .alwaysDo(this.document).build(); // @formatter:on Loading Loading @@ -218,9 +220,13 @@ public class VesselTypeControllerTest extends DocumentationViewBaseTest { // @formatter:on } @SuppressWarnings("unchecked") @Test public void getFilterSchema_Return200_WhenSchemaIsAvailable() throws Exception { Map<String, Object> schemaExpected = (Map<String, Object>) JsonToBeanTestUtil .getBean("/data/schemas/vesseltypequeryschema.json", Map.class); // @formatter:off this.mockMvc.perform(get(VESSELTYPE_PATH + filterSchemaPath) Loading @@ -228,11 +234,8 @@ public class VesselTypeControllerTest extends DocumentationViewBaseTest { .andExpect(status().isOk()) .andExpect(jsonPath("$.success", is(true))) .andExpect(jsonPath("$.body", notNullValue())) .andExpect(jsonPath("$.body.schema", notNullValue())) .andExpect(jsonPath("$.body.schema.properties", notNullValue())) .andExpect(jsonPath("$.body.schema.properties.postFilter").doesNotExist()) .andExpect(jsonPath("$.body.schema.properties.aggs").doesNotExist()); // TODO: aumentar el nivel de checkeo .andExpect(jsonPath("$.body", notNullValue())) .andExpect(jsonPath("$.body", is(schemaExpected))); // @formatter:on } } vessels-view/src/test/resources/data/schemas/vesselqueryschema.json 0 → 100644 +1 −0 Original line number Diff line number Diff line {"schema":{"$schema":"http://json-schema.org/draft-04/schema#","title":"Metadata Query DTO","type":"object","properties":{"from":{"type":["integer","null"],"default":"0"},"size":{"type":["integer","null"],"default":"100"},"terms":{"type":["object","null"],"additionalProperties":true},"sorts":{"type":["array","null"],"uniqueItems":true,"items":{"$ref":"#/definitions/SortDTO"}},"returnFields":{"type":["array","null"],"uniqueItems":true,"items":{"type":"string"}},"text":{"$ref":"#/definitions/TextQueryDTO"},"suggest":{"$ref":"#/definitions/SuggestQueryDTO"},"regexp":{"type":["array","null"],"uniqueItems":true,"items":{"$ref":"#/definitions/RegexpDTO"}},"postFilter":{"type":["object","null"],"additionalProperties":true},"aggs":{"type":["array","null"],"uniqueItems":true,"items":{"$ref":"#/definitions/AggsPropertiesDTO"}}},"definitions":{"SortDTO":{"type":["object","null"],"properties":{"field":{"type":"string"},"order":{"type":"string"}},"required":["field","order"]},"TextQueryDTO":{"type":["object","null"],"properties":{"text":{"type":"string","minLength":2},"searchFields":{"type":["array","null"],"uniqueItems":true,"items":{"type":"string"}},"highlightFields":{"type":["array","null"],"uniqueItems":true,"items":{"type":"string"}}},"required":["text"]},"SuggestQueryDTO":{"type":["object","null"],"properties":{"text":{"type":"string","minLength":2},"searchFields":{"type":["array","null"],"uniqueItems":true,"items":{"type":"string"}},"size":{"type":["integer","null"]}},"required":["text"]},"RegexpDTO":{"type":["object","null"],"properties":{"field":{"type":"string"},"exp":{"type":"string"}},"required":["field","exp"]},"AggsPropertiesDTO":{"type":["object","null"],"properties":{"field":{"type":"string"},"term":{"type":"string"},"nested":{"type":["string","null"]},"size":{"type":["integer","null"],"default":"20"},"minCount":{"type":["integer","null"]}},"required":["field","term"]}}}} No newline at end of file Loading
vessels-view/src/main/resources/application.properties +1 −2 Original line number Diff line number Diff line Loading @@ -5,8 +5,7 @@ server.servlet.path=/vessels/view vesseltracking.activity.id=999 documentation.VESSEL_HOST=redmic.es${server.servlet.context-path}${server.servlet.path} documentation.VESSELTYPE_HOST=${documentation.VESSEL_HOST}${controller.mapping.vesseltype} documentation.VESSELTRACKING_HOST=${documentation.VESSEL_HOST}${controller.mapping.vesseltracking} spring.profiles.active=@spring.profiles.active@ info.vessels-view.name=@project.name@ Loading
vessels-view/src/test/java/es/redmic/test/vesselsview/integration/controller/VesselControllerTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.util.Arrays; import java.util.Map; import javax.annotation.PostConstruct; Loading @@ -33,6 +34,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import es.redmic.models.es.common.query.dto.MetadataQueryDTO; import es.redmic.models.es.common.query.dto.MgetDTO; import es.redmic.testutils.documentation.DocumentationViewBaseTest; import es.redmic.testutils.utils.JsonToBeanTestUtil; import es.redmic.vesselsview.VesselsViewApplication; import es.redmic.vesselsview.model.vessel.Vessel; import es.redmic.vesselsview.model.vesseltype.VesselType; Loading Loading @@ -226,21 +228,21 @@ public class VesselControllerTest extends DocumentationViewBaseTest { // @formatter:on } @SuppressWarnings("unchecked") @Test public void getFilterSchema_Return200_WhenSchemaIsAvailable() throws Exception { // @formatter:off Map<String, Object> schemaExpected = (Map<String, Object>) JsonToBeanTestUtil .getBean("/data/schemas/vesselqueryschema.json", Map.class); this.mockMvc.perform(get(filterSchemaPath) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.success", is(true))) .andExpect(jsonPath("$.body", notNullValue())) .andExpect(jsonPath("$.body.schema", notNullValue())) .andExpect(jsonPath("$.body.schema.properties", notNullValue())) .andExpect(jsonPath("$.body.schema.properties.postFilter", notNullValue())) .andExpect(jsonPath("$.body.schema.properties.aggs", notNullValue())); // TODO: aumentar el nivel de checkeo .andExpect(jsonPath("$.body", is(schemaExpected))); // @formatter:on } }
vessels-view/src/test/java/es/redmic/test/vesselsview/integration/controller/VesselTrackingControllerTest.java +12 −9 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.UUID; import javax.annotation.PostConstruct; Loading Loading @@ -39,6 +40,7 @@ import com.vividsolutions.jts.geom.Point; import es.redmic.models.es.common.query.dto.DataQueryDTO; import es.redmic.models.es.common.query.dto.MgetDTO; import es.redmic.testutils.documentation.DocumentationViewBaseTest; import es.redmic.testutils.utils.JsonToBeanTestUtil; import es.redmic.vesselsview.VesselsViewApplication; import es.redmic.vesselsview.model.vessel.Vessel; import es.redmic.vesselsview.model.vesseltracking.VesselTracking; Loading @@ -54,8 +56,8 @@ public class VesselTrackingControllerTest extends DocumentationViewBaseTest { public final static String PREFIX = "vesseltracking-mmsi-tstamp-", MMSI = "1234", USER = "1"; @Value("${documentation.VESSELTRACKING_HOST}") private String VESSELTRACKING_HOST; @Value("${documentation.VESSEL_HOST}") private String HOST; @Value("${controller.mapping.vesseltracking}") private String VESSELTRACKING_PATH; Loading Loading @@ -136,7 +138,7 @@ public class VesselTrackingControllerTest extends DocumentationViewBaseTest { .webAppContextSetup(webApplicationContext) .addFilters(springSecurityFilterChain) .apply(documentationConfiguration(this.restDocumentation) .uris().withScheme(SCHEME).withHost(VESSELTRACKING_HOST.replace("{activityId}", ACTIVITY_ID)) .uris().withScheme(SCHEME).withHost(HOST.replace("{activityId}", ACTIVITY_ID)) .withPort(PORT)) .alwaysDo(this.document).build(); Loading @@ -149,7 +151,7 @@ public class VesselTrackingControllerTest extends DocumentationViewBaseTest { } @Test public void getVessel_Return200_WhenItemExist() throws Exception { public void getVesselTracking_Return200_WhenItemExist() throws Exception { // @formatter:off Loading Loading @@ -243,9 +245,13 @@ public class VesselTrackingControllerTest extends DocumentationViewBaseTest { // @formatter:on } @SuppressWarnings("unchecked") @Test public void getFilterSchema_Return200_WhenSchemaIsAvailable() throws Exception { Map<String, Object> schemaExpected = (Map<String, Object>) JsonToBeanTestUtil .getBean("/data/schemas/vesseltrackingqueryschema.json", Map.class); // @formatter:off this.mockMvc.perform(get(url + filterSchemaPath) Loading @@ -253,11 +259,8 @@ public class VesselTrackingControllerTest extends DocumentationViewBaseTest { .andExpect(status().isOk()) .andExpect(jsonPath("$.success", is(true))) .andExpect(jsonPath("$.body", notNullValue())) .andExpect(jsonPath("$.body.schema", notNullValue())) .andExpect(jsonPath("$.body.schema.properties", notNullValue())) .andExpect(jsonPath("$.body.schema.properties.postFilter", notNullValue())) .andExpect(jsonPath("$.body.schema.properties.aggs", notNullValue())); // TODO: aumentar el nivel de checkeo .andExpect(jsonPath("$.body", notNullValue())) .andExpect(jsonPath("$.body", is(schemaExpected))); // @formatter:on } }
vessels-view/src/test/java/es/redmic/test/vesselsview/integration/controller/VesselTypeControllerTest.java +11 −8 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.util.Arrays; import java.util.Map; import javax.annotation.PostConstruct; Loading @@ -33,6 +34,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import es.redmic.models.es.common.query.dto.MgetDTO; import es.redmic.models.es.common.query.dto.SimpleQueryDTO; import es.redmic.testutils.documentation.DocumentationViewBaseTest; import es.redmic.testutils.utils.JsonToBeanTestUtil; import es.redmic.vesselsview.VesselsViewApplication; import es.redmic.vesselsview.model.vesseltype.VesselType; import es.redmic.vesselsview.repository.vesseltype.VesselTypeESRepository; Loading @@ -43,8 +45,8 @@ import es.redmic.vesselsview.repository.vesseltype.VesselTypeESRepository; @DirtiesContext public class VesselTypeControllerTest extends DocumentationViewBaseTest { @Value("${documentation.VESSELTYPE_HOST}") private String VESSELTYPE_HOST; @Value("${documentation.VESSEL_HOST}") private String HOST; @Value("${controller.mapping.vesseltype}") private String VESSELTYPE_PATH; Loading Loading @@ -82,7 +84,7 @@ public class VesselTypeControllerTest extends DocumentationViewBaseTest { .webAppContextSetup(webApplicationContext) .addFilters(springSecurityFilterChain) .apply(documentationConfiguration(this.restDocumentation) .uris().withScheme(SCHEME).withHost(VESSELTYPE_HOST).withPort(PORT)) .uris().withScheme(SCHEME).withHost(HOST).withPort(PORT)) .alwaysDo(this.document).build(); // @formatter:on Loading Loading @@ -218,9 +220,13 @@ public class VesselTypeControllerTest extends DocumentationViewBaseTest { // @formatter:on } @SuppressWarnings("unchecked") @Test public void getFilterSchema_Return200_WhenSchemaIsAvailable() throws Exception { Map<String, Object> schemaExpected = (Map<String, Object>) JsonToBeanTestUtil .getBean("/data/schemas/vesseltypequeryschema.json", Map.class); // @formatter:off this.mockMvc.perform(get(VESSELTYPE_PATH + filterSchemaPath) Loading @@ -228,11 +234,8 @@ public class VesselTypeControllerTest extends DocumentationViewBaseTest { .andExpect(status().isOk()) .andExpect(jsonPath("$.success", is(true))) .andExpect(jsonPath("$.body", notNullValue())) .andExpect(jsonPath("$.body.schema", notNullValue())) .andExpect(jsonPath("$.body.schema.properties", notNullValue())) .andExpect(jsonPath("$.body.schema.properties.postFilter").doesNotExist()) .andExpect(jsonPath("$.body.schema.properties.aggs").doesNotExist()); // TODO: aumentar el nivel de checkeo .andExpect(jsonPath("$.body", notNullValue())) .andExpect(jsonPath("$.body", is(schemaExpected))); // @formatter:on } }
vessels-view/src/test/resources/data/schemas/vesselqueryschema.json 0 → 100644 +1 −0 Original line number Diff line number Diff line {"schema":{"$schema":"http://json-schema.org/draft-04/schema#","title":"Metadata Query DTO","type":"object","properties":{"from":{"type":["integer","null"],"default":"0"},"size":{"type":["integer","null"],"default":"100"},"terms":{"type":["object","null"],"additionalProperties":true},"sorts":{"type":["array","null"],"uniqueItems":true,"items":{"$ref":"#/definitions/SortDTO"}},"returnFields":{"type":["array","null"],"uniqueItems":true,"items":{"type":"string"}},"text":{"$ref":"#/definitions/TextQueryDTO"},"suggest":{"$ref":"#/definitions/SuggestQueryDTO"},"regexp":{"type":["array","null"],"uniqueItems":true,"items":{"$ref":"#/definitions/RegexpDTO"}},"postFilter":{"type":["object","null"],"additionalProperties":true},"aggs":{"type":["array","null"],"uniqueItems":true,"items":{"$ref":"#/definitions/AggsPropertiesDTO"}}},"definitions":{"SortDTO":{"type":["object","null"],"properties":{"field":{"type":"string"},"order":{"type":"string"}},"required":["field","order"]},"TextQueryDTO":{"type":["object","null"],"properties":{"text":{"type":"string","minLength":2},"searchFields":{"type":["array","null"],"uniqueItems":true,"items":{"type":"string"}},"highlightFields":{"type":["array","null"],"uniqueItems":true,"items":{"type":"string"}}},"required":["text"]},"SuggestQueryDTO":{"type":["object","null"],"properties":{"text":{"type":"string","minLength":2},"searchFields":{"type":["array","null"],"uniqueItems":true,"items":{"type":"string"}},"size":{"type":["integer","null"]}},"required":["text"]},"RegexpDTO":{"type":["object","null"],"properties":{"field":{"type":"string"},"exp":{"type":"string"}},"required":["field","exp"]},"AggsPropertiesDTO":{"type":["object","null"],"properties":{"field":{"type":"string"},"term":{"type":"string"},"nested":{"type":["string","null"]},"size":{"type":["integer","null"],"default":"20"},"minCount":{"type":["integer","null"]}},"required":["field","term"]}}}} No newline at end of file