@Before
  public void initJdbcScimUserProvisioningTests() throws Exception {
    db =
        new JdbcScimUserProvisioning(
            jdbcTemplate, new JdbcPagingListFactory(jdbcTemplate, limitSqlAdapter));
    zoneDb = new JdbcIdentityZoneProvisioning(jdbcTemplate);
    providerDb = new JdbcIdentityProviderProvisioning(jdbcTemplate);
    ScimSearchQueryConverter filterConverter = new ScimSearchQueryConverter();
    Map<String, String> replaceWith = new HashMap<String, String>();
    replaceWith.put("emails\\.value", "email");
    replaceWith.put("groups\\.display", "authorities");
    replaceWith.put("phoneNumbers\\.value", "phoneNumber");
    filterConverter.setAttributeNameMapper(new SimpleAttributeNameMapper(replaceWith));
    db.setQueryConverter(filterConverter);
    BCryptPasswordEncoder pe = new BCryptPasswordEncoder(4);

    existingUserCount = jdbcTemplate.queryForObject("select count(id) from users", Integer.class);

    defaultIdentityProviderId =
        jdbcTemplate.queryForObject(
            "select id from identity_provider where origin_key = ? and identity_zone_id = ?",
            String.class,
            OriginKeys.UAA,
            "uaa");

    addUser(
        JOE_ID,
        "joe",
        pe.encode("joespassword"),
        "*****@*****.**",
        "Joe",
        "User",
        "+1-222-1234567",
        defaultIdentityProviderId,
        "uaa");
    addUser(
        MABEL_ID,
        "mabel",
        pe.encode("mabelspassword"),
        "*****@*****.**",
        "Mabel",
        "User",
        "",
        defaultIdentityProviderId,
        "uaa");
  }
  @Before
  public void createDatasource() throws Exception {
    db =
        new JdbcScimUserProvisioning(
            template, new JdbcPagingListFactory(template, limitSqlAdapter));
    ScimSearchQueryConverter filterConverter = new ScimSearchQueryConverter();
    Map<String, String> replaceWith = new HashMap<String, String>();
    replaceWith.put("emails\\.value", "email");
    replaceWith.put("groups\\.display", "authorities");
    replaceWith.put("phoneNumbers\\.value", "phoneNumber");
    filterConverter.setAttributeNameMapper(new SimpleAttributeNameMapper(replaceWith));
    db.setQueryConverter(filterConverter);
    BCryptPasswordEncoder pe = new BCryptPasswordEncoder(4);

    existingUserCount = template.queryForInt("select count(id) from users");

    addUser(
        JOE_ID, "joe", pe.encode("joespassword"), "*****@*****.**", "Joe", "User", "+1-222-1234567");
    addUser(MABEL_ID, "mabel", pe.encode("mabelspassword"), "*****@*****.**", "Mabel", "User", "");
  }