Search in sources :

Example 36 with Service

use of com.google.cloud.servicedirectory.v1.Service in project java-monitoring by googleapis.

the class ServiceMonitoringServiceClientTest method createServiceTest4.

@Test
public void createServiceTest4() 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);
    String parent = "parent-995424086";
    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, actualRequest.getParent());
    Assert.assertEquals(service, actualRequest.getService());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) HashMap(java.util.HashMap) CreateServiceRequest(com.google.monitoring.v3.CreateServiceRequest) Service(com.google.monitoring.v3.Service) MockGrpcService(com.google.api.gax.grpc.testing.MockGrpcService) Test(org.junit.Test)

Example 37 with Service

use of com.google.cloud.servicedirectory.v1.Service in project kubernetes-client by fabric8io.

the class ResourceTest method resourceInNamespaceCreate.

// https://github.com/quarkusio/quarkus/issues/19950
@Test
@DisplayName("resource, with Knative model in namespace, can createOrReplace")
void resourceInNamespaceCreate() {
    // Given
    final Service service = new ServiceBuilder().withNewMetadata().withName("service-resource").endMetadata().build();
    // When
    final HasMetadata hm = client.resource(service).inNamespace("default").createOrReplace();
    // Then
    assertNotNull(hm);
}
Also used : HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) Service(io.fabric8.knative.serving.v1.Service) ServiceBuilder(io.fabric8.knative.serving.v1.ServiceBuilder) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 38 with Service

use of com.google.cloud.servicedirectory.v1.Service in project kubernetes-client by fabric8io.

the class ServiceCrudTest method shouldDeleteAService.

@Test
void shouldDeleteAService() {
    Service service3 = new ServiceBuilder().withNewMetadata().withName("service3").endMetadata().build();
    client.services().inNamespace("ns3").create(service3);
    Boolean deleted = client.services().inNamespace("ns3").withName("service3").delete();
    assertTrue(deleted);
}
Also used : Service(io.fabric8.knative.serving.v1.Service) ServiceBuilder(io.fabric8.knative.serving.v1.ServiceBuilder) Test(org.junit.jupiter.api.Test)

Example 39 with Service

use of com.google.cloud.servicedirectory.v1.Service in project openstack4j by ContainX.

the class KeystoneToken method getAggregatedCatalog.

/**
 * {@inheritDoc}
 */
@Override
@JsonIgnore
public SortedSetMultimap<String, Service> getAggregatedCatalog() {
    if (aggregatedCatalog == null) {
        synchronized (this) {
            if (aggregatedCatalog == null) {
                aggregatedCatalog = TreeMultimap.create();
                for (Service sc : catalog) {
                    String nameKey = TYPE_WITHOUT_VERSION.apply(sc.getName());
                    String typeKey = TYPE_WITHOUT_VERSION.apply(sc.getType());
                    aggregatedCatalog.put(nameKey, sc);
                    aggregatedCatalog.put(typeKey, sc);
                }
            }
        }
    }
    return aggregatedCatalog;
}
Also used : Service(org.openstack4j.model.identity.v3.Service) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 40 with Service

use of com.google.cloud.servicedirectory.v1.Service in project cloudbreak by hortonworks.

the class OpenStackClient method getRegion.

public Set<String> getRegion(CloudCredential cloudCredential) {
    Access access = createAccess(cloudCredential);
    Token token = createToken(cloudCredential);
    Set<String> regions = new HashSet<>();
    if (token == null && access == null) {
        throw new CloudConnectorException("Unsupported keystone version");
    } else if (token != null) {
        for (Service service : token.getCatalog()) {
            for (Endpoint endpoint : service.getEndpoints()) {
                regions.add(endpoint.getRegion());
            }
        }
    } else {
        for (Access.Service service : access.getServiceCatalog()) {
            for (org.openstack4j.model.identity.v2.Endpoint endpoint : service.getEndpoints()) {
                regions.add(endpoint.getRegion());
            }
        }
    }
    LOGGER.info("regions from openstack: {}", regions);
    return regions;
}
Also used : Endpoint(org.openstack4j.model.identity.v3.Endpoint) CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException) Access(org.openstack4j.model.identity.v2.Access) Service(org.openstack4j.model.identity.v3.Service) Token(org.openstack4j.model.identity.v3.Token) HashSet(java.util.HashSet)

Aggregations

Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)22 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)22 Test (org.junit.Test)19 MockGrpcService (com.google.api.gax.grpc.testing.MockGrpcService)18 CoreException (org.eclipse.core.runtime.CoreException)18 Service (com.google.monitoring.v3.Service)16 AbstractMessage (com.google.protobuf.AbstractMessage)14 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)9 ServerPort (org.eclipse.wst.server.core.ServerPort)9 Service (io.fabric8.knative.serving.v1.Service)7 ServiceBuilder (io.fabric8.knative.serving.v1.ServiceBuilder)7 Test (org.junit.jupiter.api.Test)6 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)5 StatusRuntimeException (io.grpc.StatusRuntimeException)5 ListServicesPagedResponse (com.google.cloud.monitoring.v3.ServiceMonitoringServiceClient.ListServicesPagedResponse)4 CreateServiceRequest (com.google.monitoring.v3.CreateServiceRequest)4 ListServicesRequest (com.google.monitoring.v3.ListServicesRequest)4 ListServicesResponse (com.google.monitoring.v3.ListServicesResponse)4 Engine (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)4