Search in sources :

Example 16 with Endpoint

use of org.openstack4j.model.identity.v3.Endpoint in project crnk-framework by crnk-project.

the class AbstractBraveModuleTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    Endpoint localEndpoint = Endpoint.newBuilder().serviceName("testClient").build();
    clientReporter = Mockito.mock(Reporter.class);
    Tracing clientTracing = Tracing.newBuilder().spanReporter(clientReporter).localEndpoint(localEndpoint).build();
    client = new CrnkClient(getBaseUri().toString());
    client.setHttpAdapter(httpAdapter);
    client.addModule(BraveClientModule.create(clientTracing));
    taskRepo = client.getRepositoryForType(Task.class);
    TaskRepository.clear();
    ProjectRepository.clear();
    httpAdapter.setReceiveTimeout(10000, TimeUnit.SECONDS);
}
Also used : CrnkClient(io.crnk.client.CrnkClient) Task(io.crnk.monitor.brave.mock.models.Task) Endpoint(zipkin2.Endpoint) Reporter(zipkin2.reporter.Reporter) Tracing(brave.Tracing) Before(org.junit.Before)

Example 17 with Endpoint

use of org.openstack4j.model.identity.v3.Endpoint in project wildfly-camel by wildfly-extras.

the class OpenstackIntegrationTest method createKeystoneProject.

@Test
public void createKeystoneProject() throws Exception {
    CamelContext camelContext = Mockito.mock(CamelContext.class);
    when(camelContext.getHeadersMapFactory()).thenReturn(new DefaultHeadersMapFactory());
    Message msg = new DefaultMessage(camelContext);
    Exchange exchange = Mockito.mock(Exchange.class);
    when(exchange.getIn()).thenReturn(msg);
    msg.setHeader(OpenstackConstants.OPERATION, OpenstackConstants.CREATE);
    msg.setHeader(OpenstackConstants.NAME, dummyProject.getName());
    msg.setHeader(KeystoneConstants.DESCRIPTION, dummyProject.getDescription());
    msg.setHeader(KeystoneConstants.DOMAIN_ID, dummyProject.getDomainId());
    msg.setHeader(KeystoneConstants.PARENT_ID, dummyProject.getParentId());
    KeystoneEndpoint endpoint = Mockito.mock(KeystoneEndpoint.class);
    Producer producer = new ProjectProducer(endpoint, client);
    producer.process(exchange);
    ArgumentCaptor<Project> captor = ArgumentCaptor.forClass(Project.class);
    verify(projectService).create(captor.capture());
    assertEqualsProject(dummyProject, captor.getValue());
}
Also used : DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) CamelContext(org.apache.camel.CamelContext) DefaultMessage(org.apache.camel.impl.DefaultMessage) Exchange(org.apache.camel.Exchange) Project(org.openstack4j.model.identity.v3.Project) Message(org.apache.camel.Message) DefaultMessage(org.apache.camel.impl.DefaultMessage) VolumeProducer(org.apache.camel.component.openstack.cinder.producer.VolumeProducer) ProjectProducer(org.apache.camel.component.openstack.keystone.producer.ProjectProducer) ContainerProducer(org.apache.camel.component.openstack.swift.producer.ContainerProducer) GlanceProducer(org.apache.camel.component.openstack.glance.GlanceProducer) KeypairProducer(org.apache.camel.component.openstack.nova.producer.KeypairProducer) Producer(org.apache.camel.Producer) NetworkProducer(org.apache.camel.component.openstack.neutron.producer.NetworkProducer) ProjectProducer(org.apache.camel.component.openstack.keystone.producer.ProjectProducer) DefaultHeadersMapFactory(org.apache.camel.impl.DefaultHeadersMapFactory) KeystoneEndpoint(org.apache.camel.component.openstack.keystone.KeystoneEndpoint) Test(org.junit.Test)

Example 18 with Endpoint

use of org.openstack4j.model.identity.v3.Endpoint in project vialer-android by VoIPGRID.

the class SipConfig method createEndpoint.

/**
 * Create the Endpoint and init/start the Endpoint.
 * @return
 * @throws LibraryInitFailedException
 */
private Endpoint createEndpoint() throws LibraryInitFailedException {
    mRemoteLogger.d("createEndpoint");
    Endpoint endpoint = new Endpoint();
    EpConfig endpointConfig = new EpConfig();
    // Set echo cancellation options for endpoint.
    MediaConfig mediaConfig = createMediaConfig(endpointConfig);
    endpointConfig.setMedConfig(mediaConfig);
    try {
        endpoint.libCreate();
    } catch (Exception e) {
        Log.e(TAG, "Unable to create the PJSIP library");
        mRemoteLogger.e("" + Log.getStackTraceString(e));
        e.printStackTrace();
        throw new LibraryInitFailedException();
    }
    if (BuildConfig.DEBUG || mSipService.getPreferences().remoteLoggingIsActive()) {
        setSipLogging(endpointConfig);
    }
    UaConfig uaConfig = endpointConfig.getUaConfig();
    uaConfig.setUserAgent(getUserAgentHeader(mSipService));
    configureStunServer(uaConfig);
    try {
        endpoint.libInit(endpointConfig);
    } catch (Exception e) {
        Log.e(TAG, "Unable to init the PJSIP library");
        mRemoteLogger.e("" + Log.getStackTraceString(e));
        e.printStackTrace();
        throw new LibraryInitFailedException();
    }
    TransportConfig transportConfig = createTransportConfig();
    try {
        mCurrentTransportId = endpoint.transportCreate(getTransportType(), transportConfig);
        endpoint.libStart();
    } catch (Exception exception) {
        Log.e(TAG, "Unable to start the PJSIP library");
        mRemoteLogger.e("" + Log.getStackTraceString(exception));
        throw new LibraryInitFailedException();
    }
    return endpoint;
}
Also used : EpConfig(org.pjsip.pjsua2.EpConfig) Endpoint(org.pjsip.pjsua2.Endpoint) UaConfig(org.pjsip.pjsua2.UaConfig) MediaConfig(org.pjsip.pjsua2.MediaConfig) TransportConfig(org.pjsip.pjsua2.TransportConfig)

Example 19 with Endpoint

use of org.openstack4j.model.identity.v3.Endpoint 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

Endpoint (zipkin2.Endpoint)7 ArrayList (java.util.ArrayList)6 Before (org.junit.Before)6 Test (org.junit.Test)6 ProjectProducer (org.apache.camel.component.openstack.keystone.producer.ProjectProducer)2 Endpoint (org.jboss.remoting3.Endpoint)2 Access (org.openstack4j.model.identity.v2.Access)2 Span (zipkin2.Span)2 Tracing (brave.Tracing)1 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)1 CrnkClient (io.crnk.client.CrnkClient)1 Task (io.crnk.monitor.brave.mock.models.Task)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 NetworkInterface (java.net.NetworkInterface)1 SocketAddress (java.net.SocketAddress)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1