use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class IndexTest method testIndexRebuildDuringNonProxiedObjectDelete.
@Test
public void testIndexRebuildDuringNonProxiedObjectDelete() {
Profile profile = new Profile("NonProxiedObjectToDelete", "NonProxiedObjectToDelete", "NonProxiedObjectToDelete", null);
profile = database.save(profile);
OIndexManager idxManager = database.getMetadata().getIndexManager();
OIndex<?> nickIndex = idxManager.getIndex("Profile.nick");
Assert.assertTrue(nickIndex.contains("NonProxiedObjectToDelete"));
final Profile loadedProfile = database.load(new ORecordId(profile.getId()));
database.delete(database.detach(loadedProfile, true));
Assert.assertFalse(nickIndex.contains("NonProxiedObjectToDelete"));
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class IndexTest method testDuplicatedIndexOnNotUnique.
@Test(dependsOnMethods = "testChangeOfIndexToNotUnique")
public void testDuplicatedIndexOnNotUnique() {
Profile nickNolte = new Profile("Jay", "Nick", "Nolte", null);
database.save(nickNolte);
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class IndexTest method testIndexInMinorSelect.
@Test(dependsOnMethods = "populateIndexDocuments")
public void testIndexInMinorSelect() {
if (database.getStorage() instanceof OStorageProxy) {
return;
}
final boolean oldRecording = Orient.instance().getProfiler().isRecording();
if (!oldRecording) {
Orient.instance().getProfiler().startRecording();
}
long indexQueries = Orient.instance().getProfiler().getCounter("db.demo.query.indexUsed");
if (indexQueries < 0) {
indexQueries = 0;
}
final List<Profile> result = database.command(new OSQLSynchQuery<Profile>("select * from Profile where nick < '002'")).execute();
final List<String> expectedNicks = new ArrayList<String>(Arrays.asList("000", "001"));
if (!oldRecording) {
Orient.instance().getProfiler().stopRecording();
}
Assert.assertEquals(result.size(), 2);
for (Profile profile : result) {
expectedNicks.remove(profile.getNick());
}
Assert.assertEquals(expectedNicks.size(), 0);
long newIndexQueries = Orient.instance().getProfiler().getCounter("db.demo.query.indexUsed");
Assert.assertEquals(newIndexQueries, indexQueries + 1);
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class IndexTest method testIndexInComplexSelectOne.
@Test(dependsOnMethods = "populateIndexDocuments")
public void testIndexInComplexSelectOne() {
if (database.getStorage() instanceof OStorageProxy) {
return;
}
final boolean oldRecording = Orient.instance().getProfiler().isRecording();
if (!oldRecording) {
Orient.instance().getProfiler().startRecording();
}
long indexQueries = Orient.instance().getProfiler().getCounter("db.demo.query.indexUsed");
if (indexQueries < 0) {
indexQueries = 0;
}
final List<Profile> result = database.command(new OSQLSynchQuery<Profile>("select * from Profile where (name = 'Giuseppe' OR name <> 'Napoleone')" + " AND (nick is not null AND (name = 'Giuseppe' OR name <> 'Napoleone') AND (nick >= 'ZZZJayLongNickIndex3'))")).execute();
if (!oldRecording) {
Orient.instance().getProfiler().stopRecording();
}
final List<String> expectedNicks = new ArrayList<String>(Arrays.asList("ZZZJayLongNickIndex3", "ZZZJayLongNickIndex4", "ZZZJayLongNickIndex5"));
Assert.assertEquals(result.size(), 3);
for (Profile profile : result) {
expectedNicks.remove(profile.getNick());
}
Assert.assertEquals(expectedNicks.size(), 0);
long newIndexQueries = Orient.instance().getProfiler().getCounter("db.demo.query.indexUsed");
Assert.assertEquals(newIndexQueries, indexQueries + 1);
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class IndexTest method testIndexInMajorEqualsSelect.
@Test(dependsOnMethods = "populateIndexDocuments")
public void testIndexInMajorEqualsSelect() {
if (database.getStorage() instanceof OStorageProxy) {
return;
}
final boolean oldRecording = Orient.instance().getProfiler().isRecording();
if (!oldRecording) {
Orient.instance().getProfiler().startRecording();
}
long indexQueries = Orient.instance().getProfiler().getCounter("db.demo.query.indexUsed");
if (indexQueries < 0) {
indexQueries = 0;
}
final List<Profile> result = database.command(new OSQLSynchQuery<Profile>("select * from Profile where nick >= 'ZZZJayLongNickIndex3'")).execute();
final List<String> expectedNicks = new ArrayList<String>(Arrays.asList("ZZZJayLongNickIndex3", "ZZZJayLongNickIndex4", "ZZZJayLongNickIndex5"));
if (!oldRecording) {
Orient.instance().getProfiler().stopRecording();
}
Assert.assertEquals(result.size(), 3);
for (Profile profile : result) {
expectedNicks.remove(profile.getNick());
}
Assert.assertEquals(expectedNicks.size(), 0);
long newIndexQueries = Orient.instance().getProfiler().getCounter("db.demo.query.indexUsed");
Assert.assertEquals(newIndexQueries, indexQueries + 1);
}
Aggregations