use of org.keycloak.partialimport.PartialImportResults in project keycloak by keycloak.
the class PartialImportTest method testAddClientRoles.
@Test
public void testAddClientRoles() {
setFail();
addClientRoles();
PartialImportResults results = doImport();
assertEquals(NUM_ENTITIES, results.getAdded());
List<RoleRepresentation> clientRoles = clientRolesClient().roles().list();
assertEquals(NUM_ENTITIES, clientRoles.size());
for (RoleRepresentation roleRep : clientRoles) {
assertTrue(roleRep.getName().startsWith(CLIENT_ROLE_PREFIX));
}
}
use of org.keycloak.partialimport.PartialImportResults in project keycloak by keycloak.
the class PartialImportTest method testEverythingOverwriteWithServiceAccounts.
@EnableFeature(value = UPLOAD_SCRIPTS, skipRestart = true)
@Test
public void testEverythingOverwriteWithServiceAccounts() throws IOException {
setOverwrite();
importEverything(true);
PartialImportResults results = doImport();
assertEquals(NUM_ENTITIES * (NUM_RESOURCE_TYPES + 1), results.getOverwritten());
}
use of org.keycloak.partialimport.PartialImportResults in project keycloak by keycloak.
the class PartialImportTest method testEverythingFail.
@Test
public void testEverythingFail() throws IOException {
setFail();
importEverything(false);
// second import will fail because not allowed to skip or overwrite
PartialImportResults results = doImport();
assertNotNull(results.getErrorMessage());
}
use of org.keycloak.partialimport.PartialImportResults in project keycloak by keycloak.
the class PartialImportTest method testEverythingSkipWithServiceAccounts.
@EnableFeature(value = UPLOAD_SCRIPTS, skipRestart = true)
@Test
public void testEverythingSkipWithServiceAccounts() throws IOException {
setSkip();
importEverything(true);
PartialImportResults results = doImport();
assertEquals(NUM_ENTITIES * (NUM_RESOURCE_TYPES + 1), results.getSkipped());
}
use of org.keycloak.partialimport.PartialImportResults in project keycloak by keycloak.
the class PartialImportTest method testAddRealmRoles.
@Test
public void testAddRealmRoles() {
setFail();
addRealmRoles();
PartialImportResults results = doImport();
assertEquals(NUM_ENTITIES, results.getAdded());
for (PartialImportResult result : results.getResults()) {
String name = result.getResourceName();
RoleResource roleRsc = testRealmResource().roles().get(name);
RoleRepresentation role = roleRsc.toRepresentation();
assertTrue(role.getName().startsWith(REALM_ROLE_PREFIX));
}
}
Aggregations