Added example used in wiki in tests

This commit is contained in:
Luca Frosini 2022-02-09 15:15:00 +01:00
parent 0121657b4b
commit 8a4a70673c
1 changed files with 28 additions and 0 deletions

View File

@ -204,4 +204,32 @@ public class ResourceRegistryClientTestWikiExamples extends ContextTest {
logger.debug("{}", list);
}
@Test
public void jsonQueryExample1() throws ResourceRegistryException, Exception{
String jsonQuery = "{\n"
+ " \"@class\": \"EService\",\n"
+ " \"consistsOf\": [\n"
+ " {\n"
+ " \"@class\": \"IsIdentifiedBy\",\n"
+ " \"target\": {\n"
+ " \"@class\": \"SoftwareFacet\",\n"
+ " \"group\": \"DataTransfer\",\n"
+ " \"name\": \"data-transfer-service\"\n"
+ " }\n"
+ " }\n"
+ " {\n"
+ " \"@class\": \"ConsistsOf\",\n"
+ " \"target\": {\n"
+ " \"@class\": \"StateFacet\",\n"
+ " \"value\": \"down\"\n"
+ " }\n"
+ " },\n"
+ " \n"
+ " ]\n"
+ "}";
String jsonString = resourceRegistryClient.jsonQuery(jsonQuery);
List<EService> list = ElementMapper.unmarshalList(EService.class, jsonString);
logger.debug("{}", list);
}
}