Search in sources :

Example 56 with Service

use of com.google.monitoring.v3.Service in project webtools.servertools by eclipse.

the class XmlTestCase method testServerInstance50.

/**
 * Test reading of the default server.xml provided by the
 * current Tomcat 5.0 release using ServerInstance.
 */
public void testServerInstance50() {
    Server server = getXml40Server("default.serverxml.50");
    assertNotNull(server);
    ServerInstance si = new ServerInstance(server, null, null);
    assertEquals(2, server.getListenerCount());
    Listener[] listeners = si.getListeners();
    assertEquals("org.apache.catalina.mbeans.ServerLifecycleListener", listeners[0].getClassName());
    assertEquals("org.apache.catalina.mbeans.GlobalResourcesLifecycleListener", listeners[1].getClassName());
    Service service = si.getService();
    assertNotNull(service);
    assertEquals("Catalina", service.getName());
    assertEquals("8080", si.getConnector(0).getPort());
    assertNull(si.getConnector(0).getProtocol());
    assertEquals("8009", si.getConnector(1).getPort());
    assertEquals("AJP/1.3", si.getConnector(1).getProtocol());
    Connector[] connectors = si.getConnectors();
    assertEquals(2, connectors.length);
    assertEquals("8080", connectors[0].getPort());
    assertNull(connectors[0].getProtocol());
    assertEquals("8009", connectors[1].getPort());
    assertEquals("AJP/1.3", connectors[1].getProtocol());
    Engine engine = si.getEngine();
    assertNotNull(engine);
    assertEquals("Catalina", engine.getName());
    assertEquals("localhost", engine.getDefaultHost());
    Host host = si.getHost();
    assertNotNull(host);
    assertEquals("localhost", host.getName());
    assertEquals("webapps", host.getAppBase());
    assertEquals("true", host.getAttributeValue("unpackWARs"));
    assertEquals("true", host.getAttributeValue("autoDeploy"));
    Context[] contexts = si.getContexts();
    assertEquals(0, contexts.length);
}
Also used : Context(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context) Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) Listener(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener) Server(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) Host(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host) ServerInstance(org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance) Engine(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)

Example 57 with Service

use of com.google.monitoring.v3.Service in project netvirt by opendaylight.

the class PolicyAceFlowProgrammer method getPolicyAceFlowWrapper.

private Optional<PolicyAceFlowWrapper> getPolicyAceFlowWrapper(Matches matches) {
    IngressInterface ingressInterface = matches.augmentation(IngressInterface.class);
    if (ingressInterface != null) {
        Optional<PolicyAceFlowWrapper> interfaceFlowOpt = getIngressInterfaceFlow(ingressInterface);
        if (interfaceFlowOpt.isPresent()) {
            return interfaceFlowOpt;
        }
    }
    Service service = matches.augmentation(Service.class);
    if (service != null) {
        Optional<PolicyAceFlowWrapper> serviceFlowOpt = getPolicyServiceFlow(service);
        if (serviceFlowOpt.isPresent()) {
            return serviceFlowOpt;
        }
    }
    return Optional.empty();
}
Also used : IngressInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.IngressInterface) Service(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service)

Example 58 with Service

use of com.google.monitoring.v3.Service in project axis-axis2-java-core by apache.

the class WSDL20ToAllAxisServicesBuilder method populateAllServices.

/**
 * Public method to access the wsdl 2.0 file and create a List of AxisService objects.
 * For each endpoint on each service in the wsdl, an AxisService object is created and
 * added to the List.  The name of the AxisService is changed from the service name
 * to the the following: <service name>#<endpoint name>.  Note that the endpoint name
 * is not unique to a wsdl 2.0 file.  Multiple services in the file may have endpoints
 * with the same name.  Therefore the name of the AxisService needs to be a combination
 * of service/endpoint name to be unique to the wsdl.
 *
 * @return A List containing one AxisService object for each port in the wsdl file.
 *         The name of the AxisService is modified to uniquely represent the service/endpoint
 *         pair.  The format of the name is "<wsdl service name>#<wsdl endpoint name>"
 * @throws AxisFault
 */
