@@ -0,0 +1,2953 @@
+package com.orientechnologies.orient.server.distributed;%0A%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport com.orientechnologies.orient.core.db.ODatabaseSession;%0Aimport com.orientechnologies.orient.core.db.OrientDB;%0Aimport com.orientechnologies.orient.core.db.OrientDBConfig;%0Aimport com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;%0Aimport com.orientechnologies.orient.core.metadata.schema.OClass;%0Aimport com.orientechnologies.orient.core.metadata.schema.OType;%0Aimport com.orientechnologies.orient.core.record.OEdge;%0Aimport com.orientechnologies.orient.core.record.OVertex;%0Aimport com.orientechnologies.orient.core.sql.executor.OResultSet;%0Aimport com.orientechnologies.orient.setup.SetupConfig;%0Aimport com.orientechnologies.orient.setup.TestSetup;%0Aimport com.orientechnologies.orient.setup.TestSetupUtil;%0Aimport com.orientechnologies.orient.setup.configs.SimpleDServerConfig;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Apublic class SimpleUniqueIndexDistributedIT %7B%0A%0A  private TestSetup setup;%0A  private SetupConfig config;%0A  private String server0, server1, server2;%0A  private OrientDB remote;%0A  private ODatabaseSession session;%0A%0A  @Before%0A  public void before() throws Exception %7B%0A    config = new SimpleDServerConfig();%0A    server0 = SimpleDServerConfig.SERVER0;%0A    server1 = SimpleDServerConfig.SERVER1;%0A    server2 = SimpleDServerConfig.SERVER2;%0A    setup = TestSetupUtil.create(config);%0A    setup.setup();%0A%0A    remote = setup.createRemote(server0, %22root%22, %22test%22, OrientDBConfig.defaultConfig());%0A    remote.execute(%0A        %22create database ? plocal users(admin identified by 'admin' role admin)%22, %22test%22);%0A    session = remote.open(%22test%22, %22admin%22, %22admin%22);%0A    OClass clazz = session.createClass(%22Edg%22, %22E%22);%0A    clazz.createProperty(%22out%22, OType.LINK);%0A    clazz.createProperty(%22in%22, OType.LINK);%0A    clazz.createIndex(%22out_in%22, %22UNIQUE%22, %22out%22, %22in%22);%0A  %7D%0A%0A  @Test%0A  public void test() %7B%0A    session.begin();%0A    OVertex doc = session.newVertex(%22V%22);%0A    doc.setProperty(%22test%22, %22a value%22);%0A    doc = session.save(doc);%0A%0A    OVertex doc1 = session.newVertex(%22V%22);%0A    doc1.setProperty(%22test%22, %22a value1%22);%0A    doc1 = session.save(doc1);%0A    OEdge edge = doc1.addEdge(doc, %22Edg%22);%0A    session.save(edge);%0A    session.commit();%0A%0A    try (OResultSet res = session.query(%22select from Edg %22)) %7B%0A      assertTrue(res.hasNext());%0A    %7D%0A%0A    OrientDB remote1 = setup.createRemote(server1, OrientDBConfig.defaultConfig());%0A    ODatabaseSession session1 = remote1.open(%22test%22, %22admin%22, %22admin%22);%0A    try (OResultSet res1 = session1.query(%22select from Edg%22)) %7B%0A      assertTrue(res1.hasNext());%0A    %7D%0A    session1.close();%0A  %7D%0A%0A  @After%0A  public void after() throws InterruptedException %7B%0A    try %7B%0A      session.activateOnCurrentThread();%0A      session.close();%0A      remote.drop(%22test%22);%0A      remote.close();%0A    %7D finally %7B%0A      setup.teardown();%0A      ODatabaseDocumentTx.closeAll();%0A    %7D%0A  %7D%0A%7D%0A

use of unique indexes with record ids as keys in distributed setup