use of org.eclipse.che.api.workspace.server.model.impl.MachineImpl in project devspaces-images by redhat-developer.
the class InternalRuntimeTest method shouldNotRewriteURLsOfInternalServers.
@Test
public void shouldNotRewriteURLsOfInternalServers() throws Exception {
// given
ServerImpl internalServer = createServer(singletonMap(ServerConfig.INTERNAL_SERVER_ATTRIBUTE, "true"));
ServerImpl regularServer = createServer(RUNNING);
MachineImpl machineWithInternalServer = new MachineImpl(createAttributes(), ImmutableMap.of("server1", regularServer, "server2", internalServer), MachineStatus.RUNNING);
ImmutableMap<String, MachineImpl> internalMachines = ImmutableMap.of("m1", createMachine(), "m2", machineWithInternalServer);
ImmutableMap<String, MachineImpl> expected = ImmutableMap.of("m1", rewriteURLs(createMachine()), "m2", new MachineImpl(createAttributes(), ImmutableMap.of("server1", rewriteURL(regularServer), "server2", internalServer), MachineStatus.RUNNING));
setRunningRuntime();
doReturn(internalMachines).when(internalRuntime).getInternalMachines();
// when
Map<String, ? extends Machine> actual = internalRuntime.getMachines();
// then
assertEquals(actual, expected);
}
use of org.eclipse.che.api.workspace.server.model.impl.MachineImpl in project devspaces-images by redhat-developer.
the class InternalRuntimeTest method modifyMachines.
private void modifyMachines(HashMap<String, MachineImpl> originInternalMachines, String machineToModify, String serverToModify) throws Exception {
// add new machine
originInternalMachines.put("newM", createMachine());
MachineImpl originMachine = originInternalMachines.get(machineToModify);
// change properties of origin server
originMachine.getAttributes().put("new_prop", "new_value");
// add new server in origin machine
originMachine.getServers().put("newS", createServer(RUNNING));
ServerImpl originServer = originMachine.getServers().get(serverToModify);
// change status and URL of origin server
originServer.setStatus(RUNNING);
originServer.setUrl("http://localhost:9191/new_url");
}
Aggregations