forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
493 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
testsuite/integration-arquillian/servers/app-server/app-server-spi/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
~ Copyright 2018 Red Hat, Inc. and/or its affiliates | ||
~ and other contributors as indicated by the @author tags. | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<parent> | ||
<groupId>org.keycloak.testsuite</groupId> | ||
<artifactId>integration-arquillian-servers-app-server</artifactId> | ||
<version>4.0.0.Final-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>integration-arquillian-servers-app-server-spi</artifactId> | ||
<packaging>jar</packaging> | ||
<name>App Server - SPI</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.arquillian.protocol</groupId> | ||
<artifactId>arquillian-protocol-servlet</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
39 changes: 39 additions & 0 deletions
39
...-spi/src/main/java/org/keycloak/testsuite/arquillian/container/AppServerContainerSPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2018 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.keycloak.testsuite.arquillian.container; | ||
|
||
import java.util.List; | ||
import org.jboss.shrinkwrap.descriptor.spi.node.Node; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Vlasta Ramik</a> | ||
*/ | ||
public interface AppServerContainerSPI { | ||
|
||
public static final String APP_SERVER = "app-server"; | ||
|
||
/** | ||
* @return string name of container | ||
*/ | ||
public String getName(); | ||
|
||
/** | ||
* @return List of available containers or null if there are none | ||
*/ | ||
public List<Node> getContainers(); | ||
} |
66 changes: 66 additions & 0 deletions
66
.../src/main/java/org/keycloak/testsuite/arquillian/container/AppServerContainerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright 2018 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.keycloak.testsuite.arquillian.container; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.ServiceConfigurationError; | ||
import java.util.ServiceLoader; | ||
import org.jboss.shrinkwrap.descriptor.spi.node.Node; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Vlasta Ramik</a> | ||
*/ | ||
public class AppServerContainerService { | ||
|
||
private static AppServerContainerService service; | ||
private final ServiceLoader<AppServerContainerSPI> loader; | ||
|
||
private AppServerContainerService() { | ||
loader = ServiceLoader.load(AppServerContainerSPI.class); | ||
} | ||
|
||
public static synchronized AppServerContainerService getInstance() { | ||
if (service == null) { | ||
service = new AppServerContainerService(); | ||
} | ||
return service; | ||
} | ||
|
||
public List<Node> getContainers(String appServerName) { | ||
List<Node> containers = null; | ||
try { | ||
Iterator<AppServerContainerSPI> definitions = loader.iterator(); | ||
|
||
List<AppServerContainerSPI> availableDefinitions = new ArrayList<>(); | ||
while (definitions != null && definitions.hasNext()) { | ||
availableDefinitions.add(definitions.next()); | ||
} | ||
for (AppServerContainerSPI def : availableDefinitions) { | ||
if (def.getName().equals(appServerName)) { | ||
containers = def.getContainers(); | ||
} | ||
} | ||
} catch (ServiceConfigurationError serviceError) { | ||
containers = null; | ||
throw serviceError; | ||
} | ||
return containers; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...sts/base/src/main/java/org/keycloak/testsuite/arquillian/AdapterTestExecutionDecider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright 2018 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.keycloak.testsuite.arquillian; | ||
|
||
import java.lang.reflect.Method; | ||
import org.jboss.arquillian.test.spi.execution.ExecutionDecision; | ||
import org.jboss.arquillian.test.spi.execution.TestExecutionDecider; | ||
import org.jboss.arquillian.core.api.Instance; | ||
import org.jboss.arquillian.core.api.annotation.Inject; | ||
import org.jboss.logging.Logger; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Vlastislav Ramik</a> | ||
*/ | ||
public class AdapterTestExecutionDecider implements TestExecutionDecider { | ||
|
||
private final Logger log = Logger.getLogger(AdapterTestExecutionDecider.class); | ||
|
||
@Inject private Instance<TestContext> testContextInstance; | ||
|
||
@Override | ||
public ExecutionDecision decide(Method method) { | ||
TestContext testContext = testContextInstance.get(); | ||
if (!testContext.isAdapterTest()) return ExecutionDecision.execute(); | ||
if (testContext.isAdapterContainerEnabled() || testContext.isAdapterContainerEnabledCluster()) { | ||
return ExecutionDecision.execute(); | ||
} else { | ||
log.debug("Skipping test: Not enabled by @AppServerContainer annotations."); | ||
return ExecutionDecision.dontExecute("Not enabled by @AppServerContainer annotations."); | ||
} | ||
} | ||
|
||
@Override | ||
public int precedence() { | ||
return 1; | ||
} | ||
|
||
} |
Oops, something went wrong.