@@ -0,0 +1,2770 @@
+/*%0A *%0A *  *  Copyright 2016 OrientDB LTD (info(at)orientdb.com)%0A *  *%0A *  *  Licensed under the Apache License, Version 2.0 (the %22License%22);%0A *  *  you may not use this file except in compliance with the License.%0A *  *  You may obtain a copy of the License at%0A *  *%0A *  *       http://www.apache.org/licenses/LICENSE-2.0%0A *  *%0A *  *  Unless required by applicable law or agreed to in writing, software%0A *  *  distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *  *  See the License for the specific language governing permissions and%0A *  *  limitations under the License.%0A *  *%0A *  * For more information: http://www.orientdb.com%0A */%0A%0Apackage com.orientechnologies.orient.core.index;%0A%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.impl.ODocument;%0Aimport com.orientechnologies.orient.core.sql.OCommandSQL;%0Aimport com.orientechnologies.orient.core.sql.query.OResultSet;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A * @author Sergey Sitnikov%0A */%0Apublic class TxAwareIndexTest %7B%0A%0A  private ODatabaseDocumentTx db;%0A%0A  @Before%0A  public void before() %7B%0A    db = new ODatabaseDocumentTx(%22memory:TxAwareIndexTest%22);%0A    db.create();%0A    db.getMetadata().getSchema().createClass(%22user%22).createProperty(%22name%22, OType.STRING).createIndex(OClass.INDEX_TYPE.UNIQUE);%0A    db.newInstance(%22user%22).field(%22name%22, %22abc%22).save();%0A    db.newInstance(%22user%22).field(%22name%22, %22aby%22).save();%0A    db.newInstance(%22user%22).field(%22name%22, %22abz%22).save();%0A  %7D%0A%0A  @After%0A  public void after() %7B%0A    db.drop();%0A  %7D%0A%0A  @Test%0A  public void testSubstrings() %7B%0A    db.begin();%0A%0A    db.command(new OCommandSQL(%22update user set name='abd' where name='aby'%22)).execute();%0A%0A    final OResultSet%3CODocument%3E r = db.command(new OCommandSQL(%22select * from user where name like '%25b%25' order by name%22)).execute();%0A    assertEquals(3, r.size());%0A    assertEquals(%22abc%22, r.get(0).field(%22name%22));%0A    assertEquals(%22abd%22, r.get(1).field(%22name%22));%0A    assertEquals(%22abz%22, r.get(2).field(%22name%22));%0A%0A    db.commit();%0A  %7D%0A%0A  @Test%0A  public void testRange() %7B%0A    db.begin();%0A%0A    db.command(new OCommandSQL(%22update user set name='abd' where name='aby'%22)).execute();%0A%0A    final OResultSet%3CODocument%3E r = db.command(new OCommandSQL(%22select * from user where name %3E 'abc' order by name%22)).execute();%0A    assertEquals(2, r.size());%0A    assertEquals(%22abd%22, r.get(0).field(%22name%22));%0A    assertEquals(%22abz%22, r.get(1).field(%22name%22));%0A%0A    db.commit();%0A  %7D%0A%0A%7D%0A

test case for #6537