From 01051016f5df9915786be0f05794353c3879221f Mon Sep 17 00:00:00 2001 From: wyvie Date: Wed, 12 Sep 2018 08:35:39 +0200 Subject: [PATCH] [KEYCLOAK-8185] add clear method to exportimport resource --- .../rest/resource/TestingExportImportResource.java | 12 ++++++++++++ .../resources/TestingExportImportResource.java | 5 +++++ .../servlet/BrokerLinkAndTokenExchangeTest.java | 7 ++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/rest/resource/TestingExportImportResource.java b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/rest/resource/TestingExportImportResource.java index 56c76efbd5ad..b5d3025665ff 100644 --- a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/rest/resource/TestingExportImportResource.java +++ b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/rest/resource/TestingExportImportResource.java @@ -147,4 +147,16 @@ public String getExportImportTestDirectory() { String absolutePath = new File(System.getProperty("project.build.directory", "target")).getAbsolutePath(); return absolutePath; } + + @GET + @Path("/clear") + @Produces(MediaType.APPLICATION_JSON) + public Response clear() { + System.clearProperty(REALM_NAME); + System.clearProperty(PROVIDER); + System.clearProperty(ACTION); + System.clearProperty(FILE); + + return Response.ok().build(); + } } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/client/resources/TestingExportImportResource.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/client/resources/TestingExportImportResource.java index a66fce5e13cc..4d0e00827118 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/client/resources/TestingExportImportResource.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/client/resources/TestingExportImportResource.java @@ -96,4 +96,9 @@ public interface TestingExportImportResource { @Produces(MediaType.APPLICATION_JSON) public String getExportImportTestDirectory(); + @GET + @Path("/clear") + @Produces(MediaType.APPLICATION_JSON) + public Response clear(); + } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/BrokerLinkAndTokenExchangeTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/BrokerLinkAndTokenExchangeTest.java index 2194d2d0112a..f6ead24b768b 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/BrokerLinkAndTokenExchangeTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/BrokerLinkAndTokenExchangeTest.java @@ -492,7 +492,6 @@ public void testExportImport() throws Exception { testExternalExchange(); testingClient.testing().exportImport().setProvider(SingleFileExportProviderFactory.PROVIDER_ID); String targetFilePath = testingClient.testing().exportImport().getExportImportTestDirectory() + File.separator + "singleFile-full.json"; - //System.out.println("TARGET PATH: " + targetFilePath); testingClient.testing().exportImport().setFile(targetFilePath); testingClient.testing().exportImport().setAction(ExportImportConfig.ACTION_EXPORT); testingClient.testing().exportImport().setRealmName(CHILD_IDP); @@ -502,12 +501,10 @@ public void testExportImport() throws Exception { testingClient.testing().exportImport().setAction(ExportImportConfig.ACTION_IMPORT); testingClient.testing().exportImport().runImport(); - //System.out.println("************* AFTER IMPORT"); - testExternalExchange(); - //Thread.sleep(1000000000l); - + testingClient.testing().exportImport().clear(); + testExternalExchange(); }