Examples of KeyRange


Examples of com.fasterxml.clustermate.api.KeyRange

            return (RESP) badRequest(response, "Invalid '"+ClusterMateConstants.HTTP_QUERY_PARAM_TIMESTAMP
                    +"': '{}'", timestampStr);
        }
       
        if (ClusterMateConstants.STATE_ACTIVE.equals(stateStr)) {
            KeyRange range = null;

            // For activation, would prefer having key range too:
            Integer keyRangeStart = _findIntParam(request, ClusterMateConstants.HTTP_QUERY_PARAM_KEYRANGE_START);
            if (keyRangeStart != null) {
                Integer keyRangeLength = _findIntParam(request, ClusterMateConstants.HTTP_QUERY_PARAM_KEYRANGE_LENGTH);
View Full Code Here

Examples of com.google.appengine.api.datastore.KeyRange

  public KeyRange allocateIds(String arg0, long arg1)
  {
    long start = getNext(arg0);
    ids.put(arg0, start + arg1 - 1);
    return new KeyRange(null, arg0, start, start + arg1 - 1);
  }
View Full Code Here

Examples of com.google.appengine.api.datastore.KeyRange

    // in order to make sure we get a fresh block of ids when we persist
    // we need to make sure we don't reuse the pmf
    pmf.close();
    tearDown();
    setUp();
    KeyRange range = ds.allocateIds("jdothat2", 1);
    HasSequenceWithSequenceGenerator2 pojo = new HasSequenceWithSequenceGenerator2();
    beginTxn();
    pm.makePersistent(pojo);
    commitTxn();
    // the local datastore id allocator is a single sequence so if there
    // are any other allocations happening we can't assert on exact values.
    // uncomment this check and the others below when we bring the local
    // allocator in line with the prod allocator
    // assertEquals(range.getEnd().getId(), pojo.getId() - 1);
    assertTrue(range.getEnd().getId() < pojo.getId());
    Sequence seq = pm.getSequence("jdo1b");
//    assertEquals(pojo.getId() + 12, seq.nextValue());
    assertTrue(pojo.getId() + 12 <= seq.nextValue());
//    assertEquals(pojo.getId() + 13, seq.nextValue());
    assertTrue(pojo.getId() + 13 <= seq.nextValue());
View Full Code Here

Examples of com.google.appengine.api.datastore.KeyRange

    assertEquals(Utils.newArrayList(12L), sequenceBatchSizes);
  }

  public void testInsertWithSequenceGenerator_NoSequenceName() throws EntityNotFoundException {
    String kind = getKind(HasSequenceWithNoSequenceName.class);
    KeyRange keyRange = ds.allocateIds(kind, 5);
    HasSequenceWithNoSequenceName pojo = new HasSequenceWithNoSequenceName();
    beginTxn();
    em.persist(pojo);
    commitTxn();
    ds.get(KeyFactory.createKey(kind, pojo.getId()));
    // the local datastore id allocator is a single sequence so if there
    // are any other allocations happening we can't assert on exact values.
    // uncomment this check and the others below when we bring the local
    // allocator in line with the prod allocator
//    assertEquals(keyRange.getEnd().getId(), pojo.getId() - 1);
    assertTrue(keyRange.getEnd().getId() < pojo.getId());
    keyRange = ds.allocateIds(kind, 1);
//    assertEquals(pojo.getId() + 12, keyRange.getStart().getId());
    assertTrue(pojo.getId() + 12 <= keyRange.getStart().getId());
    assertEquals(Utils.newArrayList(kind + "_SEQUENCE__JPA"), sequenceNames);
    assertEquals(Utils.newArrayList(12L), sequenceBatchSizes);
  }
View Full Code Here

Examples of com.google.appengine.api.datastore.KeyRange

    /**
     * @throws Exception
     */
    @Test
    public void allocateIdsAsync() throws Exception {
        KeyRange range = delegate.allocateIdsAsync("Hoge", 2).get();
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));

        range = delegate.allocateIdsAsync(Hoge.class, 2).get();
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));

        range = delegate.allocateIdsAsync(meta, 2).get();
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));
    }
View Full Code Here

Examples of com.google.appengine.api.datastore.KeyRange

     * @throws Exception
     */
    @Test
    public void allocateIdsAsyncWithParentKey() throws Exception {
        Key parentKey = KeyFactory.createKey("Parent", 1);
        KeyRange range = delegate.allocateIdsAsync(parentKey, "Hoge", 2).get();
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));

        range = delegate.allocateIdsAsync(parentKey, Hoge.class, 2).get();
        assertThat(range, is(notNullValue()));
        assertEquals(2, range.getSize());

        range = delegate.allocateIdsAsync(parentKey, meta, 2).get();
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));
    }
View Full Code Here

Examples of com.google.appengine.api.datastore.KeyRange

    /**
     * @throws Exception
     */
    @Test
    public void allocateIds() throws Exception {
        KeyRange range = delegate.allocateIds("Hoge", 2);
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));

        range = delegate.allocateIds(Hoge.class, 2);
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));

        range = delegate.allocateIds(meta, 2);
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));
    }
View Full Code Here

Examples of com.google.appengine.api.datastore.KeyRange

     * @throws Exception
     */
    @Test
    public void allocateIdsWithParentKey() throws Exception {
        Key parentKey = KeyFactory.createKey("Parent", 1);
        KeyRange range = delegate.allocateIds(parentKey, "Hoge", 2);
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));

        range = delegate.allocateIds(parentKey, Hoge.class, 2);
        assertThat(range, is(notNullValue()));
        assertEquals(2, range.getSize());

        range = delegate.allocateIds(parentKey, meta, 2);
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));
    }
View Full Code Here

Examples of com.google.appengine.api.datastore.KeyRange

    /**
     * @throws Exception
     */
    @Test
    public void allocateIds() throws Exception {
        KeyRange range = Datastore.allocateIds("Hoge", 2);
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));

        range = Datastore.allocateIds(Hoge.class, 2);
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));

        range = Datastore.allocateIds(meta, 2);
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));
    }
View Full Code Here

Examples of com.google.appengine.api.datastore.KeyRange

    /**
     * @throws Exception
     */
    @Test
    public void allocateIdsAsync() throws Exception {
        KeyRange range = Datastore.allocateIdsAsync("Hoge", 2).get();
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));

        range = Datastore.allocateIdsAsync(Hoge.class, 2).get();
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));

        range = Datastore.allocateIdsAsync(meta, 2).get();
        assertThat(range, is(notNullValue()));
        assertThat(range.getSize(), is(2L));
    }
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.