Package org.springframework.data.gemfire.repository.sample

Examples of org.springframework.data.gemfire.repository.sample.User


  protected static User createUser(final String username, final Boolean active) {
    return createUser(username, String.format("%1$s@companyx.com", username), Calendar.getInstance(), active);
  }

  protected static User createUser(final String username, final String email, final Calendar since, final Boolean active) {
    User user = new User(username);
    user.setActive(Boolean.TRUE.equals(active));
    user.setEmail(email);
    user.setSince(since);
    return user;
  }
View Full Code Here


    assertFalse(usersTemplate.containsValueForKey("chocolateChipCookieDoe"));
  }

  @Test
  public void testCreate() {
    User bartSimpson = createUser("bartSimpson");

    usersTemplate.create(getKey(bartSimpson), bartSimpson);

    assertTrue(users.containsKey(getKey(bartSimpson)));
    assertTrue(users.containsValueForKey(getKey(bartSimpson)));
View Full Code Here

    assertNullEquals(users.get("mrT"), usersTemplate.get("mrT"));
  }

  @Test
  public void testPut() {
    User peterGriffon = createUser("peterGriffon");

    assertNull(usersTemplate.put(getKey(peterGriffon), peterGriffon));
    assertEquals(peterGriffon, users.get(getKey(peterGriffon)));
  }
View Full Code Here

    assertEquals(peterGriffon, users.get(getKey(peterGriffon)));
  }

  @Test
  public void testPutIfAbsent() {
    User stewieGriffon = createUser("stewieGriffon");

    assertFalse(users.containsValue(stewieGriffon));
    assertNull(usersTemplate.putIfAbsent(getKey(stewieGriffon), stewieGriffon));
    assertTrue(users.containsValue(stewieGriffon));
    assertEquals(stewieGriffon, usersTemplate.putIfAbsent(getKey(stewieGriffon), createUser("megGriffon")));
View Full Code Here

    assertEquals(stewieGriffon, users.get(getKey(stewieGriffon)));
  }

  @Test
  public void testRemove() {
    User mandyHandy = users.get(getKey(getUser("mandyHandy")));

    assertNotNull(mandyHandy);
    assertEquals(mandyHandy, usersTemplate.remove(getKey(mandyHandy)));
    assertFalse(users.containsKey(getKey(mandyHandy)));
    assertFalse(users.containsValue(mandyHandy));
View Full Code Here

    assertFalse(users.containsKey("loisGriffon"));
  }

  @Test
  public void testReplace() {
    User randyHandy = users.get(getKey(getUser("randyHandy")));
    User lukeFluke = createUser("lukeFluke");
    User chrisGriffon = createUser("chrisGriffon");

    assertNotNull(randyHandy);
    assertEquals(randyHandy, usersTemplate.replace(getKey(randyHandy), lukeFluke));
    assertEquals(lukeFluke, users.get(getKey(randyHandy)));
    assertFalse(users.containsValue(randyHandy));
View Full Code Here

    assertFalse(users.containsValue(chrisGriffon));
  }

  @Test
  public void testReplaceOldValueWithNewValue() {
    User jackHandy = getUser("jackHandy");
    User imaPigg = getUser("imaPigg");

    assertTrue(users.containsValue(jackHandy));
    assertFalse(usersTemplate.replace(getKey(jackHandy), null, imaPigg));
    assertTrue(users.containsValue(jackHandy));
    assertEquals(jackHandy, users.get(getKey(jackHandy)));
View Full Code Here

    assertEquals(actualUserMapping, expectedUserMapping);
  }

  @Test
  public void testPutAll() {
    User batMan = createUser("batMap");
    User spiderMan = createUser("spiderMan");
    User superMan = createUser("superMan");

    Map<String, User> userMap = getUsersAsMap(batMan, spiderMan, superMan);

    assertFalse(users.keySet().containsAll(userMap.keySet()));
    assertFalse(users.values().containsAll(userMap.values()));
View Full Code Here

    assertTrue(usersFound.containsAll(getUsers("jonDoe", "cookieDoe")));
  }

  @Test
  public void testFindUniqueReturnsResult() {
    User jonDoe = usersTemplate.findUnique("SELECT u FROM /Users u WHERE u.username = $1", "jonDoe");

    assertNotNull(jonDoe);
    assertEquals(getUser("jonDoe"), jonDoe);
  }
View Full Code Here

      return createUser(username, active, since, String.format("%1$s@xcompay.com", username));
    }

    protected static User createUser(final String username, final Boolean active, final Calendar since,
        final String email) {
      User user = new User(username);
      user.setActive(active);
      user.setEmail(email);
      user.setSince(since);
      return user;
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.gemfire.repository.sample.User

Copyright © 2018 www.massapicom. 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.