Search in sources :

Example 36 with Namespace

use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.

the class ServiceIDTest method testServiceIDFactoryNullScope.

/*
	 * org.eclipse.ecf.discovery.identity.IServiceIDFactory.createServiceID(Namespace, String[], String[], String[], String, String)
	 */
public void testServiceIDFactoryNullScope() {
    try {
        Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
        ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, services, null, protocols, namingAuthority);
    } catch (IDCreateException e) {
        return;
    }
    fail("Invalid services may cause InvalidIDException");
}
Also used : IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 37 with Namespace

use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.

the class ServiceIDTest method testServiceIDFactory.

/*
	 * org.eclipse.ecf.discovery.identity.IServiceIDFactory.createServiceID(Namespace, String, String)
	 */
public void testServiceIDFactory() {
    Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
    IServiceTypeID serviceType = ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, services, scopes, protocols, namingAuthority);
    assertNotNull(serviceType);
    assertEquals(namingAuthority, serviceType.getNamingAuthority());
    assertTrue(Arrays.equals(services, serviceType.getServices()));
    assertTrue(Arrays.equals(scopes, serviceType.getScopes()));
    assertTrue(Arrays.equals(protocols, serviceType.getProtocols()));
}
Also used : IServiceTypeID(org.eclipse.ecf.discovery.identity.IServiceTypeID) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 38 with Namespace

use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.

the class ServiceIDTest method testServiceIDFactoryNullNA.

/*
	 * org.eclipse.ecf.discovery.identity.IServiceIDFactory.createServiceID(Namespace, String[], String[], String[], String, String)
	 */
public void testServiceIDFactoryNullNA() {
    try {
        Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
        ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, services, scopes, protocols, null);
    } catch (IDCreateException e) {
        return;
    }
    fail("Invalid services may cause InvalidIDException");
}
Also used : IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 39 with Namespace

use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.

the class ServiceIDTest method testServiceIDFactoryNullServices.

/*
	 * org.eclipse.ecf.discovery.identity.IServiceIDFactory.createServiceID(Namespace, String[], String[], String[], String, String)
	 */
public void testServiceIDFactoryNullServices() {
    try {
        Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
        ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, null, scopes, protocols, namingAuthority);
    } catch (IDCreateException e) {
        return;
    }
    fail("Invalid services may cause InvalidIDException");
}
Also used : IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 40 with Namespace

use of org.eclipse.ecf.core.identity.Namespace in project ecf by eclipse.

the class AbstractClientContainer method connect.

// IContainer implementation methods
public void connect(ID targetID, IConnectContext connectContext1) throws ContainerConnectException {
    if (targetID == null)
        // $NON-NLS-1$
        throw new ContainerConnectException("targetID cannot be null");
    Namespace targetNamespace = targetID.getNamespace();
    Namespace connectNamespace = getConnectNamespace();
    if (connectNamespace == null)
        // $NON-NLS-1$
        throw new ContainerConnectException("targetID namespace cannot be null");
    if (!(targetNamespace.getName().equals(connectNamespace.getName())))
        // $NON-NLS-1$
        throw new ContainerConnectException("targetID of incorrect type");
    fireContainerEvent(new ContainerConnectingEvent(containerID, targetID));
    synchronized (connectLock) {
        if (connectedID == null) {
            connectedID = targetID;
            this.connectContext = connectContext1;
        } else if (!connectedID.equals(targetID))
            // $NON-NLS-1$
            throw new ContainerConnectException("Already connected to " + connectedID.getName());
    }
    fireContainerEvent(new ContainerConnectedEvent(containerID, targetID));
}
Also used : ContainerConnectException(org.eclipse.ecf.core.ContainerConnectException) Namespace(org.eclipse.ecf.core.identity.Namespace)

Aggregations

Namespace (org.eclipse.ecf.core.identity.Namespace)51 ID (org.eclipse.ecf.core.identity.ID)10 IServiceTypeID (org.eclipse.ecf.discovery.identity.IServiceTypeID)10 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)9 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)5 JSLPNamespace (org.eclipse.ecf.provider.jslp.identity.JSLPNamespace)4 GUID (org.eclipse.ecf.core.identity.GUID)3 UnknownHostException (java.net.UnknownHostException)2 UUID (java.util.UUID)2 IContainer (org.eclipse.ecf.core.IContainer)2 ContainerConnectedEvent (org.eclipse.ecf.core.events.ContainerConnectedEvent)2 ContainerConnectingEvent (org.eclipse.ecf.core.events.ContainerConnectingEvent)2 StringID (org.eclipse.ecf.core.identity.StringID)2 IConnectContext (org.eclipse.ecf.core.security.IConnectContext)2 ECFException (org.eclipse.ecf.core.util.ECFException)2 ServiceTypeID (org.eclipse.ecf.discovery.identity.ServiceTypeID)2 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)2 SimpleResolver (org.xbill.DNS.SimpleResolver)2 URI (java.net.URI)1 Map (java.util.Map)1