/*
   * !!! These test depends on files in test resources !!!
   */
  @Test
  public void testLastDeployedProcessPropertiesCanBeRetrieveFromAFile() throws Exception {
    SecurityProperties processProperties =
        SecurityProperties.getInstance(1, new ProcessIdentifier("process3", "2.9"));

    assertFalse(processProperties.allowAutoLogin());
    assertEquals("aUserNameForSecondDeployement", processProperties.getAutoLoginUserName());
    assertEquals("aPasswordForSecondDeployement", processProperties.getAutoLoginPassword());
  }
  /*
   * !!! These test depends on files in test resources !!!
   */
  @Test
  public void testGettingPropertiesFromProcessWithoutSecurityConfigRetrieveTenantSecurityConfig()
      throws Exception {
    SecurityProperties processProperties =
        SecurityProperties.getInstance(1, new ProcessIdentifier("process2", "1.5"));

    assertTrue(checkTenantProperties(processProperties));
  }
 /** @return the {@link CompoundPermissionsMapping} instance */
 protected static CompoundPermissionsMapping getInstance(final long tenantId) {
   CompoundPermissionsMapping tenancyProperties = INSTANCES.get(tenantId);
   if (tenancyProperties == null
       || SecurityProperties.getInstance(tenantId).isAPIAuthorizationsCheckInDebugMode()) {
     final File fileName = getTenantPropertiesFile(tenantId, PROPERTIES_FILENAME);
     tenancyProperties = new CompoundPermissionsMapping(fileName);
     INSTANCES.put(tenantId, tenancyProperties);
   }
   return tenancyProperties;
 }
 private boolean checkTenantProperties(SecurityProperties properties) {
   return properties.allowAutoLogin()
       && "aUserNameForTenant".equals(properties.getAutoLoginUserName())
       && "aPasswordForTenant".equals(properties.getAutoLoginPassword());
 }
  /*
   * !!! These test depends on files in test resources !!!
   */
  @Test
  public void testTenantPropertiesCanBeRetrieveFromAFile() throws Exception {
    SecurityProperties tenantProperties = SecurityProperties.getInstance(1);

    checkTenantProperties(tenantProperties);
  }