private String getDataStoreDefinitionPropertiesTitle(Locale locale) throws IOException { Response response = given().accept(ServiceConstants.UI_SPEC_CONTENT_TYPE) // .expect() // .statusCode(200).log().ifError() // .with().port(localServerPort) // .param(LANGUAGE_QUERY_PARAMETER_NAME, locale.toLanguageTag()) .get(getVersionPrefix() + "/properties/{name}", DATA_STORE_DEFINITION_NAME); JsonNode jsonNode = mapper.readTree(response.asInputStream()); return jsonNode.get("jsonSchema").get("title").asText(); }
@Test public void testGetVersion() throws Exception { Response r = given().accept(APPLICATION_JSON_UTF8_VALUE) // .expect() // .statusCode(200).log().ifError() // .with().port(localServerPort) // .get(getVersionPrefix() + "/version"); r.then() // .statusCode(HttpStatus.OK.value()).log().ifError() // .contentType(APPLICATION_JSON_UTF8_VALUE); // We don't care what values are returned as long as they are filled. JsonPath jsonPathEvaluator = r.jsonPath(); assertThat(jsonPathEvaluator.get("version"), allOf(notNullValue(), not(equalTo(VersionDto.N_A)))); assertThat(jsonPathEvaluator.get("commit"), allOf(notNullValue(), not(equalTo(VersionDto.N_A)))); assertThat(jsonPathEvaluator.get("time"), allOf(notNullValue(), not(equalTo(VersionDto.N_A)))); } }
@Test public void testGetProperties() throws Exception { given().accept(ServiceConstants.UI_SPEC_CONTENT_TYPE) // .expect() // .statusCode(200).log().ifError() // .with().port(localServerPort) // .get(getVersionPrefix() + "/properties/{name}", DATA_STORE_DEFINITION_NAME); }
@Test public void testSerializeProperties() throws Exception { Response response = given().accept(ServiceConstants.JSONIO_CONTENT_TYPE) // .expect() // .statusCode(200).log().ifError() // .with().port(localServerPort) // .content(buildTestDataSetFormData()) // .contentType(ServiceConstants.UI_SPEC_CONTENT_TYPE) // .post(getVersionPrefix() + "/properties/serialize"); assertNotNull(response); String content = response.asString(); assertNotNull(content); //take the jsonIO JsonNode jsonNode = mapper.readTree(content); String jsonioProperties = jsonNode.get("properties").asText(); Deserialized<MockDatasetProperties> fromSerializedPersistent = Properties.Helper.fromSerializedPersistent( jsonioProperties, MockDatasetProperties.class); assertNotNull(fromSerializedPersistent); assertNotNull(fromSerializedPersistent.object); MockDatasetProperties deserializedProps = fromSerializedPersistent.object; assertEquals("tata", deserializedProps.tag.getValue()); }
@Test public void testSerializeDeserializeProperties() throws Exception { Response response = given().accept(ServiceConstants.JSONIO_CONTENT_TYPE) // .expect() // .statusCode(200).log().ifError() // .with().port(localServerPort) // .content(buildTestDataSetFormData()) // .contentType(ServiceConstants.UI_SPEC_CONTENT_TYPE) // .post(getVersionPrefix() + "/properties/serialize"); assertNotNull(response); String content = response.asString(); assertNotNull(content); response = given().accept(ServiceConstants.UI_SPEC_CONTENT_TYPE) // .expect() // .statusCode(200).log().ifError() // .with() // .content(content) // .contentType(ServiceConstants.JSONIO_CONTENT_TYPE) // .post(getVersionPrefix() + "/properties/uispec"); assertNotNull(response); assertEquals(getMockDatasetMainFormUISpecs(), response.asString()); }