com.orientechnologies.orient.core.sql.query.OSQLQuery Java Examples

The following examples show how to use com.orientechnologies.orient.core.sql.query.OSQLQuery. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BrowseEntitiesByPropertyInSetActionTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setup() {
  MockitoAnnotations.initMocks(this);

  when(adapter.getTypeName()).thenReturn(ENTITY_NAME);

  when(db.command(any(OSQLQuery.class))).thenReturn(command);
  when(command.execute(any(Object[].class))).thenReturn(documents);
  when(adapter.transform(documents)).thenReturn(results);

  browseEntitiesByPropertyInSetAction = new BrowseEntitiesByPropertyInSetAction<>(adapter, PROPERTY);
}
 
Example #2
Source File: BrowseEntitiesByPropertyInSetActionTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void buildsCorrectQueryForSingle() {
  ArgumentCaptor<OSQLQuery> queryCaptor = ArgumentCaptor.forClass(OSQLQuery.class);
  browseEntitiesByPropertyInSetAction.execute(db, newHashSet("Test"));
  verify(db, times(1)).command(queryCaptor.capture());
  assertEquals("SELECT * FROM " + ENTITY_NAME + " WHERE " + PROPERTY + " IN [ ? ]", queryCaptor.getValue().getText());
}
 
Example #3
Source File: BrowseEntitiesByPropertyInSetActionTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void buildsCorrectQueryForMultiple() {
  ArgumentCaptor<OSQLQuery> queryCaptor = ArgumentCaptor.forClass(OSQLQuery.class);
  browseEntitiesByPropertyInSetAction.execute(db, newHashSet("Test1", "Test2", "Test3"));
  verify(db, times(1)).command(queryCaptor.capture());
  assertEquals("SELECT * FROM " + ENTITY_NAME + " WHERE " + PROPERTY + " IN [ ?,?,? ]", queryCaptor.getValue().getText());
}
 
Example #4
Source File: AsyncQueryListenerParameterSupport.java    From guice-persist-orient with MIT License 5 votes vote down vote up
@Override
public OCommandResultListener processListener(final OCommandRequest command,
                                              final Object listener,
                                              final Injector injector,
                                              final Class<?> conversionTarget) {
    checkExec(command instanceof OCommandRequestAbstract,
            "@%s can't be applied to query, because command object %s doesn't support it",
            Listen.class.getSimpleName(), command.getClass().getName());
    return wrap(listener, injector, conversionTarget, ((OSQLQuery) command).getText());
}