Examples of QueryService


Examples of com.breezejs.hib.QueryService

  private QueryService queryService;
  private SaveService saveService;
  private static String metadataJson;
 
  public NorthBreeze() {
      queryService = new QueryService(StaticConfigurator.getSessionFactory());
      saveService = new SaveService(StaticConfigurator.getSessionFactory(), StaticConfigurator.getMetadata());
  }
View Full Code Here

Examples of com.gemstone.gemfire.cache.query.QueryService

   */
  @Override
  @SuppressWarnings("unchecked")
  public <E> SelectResults<E> find(final String queryString, final Object... params) throws InvalidDataAccessApiUsageException {
    try {
      QueryService queryService = lookupQueryService(getRegion());
      Query query = queryService.newQuery(queryString);
      Object result = query.execute(params);

      if (result instanceof SelectResults) {
        return (SelectResults<E>) result;
      }
View Full Code Here

Examples of com.gemstone.gemfire.cache.query.QueryService

   */
  @Override
  @SuppressWarnings("unchecked")
  public <T> T findUnique(final String queryString, final Object... params) throws InvalidDataAccessApiUsageException {
    try {
      QueryService queryService = lookupQueryService(getRegion());
      Query query = queryService.newQuery(queryString);
      Object result = query.execute(params);

      if (result instanceof SelectResults) {
        SelectResults<T> selectResults = (SelectResults<T>) result;

View Full Code Here

Examples of com.gemstone.gemfire.cache.query.QueryService

  private Region<?, ?> simple;

  @Before
  @SuppressWarnings("rawtypes")
  public void setUp() throws FunctionDomainException, TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
    QueryService queryService = MockRegionFactory.mockQueryService();
    Query singleQuery = mock(Query.class);

    when(singleQuery.execute(any(Object[].class))).thenReturn(0);
    when(queryService.newQuery(SINGLE_QUERY)).thenReturn(singleQuery);

    Query multipleQuery = mock(Query.class);
    SelectResults selectResults = mock(SelectResults.class);

    when(multipleQuery.execute(any(Object[].class))).thenReturn(selectResults);
    when(queryService.newQuery(MULTI_QUERY)).thenReturn(multipleQuery);
  }
View Full Code Here

Examples of com.gemstone.gemfire.cache.query.QueryService

  @Test
  @SuppressWarnings("unchecked")
  public void testLookupQueryService() {
    ClientCache mockClientCache = mock(ClientCache.class, "testLookupQueryService.ClientCache");
    QueryService mockQueryService = mock(QueryService.class, "testLookupQueryService.QueryService");
    Region<Object, Object> mockRegion = mock(Region.class, "testLookupQueryService.Region");

    when(mockRegion.getRegionService()).thenReturn(mockClientCache);
    when(mockClientCache.getQueryService()).thenReturn(mockQueryService);
View Full Code Here

Examples of com.gemstone.gemfire.cache.query.QueryService

  @Test
  @SuppressWarnings("unchecked")
  public void testLookupLocalQueryService() {
    ClientCache mockClientCache = mock(ClientCache.class, "testLookupLocalQueryService.ClientCache");
    QueryService mockQueryService = mock(QueryService.class, "testLookupLocalQueryService.QueryService");
    Region<Object, Object> mockRegion = mock(Region.class, "testLookupLocalQueryService.Region");
    RegionAttributes<Object, Object> mockRegionAttributes = mock(RegionAttributes.class, "testLookupLocalQueryService.RegionAttributes");

    when(mockClientCache.getLocalQueryService()).thenReturn(mockQueryService);
    when(mockRegion.getRegionService()).thenReturn(mockClientCache);
View Full Code Here

Examples of com.gemstone.gemfire.cache.query.QueryService

  /* (non-Javadoc)
   * @see com.gemstone.gemfire.cache.RegionService#getQueryService()
   */
  @Override
  public QueryService getQueryService() {
    QueryService qs = null;
    try {
      qs =  mockQueryService();
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

Examples of com.gemstone.gemfire.cache.query.QueryService

    return gatewayHub;
  }

  QueryService mockQueryService() throws RegionNotFoundException, IndexInvalidException, IndexNameConflictException, IndexExistsException, UnsupportedOperationException {
    QueryService queryService = mock(QueryService.class);

    when(queryService.getIndexes()).thenReturn(new ArrayList<Index>());

    when(queryService.createIndex(anyString(), anyString(),anyString())).thenAnswer(new Answer<Index>() {
      @Override
      public Index answer(InvocationOnMock invocation) throws Throwable {
        String indexName = (String) invocation.getArguments()[0];
        String indexedExpression = (String) invocation.getArguments()[1];
        String fromClause = (String) invocation.getArguments()[2];
        return mockIndex(indexName, com.gemstone.gemfire.cache.query.IndexType.FUNCTIONAL, indexedExpression,
          fromClause, null);
      }
    });

    when(queryService.createIndex(anyString(), anyString(),anyString(),anyString())).thenAnswer(new Answer<Index>() {
      @Override
      public Index answer(InvocationOnMock invocation) throws Throwable {
        String indexName = (String) invocation.getArguments()[0];
        String indexedExpression = (String) invocation.getArguments()[1];
        String fromClause = (String) invocation.getArguments()[2];
        String imports = (String) invocation.getArguments()[3];
        return mockIndex(indexName, com.gemstone.gemfire.cache.query.IndexType.FUNCTIONAL, indexedExpression,
          fromClause, imports);
      }
    });

    when(queryService.createKeyIndex(anyString(), anyString(),anyString())).thenAnswer(new Answer<Index>() {
      @Override
      public Index answer(InvocationOnMock invocation) throws Throwable {
        String indexName = (String) invocation.getArguments()[0];
        String indexedExpression = (String) invocation.getArguments()[1];
        String fromClause = (String) invocation.getArguments()[2];

        return mockIndex(indexName, com.gemstone.gemfire.cache.query.IndexType.PRIMARY_KEY, indexedExpression,
          fromClause, null);
      }
    });

    when(queryService.createHashIndex(anyString(), anyString(),anyString())).thenAnswer(new Answer<Index>() {
      @Override
      public Index answer(InvocationOnMock invocation) throws Throwable {
        String indexName = (String) invocation.getArguments()[0];
        String indexedExpression = (String) invocation.getArguments()[1];
        String fromClause = (String) invocation.getArguments()[2];

        return mockIndex(indexName, com.gemstone.gemfire.cache.query.IndexType.HASH, indexedExpression,
          fromClause, null);
      }
    });

    when(queryService.createHashIndex(anyString(), anyString(),anyString(),anyString())).thenAnswer(new Answer<Index>() {
      @Override
      public Index answer(InvocationOnMock invocation) throws Throwable {
        String indexName = (String) invocation.getArguments()[0];
        String indexedExpression = (String) invocation.getArguments()[1];
        String fromClause = (String) invocation.getArguments()[2];
View Full Code Here

Examples of org.apache.oodt.cas.catalog.struct.QueryService

  }
   
  public List<CatalogReceipt> query(QueryExpression queryExpression) throws CatalogException {
    try {
      if (this.isQueriable()) {
        QueryService queryService = (QueryService) this.index;
        List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
        for (IngestReceipt ingestReceipt : queryService.query(queryExpression))
          catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
        return Collections.unmodifiableList(catalogReceipts);
      }else {
        LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
        return Collections.emptyList();
View Full Code Here

Examples of org.apache.oodt.cas.catalog.struct.QueryService

 

  public List<CatalogReceipt> query(QueryExpression queryExpression, int startIndex, int endIndex) throws CatalogException {
    try {
      if (this.isQueriable()) {
        QueryService queryService = (QueryService) this.index;
        List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
        for (IngestReceipt ingestReceipt : queryService.query(queryExpression, startIndex, endIndex))
          catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
        return Collections.unmodifiableList(catalogReceipts);
      }else {
        LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
        return Collections.emptyList();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.