Package com.opengamma.master.user

Examples of com.opengamma.master.user.ManageableOGUser$Meta


  }

  //-------------------------------------------------------------------------
  @Test
  public void test_example() throws Exception {
    ManageableOGUser user = new ManageableOGUser("Test");
    user.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D")));
    user.setPasswordHash("PASSWORD_HASH");
    user.getEntitlements().add("ENTITLEMENT-1");
    user.getEntitlements().add("ENTITLEMENT-2");
    user.getEntitlements().add("ENTITLEMENT-3");
    UserDocument addDoc = new UserDocument(user);
    UserDocument added = _userMaster.add(addDoc);
   
    UserDocument loaded = _userMaster.get(added.getUniqueId());
    assertEquals(added, loaded);
View Full Code Here


    assertEquals(added, loaded);
  }

  @Test
  public void test_noid() throws Exception {
    ManageableOGUser user = new ManageableOGUser("Test");
    user.setPasswordHash("PASSWORD_HASH");
    user.getEntitlements().add("ENTITLEMENT-1");
    user.getEntitlements().add("ENTITLEMENT-2");
    user.getEntitlements().add("ENTITLEMENT-3");
    UserDocument addDoc = new UserDocument(user);
    UserDocument added = _userMaster.add(addDoc);
   
    UserDocument loaded = _userMaster.get(added.getUniqueId());
    assertEquals(added, loaded);
View Full Code Here

    assertEquals(added, loaded);
  }

  @Test
  public void test_no_entitlements() throws Exception {
    ManageableOGUser user = new ManageableOGUser("Test");
    user.setExternalIdBundle(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D")));
    user.setPasswordHash("PASSWORD_HASH");
    UserDocument addDoc = new UserDocument(user);
    UserDocument added = _userMaster.add(addDoc);
   
    UserDocument loaded = _userMaster.get(added.getUniqueId());
    assertEquals(added, loaded);
View Full Code Here

    searchRequest.setVersionCorrection(vc);
    return _userMaster.search(searchRequest).getUsers();
  }

  protected UserDocument addUser(String userId, String passwordHash, ExternalIdBundle idBundle, String... entitlements) {
    ManageableOGUser user = new ManageableOGUser(userId);
    user.setExternalIdBundle(idBundle);
    user.setPasswordHash(passwordHash);
    for (String entitlement : entitlements) {
      user.getEntitlements().add(entitlement);
    }
    UserDocument addDoc = new UserDocument(user);
    UserDocument added = _userMaster.add(addDoc);
    return added;
  }
View Full Code Here

  @Test
  public void test_add() {
    Instant now = Instant.now(_usrMaster.getClock());
   
    ManageableOGUser user = new ManageableOGUser("AddedUser");
    user.setPasswordHash("TESTHASH");
    user.setName("Test Name");
    user.setEmailAddress("test@test.com");
    user.setExternalIdBundle(BUNDLE);
    user.setEntitlements(Sets.newHashSet("A", "B"));
    ZoneId zone = user.getTimeZone();
    UserDocument doc = new UserDocument(user);
    UserDocument test = _usrMaster.add(doc);
   
    UniqueId uniqueId = test.getUniqueId();
    assertNotNull(uniqueId);
    assertEquals("DbUsr", uniqueId.getScheme());
    assertTrue(uniqueId.isVersioned());
    assertTrue(Long.parseLong(uniqueId.getValue()) >= 1000);
    assertEquals("0", uniqueId.getVersion());
    assertEquals(now, test.getVersionFromInstant());
    assertEquals(null, test.getVersionToInstant());
    assertEquals(now, test.getCorrectionFromInstant());
    assertEquals(null, test.getCorrectionToInstant());
    ManageableOGUser testUser = test.getUser();
    assertNotNull(testUser);
    assertEquals(uniqueId, testUser.getUniqueId());
    assertEquals("TESTHASH", testUser.getPasswordHash());
    assertEquals("Test Name", testUser.getName());
    assertEquals(zone, testUser.getTimeZone());
    assertEquals("test@test.com", testUser.getEmailAddress());
    assertEquals(BUNDLE, testUser.getExternalIdBundle());
    assertEquals(Sets.newHashSet("A", "B"), testUser.getEntitlements());
  }
View Full Code Here

    assertEquals(Sets.newHashSet("A", "B"), testUser.getEntitlements());
  }

  @Test
  public void test_add_addThenGet() {
    ManageableOGUser user = new ManageableOGUser("Test");
    user.setName("Test Name");
    user.setEmailAddress("test@test.com");
    user.setEntitlements(Sets.newHashSet("A", "B"));
    UserDocument doc = new UserDocument(user);
    UserDocument added = _usrMaster.add(doc);
   
    UserDocument test = _usrMaster.get(added.getUniqueId());
    assertEquals(added, test);
View Full Code Here

    assertEquals(added, test);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_add_addWithMissingTimeZoneProperty() {
    ManageableOGUser user = mock(ManageableOGUser.class);
    when(user.getUserId()).thenReturn("AddedUser");
    UserDocument doc = new UserDocument(user);
    _usrMaster.add(doc);
  }
View Full Code Here

    _usrMaster.add(doc);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_add_addWithMissingUserIdProperty() {
    ManageableOGUser user = mock(ManageableOGUser.class);
    when(user.getTimeZone()).thenReturn(ZoneOffset.UTC);
    UserDocument doc = new UserDocument(user);
    _usrMaster.add(doc);
  }
View Full Code Here

  }

  @Test
  public void test_add_addWithMinimalProperties() {
    // Time zone is set to UTC automatically and user ID is a required arg to constructor
    ManageableOGUser user = new ManageableOGUser("AddedUser");
    UserDocument doc = new UserDocument(user);
    _usrMaster.add(doc);
  }
View Full Code Here

    Clock origClock = _usrMaster.getClock();
    try {
      _usrMaster.setClock(Clock.fixed(now, ZoneOffset.UTC));

      final ExternalIdBundle bundle = ExternalIdBundle.of("B", "B0");
      ManageableOGUser user = new ManageableOGUser("initial");
      user.setExternalIdBundle(bundle);
      UserDocument initialDoc = new UserDocument(user);

      _usrMaster.add(initialDoc);

      ObjectId baseOid = initialDoc.getObjectId();

      List<UserDocument> firstReplacement = newArrayList();
      for (int i = 0; i < 5; i++) {
        ManageableOGUser ex = new ManageableOGUser("setup_" + i);
        UserDocument doc = new UserDocument(ex);
        doc.setVersionFromInstant(now.plus(i, MINUTES));
        firstReplacement.add(doc);
      }
      _usrMaster.setClock(Clock.fixed(now.plus(1, HOURS), ZoneOffset.UTC));
View Full Code Here

TOP

Related Classes of com.opengamma.master.user.ManageableOGUser$Meta

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.