@Override
  @Before
  public void before() throws Exception {
    super.before();
    // Restoring up default profiles before tests:
    final InputStream xmlStream =
        ProfileImportCommandIT.class.getResourceAsStream("RestoreDefaultProfiles.xml");
    final byte[] xmlContent = IOUtils.toByteArray(xmlStream);
    xmlStream.close();
    final Map<String, Serializable> importParameters = new HashMap<String, Serializable>();
    importParameters.put("xmlContent", xmlContent);
    getCommandAPI().execute(IMPORT_PROFILES_CMD, importParameters);

    // search for the newly created profile IDs:
    final SearchOptions searchOptions =
        new SearchOptionsBuilder(0, 50).sort(ProfileSearchDescriptor.ID, Order.ASC).done();
    final SearchResult<Profile> searchProfiles = getProfileAPI().searchProfiles(searchOptions);
    final List<Profile> profiles = searchProfiles.getResult();
    assertEquals(2, profiles.size());
    for (final Profile map : profiles) {
      if ("Administrator".equals(map.getName())) {
        adminProfileId = map.getId();
      } else if ("User".equals(map.getName())) {
        userProfileId = map.getId();
      }
    }
  }
 @Override
 @After
 public void after() throws Exception {
   // Clean profiles
   final InputStream xmlStream = AbstractProfileIT.class.getResourceAsStream("CleanProfiles.xml");
   final byte[] xmlContent = IOUtils.toByteArray(xmlStream);
   xmlStream.close();
   final Map<String, Serializable> importParameters = new HashMap<String, Serializable>(1);
   importParameters.put("xmlContent", xmlContent);
   getCommandAPI().execute(IMPORT_PROFILES_CMD, importParameters);
   super.after();
 }