use of org.eclipse.che.api.core.model.workspace.ServerConf2 in project che by eclipse.
the class AgentConfigApplierTest method shouldAddLabels.
@Test
public void shouldAddLabels() throws Exception {
final ServerConf2 serverConf1 = mock(ServerConf2.class);
when(serverConf1.getPort()).thenReturn("1111/udp");
when(serverConf1.getProtocol()).thenReturn("http");
when(serverConf1.getProperties()).thenReturn(ImmutableMap.of("path", "b"));
when(sorter.sort(any())).thenReturn(singletonList(AgentKeyImpl.parse("agent1")));
when(agent1.getServers()).thenAnswer(invocation -> singletonMap("a", serverConf1));
CheServiceImpl service = new CheServiceImpl();
agentConfigApplier.apply(new ExtendedMachineImpl(singletonList("agent1"), emptyMap(), emptyMap()), service);
Map<String, String> labels = service.getLabels();
assertEquals(labels.size(), 3);
assertEquals(labels.get("che:server:1111/udp:ref"), "a");
assertEquals(labels.get("che:server:1111/udp:protocol"), "http");
assertEquals(labels.get("che:server:1111/udp:path"), "b");
}
Aggregations