This repository has been archived by the owner on Jun 7, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Protocols.KUBE_PING to our clustering for use on OpenShift 3
This just hardcodes OpenShift detection into the clustering Stack for now until we come up with a generic Environment abstraction.
- Loading branch information
Showing
10 changed files
with
230 additions
and
4 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
38 changes: 38 additions & 0 deletions
38
clustering/modules/src/main/resources/modules/org/jgroups/main/module.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,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
~ JBoss, Home of Professional Open Source. | ||
~ Copyright 2010, Red Hat, Inc., and individual contributors | ||
~ as indicated by the @author tags. See the copyright.txt file in the | ||
~ distribution for a full listing of individual contributors. | ||
~ | ||
~ This is free software; you can redistribute it and/or modify it | ||
~ under the terms of the GNU Lesser General Public License as | ||
~ published by the Free Software Foundation; either version 2.1 of | ||
~ the License, or (at your option) any later version. | ||
~ | ||
~ This software is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
~ Lesser General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU Lesser General Public | ||
~ License along with this software; if not, write to the Free | ||
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
--> | ||
|
||
<module xmlns="urn:jboss:module:1.3" name="org.jgroups"> | ||
|
||
<resources> | ||
<artifact name="org.jgroups:jgroups:${version.org.jgroups}"/> | ||
</resources> | ||
|
||
<dependencies> | ||
<module name="javax.api"/> | ||
|
||
<!-- We override the module.xml purely to add this dependency --> | ||
<module name="org.openshift.ping"/> | ||
|
||
</dependencies> | ||
</module> |
10 changes: 10 additions & 0 deletions
10
clustering/modules/src/main/resources/modules/org/openshift/ping/main/module.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,10 @@ | ||
<module xmlns="urn:jboss:module:1.3" name="org.openshift.ping"> | ||
<resources> | ||
<artifact name="org.projectodd.openshift.ping:openshift-ping-common:${version.org.openshift.ping}"/> | ||
<artifact name="org.projectodd.openshift.ping:openshift-ping-kube:${version.org.openshift.ping}"/> | ||
</resources> | ||
|
||
<dependencies> | ||
<module name="org.jgroups"/> | ||
</dependencies> | ||
</module> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 2015 Red Hat, Inc. and/or its affiliates. | ||
~ | ||
~ Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>wildfly-swarm-clustering-parent</artifactId> | ||
<version>1.0.0.Alpha6-SNAPSHOT</version> | ||
<relativePath>../</relativePath> | ||
</parent> | ||
|
||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>wildfly-swarm-clustering-test</artifactId> | ||
|
||
<name>WildFly Swarm: Clustering Test</name> | ||
<description>WildFly Swarm: Clustering Test</description> | ||
|
||
<packaging>jar</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>wildfly-swarm-clustering</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>wildfly-swarm-clustering-modules</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wildfly.swarm</groupId> | ||
<artifactId>wildfly-swarm-arquillian</artifactId> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.arquillian.junit</groupId> | ||
<artifactId>arquillian-junit-container</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
35 changes: 35 additions & 0 deletions
35
clustering/test/src/test/java/org/wildfly/swarm/clustering/ClusteringArquillianTest.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,35 @@ | ||
package org.wildfly.swarm.clustering; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.container.test.api.RunAsClient; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.wildfly.swarm.ContainerFactory; | ||
import org.wildfly.swarm.container.Container; | ||
import org.wildfly.swarm.container.JARArchive; | ||
|
||
@RunWith(Arquillian.class) | ||
public class ClusteringArquillianTest implements ContainerFactory { | ||
|
||
@Deployment(testable = false) | ||
public static Archive createDeployment() { | ||
JARArchive deployment = ShrinkWrap.create(JARArchive.class); | ||
deployment.add(EmptyAsset.INSTANCE, "nothing"); | ||
return deployment; | ||
} | ||
|
||
@Override | ||
public Container newContainer(String... args) throws Exception { | ||
return new Container().fraction( new ClusteringFraction() ); | ||
} | ||
|
||
@Test | ||
@RunAsClient | ||
public void testNothing() { | ||
|
||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
clustering/test/src/test/java/org/wildfly/swarm/clustering/ClusteringInVmTest.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,25 @@ | ||
package org.wildfly.swarm.clustering; | ||
|
||
import org.junit.Test; | ||
import org.wildfly.swarm.container.Container; | ||
|
||
public class ClusteringInVmTest { | ||
|
||
@Test | ||
public void testDefaultFraction() throws Exception { | ||
Container container = new Container(); | ||
// By not specifying a ClusteringFraction we test the default fraction | ||
container.start().stop(); | ||
} | ||
|
||
@Test | ||
public void testCanFindKubePing() throws Exception { | ||
Container container = new Container(); | ||
container.fraction(new ClusteringFraction() | ||
.defaultChannel(new Channel("swarm-clustering")) | ||
.defaultStack(new Stack("udp") | ||
.transport(Transports.UDP("jgroups-udp")) | ||
.protocol(Protocols.KUBE_PING()))); | ||
container.start().stop(); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...ng/test/src/test/java/org/wildfly/swarm/clustering/ClusteringOpenShiftArquillianTest.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 @@ | ||
package org.wildfly.swarm.clustering; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.container.test.api.RunAsClient; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.wildfly.swarm.ContainerFactory; | ||
import org.wildfly.swarm.container.Container; | ||
import org.wildfly.swarm.container.JARArchive; | ||
|
||
@RunWith(Arquillian.class) | ||
public class ClusteringOpenShiftArquillianTest implements ContainerFactory { | ||
|
||
@Deployment(testable = false) | ||
public static Archive createDeployment() { | ||
JARArchive deployment = ShrinkWrap.create(JARArchive.class); | ||
deployment.add(EmptyAsset.INSTANCE, "nothing"); | ||
return deployment; | ||
} | ||
|
||
@Override | ||
public Container newContainer(String... args) throws Exception { | ||
return new Container().fraction(new ClusteringFraction() | ||
.defaultChannel(new Channel("swarm-clustering")) | ||
.defaultStack(new Stack("udp") | ||
.transport(Transports.UDP("jgroups-udp")) | ||
.protocol(Protocols.KUBE_PING()))); | ||
} | ||
|
||
@Test | ||
@RunAsClient | ||
public void testNothing() { | ||
|
||
} | ||
} |
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