use of org.eclipse.ecf.core.sharedobject.ISharedObject in project ecf by eclipse.
the class AbstractChatRoomSOAddTest method testAddSharedObject1.
public void testAddSharedObject1() throws Exception {
if (chatRoomContainer[0] == null)
return;
final IContainer client0Container = chatRoomContainer[1];
assertNotNull(client0Container);
//
final ISharedObjectContainer socontainer = (ISharedObjectContainer) client0Container.getAdapter(ISharedObjectContainer.class);
final ISharedObjectManager manager = socontainer.getSharedObjectManager();
assertNotNull(manager);
final ID objectID = createSharedObjectID();
final ID id = manager.addSharedObject(objectID, createSharedObject(objectID), null);
assertNotNull(id);
final ISharedObject sharedObject = manager.getSharedObject(id);
assertNotNull(sharedObject);
sleep(5000);
}
use of org.eclipse.ecf.core.sharedobject.ISharedObject in project ecf by eclipse.
the class AbstractChatRoomSOAddTest method testAddSharedObject.
public void testAddSharedObject() throws Exception {
if (chatRoomContainer[0] == null)
return;
final IContainer client0Container = chatRoomContainer[0];
assertNotNull(client0Container);
//
final ISharedObjectContainer socontainer = (ISharedObjectContainer) client0Container.getAdapter(ISharedObjectContainer.class);
final ISharedObjectManager manager = socontainer.getSharedObjectManager();
assertNotNull(manager);
final ID objectID = createSharedObjectID();
final ID id = manager.addSharedObject(objectID, createSharedObject(objectID), null);
assertNotNull(id);
final ISharedObject sharedObject = manager.getSharedObject(id);
assertNotNull(sharedObject);
sleep(5000);
}
use of org.eclipse.ecf.core.sharedobject.ISharedObject in project ecf by eclipse.
the class AbstractChatRoomSOAddTest method testAddTwoSharedObjects1.
public void testAddTwoSharedObjects1() throws Exception {
if (chatRoomContainer[0] == null)
return;
final IContainer client0Container = chatRoomContainer[1];
assertNotNull(client0Container);
final ISharedObjectContainer socontainer = (ISharedObjectContainer) client0Container.getAdapter(ISharedObjectContainer.class);
final ISharedObjectManager manager = socontainer.getSharedObjectManager();
assertNotNull(manager);
final ID objectID0 = createSharedObjectID();
final ID id0 = manager.addSharedObject(objectID0, createSharedObject(objectID0), null);
assertNotNull(id0);
final ID objectID1 = createSharedObjectID();
final ID id1 = manager.addSharedObject(objectID1, createSharedObject(objectID1), null);
assertNotNull(id1);
final ISharedObject sharedObject0 = manager.getSharedObject(id0);
assertNotNull(sharedObject0);
final ISharedObject sharedObject1 = manager.getSharedObject(id1);
assertNotNull(sharedObject1);
sleep(5000);
}
use of org.eclipse.ecf.core.sharedobject.ISharedObject in project ecf by eclipse.
the class AddSharedObjectTest method testAddTwoSharedObjects.
public void testAddTwoSharedObjects() throws Exception {
final ISharedObjectManager manager = getClientSOManager(0);
assertNotNull(manager);
final ID id0 = manager.addSharedObject(IDFactory.getDefault().createStringID("foo0"), new TestSharedObject(TEST_USERNAME0), null);
assertNotNull(id0);
final ID id1 = manager.addSharedObject(IDFactory.getDefault().createStringID("foo1"), new TestSharedObject(TEST_USERNAME1), null);
assertNotNull(id1);
final ISharedObject sharedObject0 = manager.getSharedObject(id0);
assertNotNull(sharedObject0);
final ISharedObject sharedObject1 = manager.getSharedObject(id1);
assertNotNull(sharedObject1);
sleep(1000);
}
use of org.eclipse.ecf.core.sharedobject.ISharedObject in project ecf by eclipse.
the class SubscriptionAgent method activated.
protected void activated() {
ISharedObjectContext ctx = config.getContext();
if (isPrimary()) {
try {
ctx.sendCreate(containerID, createReplicaDescription());
} catch (IOException e) {
callback.requestFailed(e);
ctx.getSharedObjectManager().removeSharedObject(config.getSharedObjectID());
}
return;
}
ISharedObjectManager mgr = ctx.getSharedObjectManager();
ISharedObject so = mgr.getSharedObject(sharedObjectID);
try {
ID homeContainerID = config.getHomeContainerID();
if (so instanceof IPublishedService) {
IPublishedService svc = (IPublishedService) so;
svc.subscribe(homeContainerID, config.getSharedObjectID());
} else {
ctx.sendCreateResponse(homeContainerID, new IllegalArgumentException("Not an IPublishedService."), -1);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
ctx.getSharedObjectManager().removeSharedObject(config.getSharedObjectID());
}
}
Aggregations