Search in sources :

Example 16 with Server

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());
}
Also used : Server(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server) ServerInstance(org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)

Example 17 with Server

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;
    }
}
Also used : Server(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server) Factory(org.eclipse.jst.server.tomcat.core.internal.xml.Factory)

Example 18 with Server

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;
    }
}
Also used : Server(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server) Factory(org.eclipse.jst.server.tomcat.core.internal.xml.Factory)

Example 19 with Server

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();
}
Also used : GetServerResponse(io.grpc.channelz.v1.GetServerResponse) ServerStats(io.grpc.InternalChannelz.ServerStats) StatusRuntimeException(io.grpc.StatusRuntimeException)

Aggregations

Server (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server)15 ServerInstance (org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)10 Context (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context)9 Factory (org.eclipse.jst.server.tomcat.core.internal.xml.Factory)8 IPath (org.eclipse.core.runtime.IPath)6 Host (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host)6 FileInputStream (java.io.FileInputStream)5 IStatus (org.eclipse.core.runtime.IStatus)5 MultiStatus (org.eclipse.core.runtime.MultiStatus)5 Status (org.eclipse.core.runtime.Status)5 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)4 Engine (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)4 Listener (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener)4 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)4 SAXException (org.xml.sax.SAXException)4 File (java.io.File)3 ServerStats (io.grpc.InternalChannelz.ServerStats)2 SocketStats (io.grpc.InternalChannelz.SocketStats)2