public List<AxisService> populateAllServices() throws AxisFault {
    try {
        if (log.isDebugEnabled()) {
            log.debug("Entry: populateAllServices");
        }
        // setup contains code with gathers non-service specific info
        setup();
        // from the WSDL.  This only needs to be done once per WSDL.
        if (description == null) {
            if (log.isDebugEnabled()) {
                log.debug("Exit: populateAllServices.  wsdl description is null!");
            }
            // can't go any further without the wsdl
            return null;
        }
        Service[] services = description.getServices();
        for (int i = 0; i < services.length; i++) {
            Service service = services[i];
            // set the serviceName on the parent to setup call to populateService
            serviceName = service.getName();
            this.axisService = new AxisService();
            AxisService retAxisService = populateService();
            if (retAxisService != null) {
                axisServices.add(retAxisService);
            }
        // end if axisService was returned
        }
        // end for all ports of a service
        if (log.isDebugEnabled()) {
            log.debug("Exit: populateAllServices.");
        }
        return axisServices;
    } catch (AxisFault e) {
        // just rethrow any AxisFaults
        throw e;
    } catch (Exception e) {
        if (log.isDebugEnabled()) {
            log.debug("populateAllServices caught Exception.  Converting to AxisFault. " + e.toString());
        }
        throw AxisFault.makeFault(e);
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) Service(org.apache.woden.wsdl20.Service) WSDLException(org.apache.woden.WSDLException)

Example 59 with Service

use of com.google.monitoring.v3.Service in project axis-axis2-java-core by apache.

the class WSDL20ToAxisServiceBuilder method processService.

private void processService() throws AxisFault {
    Service[] services = description.getServices();
    if (services.length == 0) {
        throw new AxisFault("No wsdlService found in the WSDL");
    }
    if (serviceName != null) {
        for (int i = 0; i < services.length; i++) {
            if (serviceName.equals(services[i].getName())) {
                wsdlService = services[i];
                // found it. Stop looking.
                break;
            }
        }
        if (wsdlService == null) {
            throw new AxisFault("Service with the specified name not found in the WSDL : " + serviceName.getLocalPart());
        }
    } else {
        wsdlService = services[0];
    }
    axisService.setName(wsdlService.getName().getLocalPart());
    Interface serviceInterface = wsdlService.getInterface();
    axisService.addParameter(new Parameter(WSDL2Constants.INTERFACE_LOCAL_NAME, serviceInterface.getName().getLocalPart()));
    processInterface(serviceInterface);
    if (isCodegen) {
        axisService.setOperationsNameList(operationNames);
    }
    processEndpoints(serviceInterface);
}
Also used : AxisFault(org.apache.axis2.AxisFault) Service(org.apache.woden.wsdl20.Service) Endpoint(org.apache.woden.wsdl20.Endpoint) Interface(org.apache.woden.wsdl20.Interface)

Example 60 with Service

use of com.google.monitoring.v3.Service in project ovirt-engine-sdk-java by oVirt.

the class HttpConnection method followLink.

@Override
public <TYPE> TYPE followLink(TYPE object) {
    if (!isLink(object)) {
        throw new Error("Can't follow link because object don't have any");
    }
    String href = getHref(object);
    if (href == null) {
        throw new Error("Can't follow link because the 'href' attribute does't have a value");
    }
    try {
        URL url = new URL(getUrl());
        String prefix = url.getPath();
        if (!prefix.endsWith("/")) {
            prefix += "/";
        }
        if (!href.startsWith(prefix)) {
            throw new Error("The URL '" + href + "' isn't compatible with the base URL of the connection");
        }
        // Get service based on path
        String path = href.substring(prefix.length());
        Service service = systemService().service(path);
        // Obtain method which provides result object and invoke it:
        Method get;
        if (object instanceof ListWithHref) {
            get = service.getClass().getMethod("list");
        } else {
            get = service.getClass().getMethod("get");
        }
        Object getRequest = get.invoke(service);
        Method send = getRequest.getClass().getMethod("send");
        send.setAccessible(true);
        Object getResponse = send.invoke(getRequest);
        for (Method obtainObject : getResponse.getClass().getDeclaredMethods()) {
            if (obtainObject.getParameterCount() == 0) {
                obtainObject.setAccessible(true);
                return (TYPE) obtainObject.invoke(getResponse);
            }
        }
        throw new NoSuchMethodException("No obtain method found");
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
        throw new Error(String.format("Unexpected error while following link \"%1$s\"", href), ex);
    } catch (MalformedURLException ex) {
        throw new Error(String.format("Error while creating URL \"%1$s\"", getUrl()), ex);
    }
}
Also used : ListWithHref(org.ovirt.api.metamodel.runtime.util.ListWithHref) MalformedURLException(java.net.MalformedURLException) Error(org.ovirt.engine.sdk4.Error) SystemService(org.ovirt.engine.sdk4.services.SystemService) Service(org.ovirt.engine.sdk4.Service) Method(java.lang.reflect.Method) URL(java.net.URL) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

Test (org.junit.jupiter.api.Test)33 Test (org.junit.Test)30 Service (io.fabric8.knative.serving.v1.Service)28 Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)22 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)22 AbstractMessage (com.google.protobuf.AbstractMessage)19 CoreException (org.eclipse.core.runtime.CoreException)18 MockGrpcService (com.google.api.gax.grpc.testing.MockGrpcService)16 Service (com.google.monitoring.v3.Service)16 IOException (java.io.IOException)16 HashMap (java.util.HashMap)14 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)13 ArrayList (java.util.ArrayList)12 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)11 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)11 StatusRuntimeException (io.grpc.StatusRuntimeException)11 ProdBuildResults (io.quarkus.test.ProdBuildResults)11 ProdModeTestResults (io.quarkus.test.ProdModeTestResults)11 QuarkusProdModeTest (io.quarkus.test.QuarkusProdModeTest)11 Path (java.nio.file.Path)11