use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class SimpleConcatClient method start.
public void start(int port) throws Exception {
IContainer client = ContainerFactory.getDefault().createContainer(CLIENT_TYPE);
// Get adapter for accessing remote services
IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) client.getAdapter(IRemoteServiceContainerAdapter.class);
rsContainer = new RemoteServiceContainer(client, adapter);
System.out.println("Client created with ID=" + client.getID());
ID connectTargetID = IDFactory.getDefault().createStringID(NLS.bind(SERVER_ID, new Integer(port)));
System.out.println("Attempting connect to id=" + connectTargetID);
client.connect(connectTargetID, null);
System.out.println("Client connected to connectTargetID=" + connectTargetID);
Thread.sleep(1000);
// Get remote service reference
IRemoteServiceReference[] refs = adapter.getRemoteServiceReferences((ID[]) null, IConcatService.class.getName(), null);
rsReference = refs[0];
System.out.println("Remote service with ref=" + refs[0]);
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class ROsgiConcatConsumerTest method setUp.
protected void setUp() throws Exception {
super.setUp();
IContainer container = createContainer("r-osgi://localhost:9279");
rsContainer = createRemoteServiceContainer(container);
targetID = createID(container, R_OSGi.HOST_CONTAINER_ENDPOINT_ID);
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class SSLClientContainerConnectTest method testListenerConnecting.
public void testListenerConnecting() throws Exception {
final IContainer client = getClients()[0];
client.addListener(createListener());
client.connect(createServerID(), null);
final Object o = clientConnectingEvents.get(0);
assertTrue(o instanceof IContainerConnectingEvent);
final IContainerConnectingEvent cco = (IContainerConnectingEvent) o;
assertTrue(cco.getLocalContainerID().equals(client.getID()));
assertTrue(cco.getTargetID().equals(createServerID()));
assertTrue(cco.getData() == null);
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class SSLClientContainerConnectTest method testGetConnectedID.
public void testGetConnectedID() throws Exception {
final IContainer client = getClients()[0];
assertNull(client.getConnectedID());
client.connect(createServerID(), null);
assertNotNull(client.getConnectedID());
client.disconnect();
assertNull(client.getConnectedID());
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class SSLClientContainerConnectTest method testListenerDisconnected.
public void testListenerDisconnected() throws Exception {
final IContainer client = getClients()[0];
client.addListener(createListener());
client.connect(createServerID(), null);
client.disconnect();
final Object o = clientDisconnectedEvents.get(0);
assertTrue(o instanceof IContainerDisconnectedEvent);
final IContainerDisconnectedEvent cco = (IContainerDisconnectedEvent) o;
assertTrue(cco.getLocalContainerID().equals(client.getID()));
assertTrue(cco.getTargetID().equals(createServerID()));
}
Aggregations