Package javax.jdo

Examples of javax.jdo.Query.addExtension()


          throw jdoe;
        }
    }

    q = pm.newQuery("select from " + Book.class.getName() + " where title.matches('y')");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      ((List<?>) q.execute()).isEmpty();
      fail("expected exception");
    } catch (JDOUserException jdoe) {
        if (jdoe.getCause() instanceof DatastoreQuery.UnsupportedDatastoreFeatureException) {
View Full Code Here


          throw jdoe;
        }
    }

    q = pm.newQuery("select from " + Book.class.getName() + " where title.matches('y.*') && author.matches('z.*')");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      ((List<?>) q.execute()).isEmpty();
      fail("expected exception");
    } catch (JDOFatalUserException e) {
      // good
View Full Code Here

    }
  }

  public void testMatchesQuery_InvalidParameter() {
    Query q = pm.newQuery("select from " + Book.class.getName() + " where title.matches(:p)");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      ((List<?>) q.execute(".*y")).isEmpty();
      fail("expected exception");
    } catch (JDOUserException jdoe) {
        if (jdoe.getCause() instanceof DatastoreQuery.UnsupportedDatastoreFeatureException) {
View Full Code Here

  }

  public void testNullAncestorParam() {
    Query q = pm.newQuery(HasKeyAncestorStringPkJDO.class);
    q.setFilter("ancestorKey == :p");
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute(null);
      fail("expected exception");
    } catch (JDOUserException jdoe) {
        if (jdoe.getCause() instanceof DatastoreQuery.UnsupportedDatastoreFeatureException) {
View Full Code Here

                                EasyMock.eq("RunQuery"),
                                FailoverMsMatcher.eqFailoverMs(null),
                                ApiConfigMatcher.eqApiConfig(config))).andReturn(result);
      EasyMock.replay(delegate);
      q = pm.newQuery(Flight.class);
      q.addExtension("datanucleus.appengine.datastoreReadConsistency", null);
      q.execute();
      EasyMock.verify(delegate);

      delegate = EasyMock.createMock(ApiProxy.Delegate.class);
      setDelegateForThread(delegate);
View Full Code Here

                                EasyMock.eq("RunQuery"),
                                FailoverMsMatcher.eqFailoverMs(null),
                                ApiConfigMatcher.eqApiConfig(config))).andReturn(result);
      EasyMock.replay(delegate);
      q = pm.newQuery(Flight.class);
      q.addExtension("datanucleus.appengine.datastoreReadConsistency", "STRONG");
      q.execute();
      EasyMock.verify(delegate);

      delegate = EasyMock.createMock(ApiProxy.Delegate.class);
      setDelegateForThread(delegate);
View Full Code Here

                                EasyMock.eq("RunQuery"),
                                FailoverMsMatcher.eqFailoverMs(-1L),
                                ApiConfigMatcher.eqApiConfig(config))).andReturn(result);
      EasyMock.replay(delegate);
      q = pm.newQuery(Flight.class);
      q.addExtension("datanucleus.appengine.datastoreReadConsistency", "EVENTUAL");
      q.execute();
      EasyMock.verify(delegate);
    } finally {
      setDelegateForThread(original);
    }
View Full Code Here

  private void assertQueryUnsupportedByOrm(
      Class<?> clazz, String query, Expression.Operator unsupportedOp,
      Set<Expression.Operator> unsupportedOps) {
    Query q = pm.newQuery(clazz, query);
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      q.execute();
      fail("expected JDOUserException->UnsupportedOperationException for query <" + query + ">");
    } catch (JDOUserException jdoe) {
      Throwable cause = jdoe.getCause();
View Full Code Here

    unsupportedOps.remove(unsupportedOp);
  }

  private void assertQueryUnsupportedByDatastore(String query) {
    Query q = pm.newQuery(query);
    q.addExtension(DatastoreManager.QUERYEXT_INMEMORY_WHEN_UNSUPPORTED, "false");
    try {
      ((List<?>) q.execute()).isEmpty();
      fail("expected exception for query <" + query + ">");
    } catch (JDOFatalUserException e) {
      // good
View Full Code Here

        int index = 0;
        Query query = getPM().newQuery(singleStringQuery);
        Map extentions = new HashMap();
        extentions.put("unknown key 1", "unknown value 1");
        query.setExtensions(extentions);
        query.addExtension("unknown key 2", "unknown value 2");
        executeJDOQuery(ASSERTION_FAILED, query, singleStringQuery,
                false, null, expectedResult[index], true);
    }
   
    /**
 
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.