Search in sources :

Example 11 with PartialImportResults

use of org.keycloak.partialimport.PartialImportResults in project keycloak by keycloak.

the class PartialImportTest method testSkip.

private void testSkip() {
    setSkip();
    PartialImportResults results = doImport();
    assertEquals(NUM_ENTITIES, results.getAdded());
    results = doImport();
    assertEquals(NUM_ENTITIES, results.getSkipped());
}
Also used : PartialImportResults(org.keycloak.partialimport.PartialImportResults)

Example 12 with PartialImportResults

use of org.keycloak.partialimport.PartialImportResults in project keycloak by keycloak.

the class PartialImportTest method testAddProviders.

@Test
public void testAddProviders() {
    setFail();
    addProviders();
    PartialImportResults results = doImport();
    assertEquals(IDP_ALIASES.length, results.getAdded());
    for (PartialImportResult result : results.getResults()) {
        String id = result.getId();
        IdentityProviderResource idpRsc = testRealmResource().identityProviders().get(id);
        IdentityProviderRepresentation idp = idpRsc.toRepresentation();
        Map<String, String> config = idp.getConfig();
        assertTrue(Arrays.asList(IDP_ALIASES).contains(config.get("clientId")));
    }
}
Also used : PartialImportResult(org.keycloak.partialimport.PartialImportResult) IdentityProviderResource(org.keycloak.admin.client.resource.IdentityProviderResource) PartialImportResults(org.keycloak.partialimport.PartialImportResults) IdentityProviderRepresentation(org.keycloak.representations.idm.IdentityProviderRepresentation) AbstractAuthTest(org.keycloak.testsuite.AbstractAuthTest) Test(org.junit.Test)

Example 13 with PartialImportResults

use of org.keycloak.partialimport.PartialImportResults in project keycloak by keycloak.

the class PartialImportTest method testEverythingOverwrite.

@Test
public void testEverythingOverwrite() throws IOException {
    setOverwrite();
    importEverything(false);
    PartialImportResults results = doImport();
    assertEquals(NUM_ENTITIES * NUM_RESOURCE_TYPES, results.getOverwritten());
}
Also used : PartialImportResults(org.keycloak.partialimport.PartialImportResults) AbstractAuthTest(org.keycloak.testsuite.AbstractAuthTest) Test(org.junit.Test)

Example 14 with PartialImportResults

use of org.keycloak.partialimport.PartialImportResults in project keycloak by keycloak.

the class PartialImportTest method testFail.

private void testFail() {
    setFail();
    PartialImportResults results = doImport();
    assertNull(results.getErrorMessage());
    // second time should fail
    results = doImport();
    assertNotNull(results.getErrorMessage());
}
Also used : PartialImportResults(org.keycloak.partialimport.PartialImportResults)

Example 15 with PartialImportResults

use of org.keycloak.partialimport.PartialImportResults in project keycloak by keycloak.

the class PartialImportTest method testAddClientsOverwriteWithServiceAccountsAndAuthorization.

@EnableFeature(value = UPLOAD_SCRIPTS, skipRestart = true)
@Test
public void testAddClientsOverwriteWithServiceAccountsAndAuthorization() throws IOException {
    addClients(true);
    setOverwrite();
    PartialImportResults results = doImport();
    assertEquals(NUM_ENTITIES * 2, results.getAdded());
    results = doImport();
    assertEquals(NUM_ENTITIES * 2, results.getOverwritten());
}
Also used : PartialImportResults(org.keycloak.partialimport.PartialImportResults) AbstractAuthTest(org.keycloak.testsuite.AbstractAuthTest) Test(org.junit.Test) EnableFeature(org.keycloak.testsuite.arquillian.annotation.EnableFeature)

Aggregations

PartialImportResults (org.keycloak.partialimport.PartialImportResults)21 Test (org.junit.Test)17 AbstractAuthTest (org.keycloak.testsuite.AbstractAuthTest)17 PartialImportResult (org.keycloak.partialimport.PartialImportResult)6 EnableFeature (org.keycloak.testsuite.arquillian.annotation.EnableFeature)6 UserRepresentation (org.keycloak.representations.idm.UserRepresentation)4 UserResource (org.keycloak.admin.client.resource.UserResource)3 ClientRepresentation (org.keycloak.representations.idm.ClientRepresentation)3 HashSet (java.util.HashSet)2 ClientResource (org.keycloak.admin.client.resource.ClientResource)2 AdminEventRepresentation (org.keycloak.representations.idm.AdminEventRepresentation)2 RoleRepresentation (org.keycloak.representations.idm.RoleRepresentation)2 AuthorizationResource (org.keycloak.admin.client.resource.AuthorizationResource)1 IdentityProviderResource (org.keycloak.admin.client.resource.IdentityProviderResource)1 RoleResource (org.keycloak.admin.client.resource.RoleResource)1 IdentityProviderRepresentation (org.keycloak.representations.idm.IdentityProviderRepresentation)1 PartialImportRepresentation (org.keycloak.representations.idm.PartialImportRepresentation)1 RealmRepresentation (org.keycloak.representations.idm.RealmRepresentation)1 ResourceServerRepresentation (org.keycloak.representations.idm.authorization.ResourceServerRepresentation)1