use of io.grpc.channelz.v1.Server in project webtools.servertools by eclipse.
the class XmlTestCase method testServerInstance1.
/**
* Test behavior of ServerInstance
*/
public void testServerInstance1() {
Server server = getXml40Server("serverxml.test1");
assertNotNull(server);
ServerInstance si = new ServerInstance(server, "nonexistent_service", null);
assertNull(si.getService());
assertEquals("Service \"nonexistent_service\" was not found.", si.getStatus().getMessage());
si = new ServerInstance(server, null, null);
assertNotNull(si.getService());
assertEquals("Service", si.getService().getName());
si = new ServerInstance(server, "Service", null);
assertNotNull(si.getService());
assertNull(si.getEngine());
assertEquals("Engine element not found under Service \"Service\".", si.getStatus().getMessage());
}
use of io.grpc.channelz.v1.Server in project webtools.servertools by eclipse.
the class XmlTestCase method getXml40Server.
private Server getXml40Server(String testId) {
Factory factory = new Factory();
factory.setPackageName("org.eclipse.jst.server.tomcat.core.internal.xml.server40");
try {
return (Server) factory.loadDocument(getXmlInputStream(testId));
} catch (Exception e) {
fail("Exception occurred loading " + testId + " XML: " + e.getMessage());
return null;
}
}
use of io.grpc.channelz.v1.Server in project webtools.servertools by eclipse.
the class XmlTestCase method getXml32Server.
private org.eclipse.jst.server.tomcat.core.internal.xml.server32.Server getXml32Server(String testId) {
Factory factory = new Factory();
factory.setPackageName("org.eclipse.jst.server.tomcat.core.internal.xml.server32");
try {
return (org.eclipse.jst.server.tomcat.core.internal.xml.server32.Server) factory.loadDocument(getXmlInputStream(testId));
} catch (Exception e) {
fail("Exception occurred loading " + testId + " XML: " + e.getMessage());
return null;
}
}
use of io.grpc.channelz.v1.Server in project grpc-java by grpc.
the class ChannelzService method getServer.
/**
* Returns a server.
*/
@Override
public void getServer(GetServerRequest request, StreamObserver<GetServerResponse> responseObserver) {
InternalInstrumented<ServerStats> s = channelz.getServer(request.getServerId());
if (s == null) {
responseObserver.onError(Status.NOT_FOUND.withDescription("Can't find server " + request.getServerId()).asRuntimeException());
return;
}
GetServerResponse resp;
try {
resp = GetServerResponse.newBuilder().setServer(ChannelzProtoUtil.toServer(s)).build();
} catch (StatusRuntimeException e) {
responseObserver.onError(e);
return;
}
responseObserver.onNext(resp);
responseObserver.onCompleted();
}
Aggregations