use of com.google.cloud.servicedirectory.v1.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);
}
use of com.google.cloud.servicedirectory.v1.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();
}
use of com.google.cloud.servicedirectory.v1.Service in project java-monitoring by googleapis.
the class ServiceMonitoringServiceClientTest method createServiceTest.
@Test
public void createServiceTest() throws Exception {
Service expectedResponse = Service.newBuilder().setName(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString()).setDisplayName("displayName1714148973").setTelemetry(Service.Telemetry.newBuilder().build()).putAllUserLabels(new HashMap<String, String>()).build();
mockServiceMonitoringService.addResponse(expectedResponse);
FolderName parent = FolderName.of("[FOLDER]");
Service service = Service.newBuilder().build();
Service actualResponse = client.createService(parent, service);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockServiceMonitoringService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateServiceRequest actualRequest = ((CreateServiceRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertEquals(service, actualRequest.getService());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.servicedirectory.v1.Service in project java-monitoring by googleapis.
the class ServiceMonitoringServiceClientTest method createServiceExceptionTest2.
@Test
public void createServiceExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockServiceMonitoringService.addException(exception);
try {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
Service service = Service.newBuilder().build();
client.createService(parent, service);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.cloud.servicedirectory.v1.Service in project java-monitoring by googleapis.
the class ServiceMonitoringServiceClientTest method listServicesTest3.
@Test
public void listServicesTest3() throws Exception {
Service responsesElement = Service.newBuilder().build();
ListServicesResponse expectedResponse = ListServicesResponse.newBuilder().setNextPageToken("").addAllServices(Arrays.asList(responsesElement)).build();
mockServiceMonitoringService.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
ListServicesPagedResponse pagedListResponse = client.listServices(parent);
List<Service> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getServicesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockServiceMonitoringService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListServicesRequest actualRequest = ((ListServicesRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations