add basic tests for new push messages serialization
package com.orientechnologies.orient.client.remote.message;
+import com.orientechnologies.orient.core.db.*;
+import com.orientechnologies.orient.core.metadata.schema.OSchemaProxy;
+import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerNetworkV37;
import org.junit.Test;
@@ -9,6 +12,7 @@ import java.util.HashMap;
import java.util.List;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/**
@@ -33,6 +37,48 @@ public class ORemotePushMessagesTest {
assertEquals(readRequest.getHosts().get(1), "two");
}
+ @Test
+ public void testSchema() throws IOException {
+
+ OrientDB orientDB = new OrientDB("embedded:", OrientDBConfig.defaultConfig());
+ orientDB.create("test", ODatabaseType.MEMORY);
+ ODatabaseSession session = orientDB.open("test", "admin", "admin");
+ ODocument schema = ((ODatabaseDocumentInternal) session).getSharedContext().getSchema().toStream();
+ session.close();
+ orientDB.close();
+ MockChannel channel = new MockChannel();
+
+ OPushSchemaRequest request = new OPushSchemaRequest(schema);
+ request.write(channel);
+ channel.close();
+
+ OPushSchemaRequest readRequest = new OPushSchemaRequest();
+ readRequest.read(channel);
+ assertNotNull(readRequest.getSchema());
+
+ }
+
+ @Test
+ public void testIndexManager() throws IOException {
+
+ OrientDB orientDB = new OrientDB("embedded:", OrientDBConfig.defaultConfig());
+ orientDB.create("test", ODatabaseType.MEMORY);
+ ODatabaseSession session = orientDB.open("test", "admin", "admin");
+ ODocument schema = ((ODatabaseDocumentInternal) session).getSharedContext().getIndexManager().toStream();
+ session.close();
+ orientDB.close();
+ MockChannel channel = new MockChannel();
+
+ OPushIndexManagerRequest request = new OPushIndexManagerRequest(schema);
+ request.write(channel);
+ channel.close();
+
+ OPushIndexManagerRequest readRequest = new OPushIndexManagerRequest();
+ readRequest.read(channel);
+ assertNotNull(readRequest.getIndexManager());
+
+ }
+
@Test
public void testSubscribeRequest() throws IOException {
MockChannel channel = new MockChannel();
