Annotations { public static Deserializer newDeserializer(Map<String, String> annotations) { return new Deserializer(annotations); } private  Annotations(); static Serializer newSerializer(); static Deserializer newDeserializer(Map<String, String> annotations); static final String ANNOTATION_PREFIX; static final String SERVER_PORT_ANNOTATION_FMT; static final String SERVER_PROTOCOL_ANNOTATION_FMT; static final String SERVER_PATH_ANNOTATION_FMT; static final String SERVER_ATTR_ANNOTATION_FMT; static final String MACHINE_NAME_ANNOTATION; static final String CREATE_IN_CHE_INSTALLATION_NAMESPACE; }
@Test public void deserialization() { ImmutableMap<String, String> annotations = ImmutableMap.<String, String>builder() .put("custom-label", "value") .put("org.eclipse.che.server.my-server1/http.port", "8000/tcp") .put("org.eclipse.che.server.my-server1/http.protocol", "http") .put("org.eclipse.che.server.my-server1/http.path", "/api/info") .put("org.eclipse.che.server.my-server2.port", "8080/tcp") .put("org.eclipse.che.server.my-server2.protocol", "ws") .put("org.eclipse.che.server.my-server2.path", "/connect") .put("org.eclipse.che.server.my-server2.attributes", stringAttributes) .put("org.eclipse.che.server.my-server3.port", "7070/tcp") .put("org.eclipse.che.server.my-server3.protocol", "http") .put("org.eclipse.che.server.my-server3.attributes", stringEmptyAttributes) .put("org.eclipse.che.machine.name", "test-machine") .build(); Annotations.Deserializer deserializer = Annotations.newDeserializer(annotations); Map<String, ServerConfigImpl> servers = deserializer.servers(); assertEquals(deserializer.machineName(), "test-machine"); Map<String, ServerConfigImpl> expected = new HashMap<>(); expected.put("my-server1/http", new ServerConfigImpl("8000/tcp", "http", "/api/info", null)); expected.put("my-server2", new ServerConfigImpl("8080/tcp", "ws", "/connect", ATTRIBUTES)); expected.put("my-server3", new ServerConfigImpl("7070/tcp", "http", null, emptyMap())); assertEquals(servers, expected); }