Esempio n. 1
0
  private User setupAppUser(UUID appId, String username, String email, boolean activated)
      throws Exception {
    Mailbox.clearAll();

    EntityManager em = setup.getEmf().getEntityManager(appId);

    Map<String, Object> userProps = new LinkedHashMap<String, Object>();
    userProps.put("username", username);
    userProps.put("email", email);
    userProps.put("activated", activated);

    User user = em.create(User.ENTITY_TYPE, User.class, userProps);
    setup.getEntityIndex().refresh(app.getId());

    return user;
  }
Esempio n. 2
0
  private void testProperty(String propertyName, boolean containsSubstitution) {
    String propertyValue = setup.get(propertyName);
    assertTrue(propertyName + " was not found", isNotBlank(propertyValue));
    logger.info(propertyName + "=" + propertyValue);

    if (containsSubstitution) {
      Map<String, String> valuesMap = new HashMap<String, String>();
      valuesMap.put("reset_url", "test-url");
      valuesMap.put("organization_name", "test-org");
      valuesMap.put("activation_url", "test-url");
      valuesMap.put("confirmation_url", "test-url");
      valuesMap.put("user_email", "test-email");
      valuesMap.put("pin", "test-pin");
      StrSubstitutor sub = new StrSubstitutor(valuesMap);
      String resolvedString = sub.replace(propertyValue);
      assertNotSame(propertyValue, resolvedString);
    }
  }