use of org.eclipse.ecf.core.sharedobject.ISharedObjectContainer in project ecf by eclipse.
the class AbstractChatRoomSOAddTest method testAddTwoSharedObjects.
public void testAddTwoSharedObjects() 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 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.ISharedObjectContainer 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.ISharedObjectContainer 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.ISharedObjectContainer 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.ISharedObjectContainer in project ecf by eclipse.
the class SendSharedObjectMessageWithCustomSerializerTest method setUp.
protected void setUp() throws Exception {
super.setUp();
createServerAndClients();
connectClients();
// Setup custom serializer
ISharedObjectContainer soContainer = getClientSOContainer(0);
soContainer.setSharedObjectMessageSerializer(new ISharedObjectMessageSerializer() {
public Object deserializeMessage(byte[] data) throws IOException, ClassNotFoundException {
return deserialize(data);
}
public byte[] serializeMessage(ID sharedObjectId, Object message) throws IOException {
return serialize(message);
}
});
ISharedObjectContainer serverContainer = getServerSOContainer();
serverContainer.setSharedObjectMessageSerializer(new ISharedObjectMessageSerializer() {
public Object deserializeMessage(byte[] data) throws IOException, ClassNotFoundException {
return deserialize(data);
}
public byte[] serializeMessage(ID sharedObjectId, Object message) throws IOException {
return serialize(message);
}
});
// Add test messaging shared object
sharedObjectID = addClientSharedObject(0, IDFactory.getDefault().createStringID("foo0"), new TestMessagingSharedObject(TEST_USERNAME0, new IMessageReceiver() {
public void handleMessage(ID fromID, Object message) {
System.out.println("received fromId=" + fromID + " message=" + message);
}
}), null);
sharedObject = (TestMessagingSharedObject) getClientSOManager(0).getSharedObject(sharedObjectID);
sleep(2000);
}
Aggregations