use of org.apache.samza.coordinator.server.HttpServer in project samza by apache.
the class TestHostAwareContainerAllocator method getJobModelManager.
private static JobModelManager getJobModelManager(int containerCount) {
//Ideally, the JobModelReader should be constructed independent of HttpServer.
//That way it becomes easier to mock objects. Save it for later.
HttpServer server = new MockHttpServer("/", 7777, null, new ServletHolder(DefaultServlet.class));
Map<String, ContainerModel> containers = new java.util.HashMap<>();
for (int i = 0; i < containerCount; i++) {
ContainerModel container = new ContainerModel(String.valueOf(i), i, new HashMap<TaskName, TaskModel>());
containers.put(String.valueOf(i), container);
}
JobModel jobModel = new JobModel(getConfig(), containers);
return new JobModelManager(jobModel, server, null);
}
use of org.apache.samza.coordinator.server.HttpServer in project samza by apache.
the class HttpCoordinatorToWorkerCommunicationFactory method coordinatorCommunication.
@Override
public CoordinatorCommunication coordinatorCommunication(CoordinatorCommunicationContext context) {
ClusterManagerConfig clusterManagerConfig = new ClusterManagerConfig(context.getConfigForFactory());
JobModelHttpServlet jobModelHttpServlet = new JobModelHttpServlet(context.getJobInfoProvider(), new JobModelHttpServlet.Metrics(context.getMetricsRegistry()));
HttpServer httpServer = new HttpServer("/", clusterManagerConfig.getCoordinatorUrlPort(), null, new ServletHolder(DefaultServlet.class));
httpServer.addServlet("/", jobModelHttpServlet);
return new HttpCoordinatorCommunication(httpServer);
}
use of org.apache.samza.coordinator.server.HttpServer in project samza by apache.
the class TestYarnContainerHeartbeatServlet method setup.
@Before
public void setup() throws Exception {
container = mock(YarnContainer.class);
ReadableMetricsRegistry registry = new MetricsRegistryMap();
yarnAppState = new YarnAppState(-1, ConverterUtils.toContainerId("container_1350670447861_0003_01_000001"), "testHost", 1, 1);
webApp = new HttpServer("/", 0, "", new ServletHolder(new DefaultServlet()));
webApp.addServlet("/", new YarnContainerHeartbeatServlet(yarnAppState, registry));
webApp.start();
mapper = new ObjectMapper();
}
use of org.apache.samza.coordinator.server.HttpServer in project samza by apache.
the class TestLocalityServlet method setup.
@Before
public void setup() throws Exception {
localityManager = mock(LocalityManager.class);
when(localityManager.readLocality()).thenReturn(new LocalityModel(ImmutableMap.of(PROCESSOR_ID1, PROCESSOR_1_LOCALITY, PROCESSOR_ID2, PROCESSOR_2_LOCALITY)));
webApp = new HttpServer("/", 0, "", new ServletHolder(new DefaultServlet()));
webApp.addServlet("/locality", new LocalityServlet(localityManager));
webApp.start();
}
use of org.apache.samza.coordinator.server.HttpServer in project samza by apache.
the class TestContainerAllocator method getJobModelReader.
private static JobModelManager getJobModelReader(int containerCount) {
//Ideally, the JobModelReader should be constructed independent of HttpServer.
//That way it becomes easier to mock objects. Save it for later.
HttpServer server = new MockHttpServer("/", 7777, null, new ServletHolder(DefaultServlet.class));
Map<String, ContainerModel> containers = new java.util.HashMap<>();
for (int i = 0; i < containerCount; i++) {
ContainerModel container = new ContainerModel(String.valueOf(i), i, new HashMap<TaskName, TaskModel>());
containers.put(String.valueOf(i), container);
}
JobModel jobModel = new JobModel(getConfig(), containers);
return new JobModelManager(jobModel, server, null);
}
Aggregations