Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WFLY-19412 Add EAP 8.0.0 transform/reject tests for jgroups subsystem #17957

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
*/
public class JGroupsSubsystemResourceTransformer implements Function<ModelVersion, TransformationDescription> {

private final ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createSubsystemInstance();

@Override
public TransformationDescription apply(ModelVersion version) {
ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createSubsystemInstance();

new ChannelResourceTransformer(this.builder).accept(version);
new ChannelResourceTransformer(builder).accept(version);
new StackResourceTransformer(builder).accept(version);

return builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package org.jboss.as.clustering.jgroups.subsystem;

import java.util.EnumSet;
import java.util.List;

import org.jboss.as.clustering.controller.CommonUnaryRequirement;
Expand All @@ -19,6 +20,9 @@
import org.jgroups.conf.ClassConfigurator;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

/**
* Test cases for transformers used in the JGroups subsystem.
Expand All @@ -27,8 +31,21 @@
* @author Richard Achmatowicz (c) 2011 Red Hat Inc.
* @author Radoslav Husar
*/
@RunWith(Parameterized.class)
public class JGroupsTransformersTestCase extends OperationTestCaseBase {

@Parameters
public static Iterable<ModelTestControllerVersion> parameters() {
return EnumSet.of(ModelTestControllerVersion.EAP_7_4_0, ModelTestControllerVersion.EAP_8_0_0);
}

public JGroupsTransformersTestCase(ModelTestControllerVersion version) {
super();
this.version = version;
}

ModelTestControllerVersion version;

private static String formatArtifact(String pattern, ModelTestControllerVersion version) {
return String.format(pattern, version.getMavenGavVersion());
}
Expand All @@ -37,6 +54,8 @@ private static JGroupsSubsystemModel getModelVersion(ModelTestControllerVersion
switch (controllerVersion) {
case EAP_7_4_0:
return JGroupsSubsystemModel.VERSION_8_0_0;
case EAP_8_0_0:
return JGroupsSubsystemModel.VERSION_10_0_0;
default:
throw new IllegalArgumentException();
}
Expand All @@ -54,6 +73,15 @@ private static String[] getDependencies(ModelTestControllerVersion version) {
formatArtifact("org.jboss.eap:wildfly-clustering-service:%s", version),
formatArtifact("org.jboss.eap:wildfly-clustering-spi:%s", version),
};
case EAP_8_0_0:
return new String[] {
formatArtifact("org.jboss.eap:wildfly-clustering-jgroups-extension:%s", version),
formatArtifact("org.jboss.eap:wildfly-clustering-common:%s", version),
formatArtifact("org.jboss.eap:wildfly-clustering-jgroups-spi:%s", version),
formatArtifact("org.jboss.eap:wildfly-clustering-server-service:%s", version),
formatArtifact("org.jboss.eap:wildfly-clustering-server-spi:%s", version),
formatArtifact("org.jboss.eap:wildfly-clustering-service:%s", version),
};
default:
throw new IllegalArgumentException();
}
Expand All @@ -68,17 +96,17 @@ private static org.jboss.as.subsystem.test.AdditionalInitialization createAdditi
}

@Test
public void testTransformerEAP740() throws Exception {
testTransformation(ModelTestControllerVersion.EAP_7_4_0);
public void testTransformations() throws Exception {
this.testTransformations(version);
}

/**
* Tests transformation of model from current version into specified version.
*/
private void testTransformation(final ModelTestControllerVersion controller) throws Exception {
private void testTransformations(final ModelTestControllerVersion controller) throws Exception {
final ModelVersion version = getModelVersion(controller).getVersion();
final String[] dependencies = getDependencies(controller);
final String subsystemXmlResource = String.format("subsystem-jgroups-transform-%d_%d_%d.xml", version.getMajor(), version.getMinor(), version.getMicro());
final String subsystemXmlResource = String.format("jgroups-transform-%d_%d_%d.xml", version.getMajor(), version.getMinor(), version.getMicro());

// create builder for current subsystem version
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
Expand All @@ -103,8 +131,8 @@ private void testTransformation(final ModelTestControllerVersion controller) thr
}

@Test
public void testRejectionsEAP740() throws Exception {
testRejections(ModelTestControllerVersion.EAP_7_4_0);
public void testRejections() throws Exception {
this.testRejections(version);
}

private void testRejections(final ModelTestControllerVersion controller) throws Exception {
Expand All @@ -128,7 +156,7 @@ private void testRejections(final ModelTestControllerVersion controller) throws
Assert.assertNotNull(legacyServices);
Assert.assertTrue(legacyServices.isSuccessfulBoot());

List<ModelNode> operations = builder.parseXmlResource("subsystem-jgroups-transform-reject.xml");
List<ModelNode> operations = builder.parseXmlResource("jgroups-reject.xml");
ModelTestUtils.checkFailedTransformedBootOperations(services, version, operations, createFailedOperationTransformationConfig(version));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!--
~ Copyright The WildFly Authors
~ SPDX-License-Identifier: Apache-2.0
-->

<subsystem xmlns="urn:jboss:domain:jgroups:9.0">
<channels default="ee">
<channel name="ee" stack="maximal" cluster="${jgroups.ee.cluster:mycluster}" module="${jgroups.ee.module:org.wildfly.clustering.server}" statistics-enabled="${jgroups.ee.statistics-enabled:true}">
<fork name="web">
<protocol type="CENTRAL_LOCK" statistics-enabled="${jgroups.ee.statistics-enabled:true}">
<property name="num_backups">${jgroups.ee.central-lock.num-backups:1}</property>
</protocol>
</fork>
</channel>
<channel name="bridge" stack="minimal"/>
</channels>
<stacks>
<stack name="minimal" statistics-enabled="true">
<transport type="UDP" socket-binding="some-binding" statistics-enabled="false"/>
</stack>
<stack name="maximal" statistics-enabled="${jgroups.maximal.statistics-enabled:true}">
<transport type="TCP"
module="${jgroups.maximal.module:org.jgroups}"
socket-binding="some-binding"
client-socket-binding="some-other-binding"
diagnostics-socket-binding="jgroups-diagnostics"
machine="${jgroups.maximal.machine:machine1}"
rack="${jgroups.maximal.rack:rack1}"
site="${jgroups.maximal.site:site1}">
<property name="enable_bundling">${jgroups.maximal.bundling:true}</property>
<default-thread-pool min-threads="${jgroups.maximal.min-threads:11}"
max-threads="${jgroups.maximal.max-threads:12}"
keepalive-time="${jgroups.maximal.keepalive-time:13}"/>
</transport>
<socket-protocol type="MPING" module="${jgroups.maximal.mping.module:org.jgroups}" socket-binding="jgroups-mping">
<property name="name">${jgroups.maximal.property:value}</property>
</socket-protocol>
<jdbc-protocol type="JDBC_PING" data-source="ExampleDS"/>
<socket-discovery-protocol type="TCPPING" socket-bindings="node1 node2"/>
<protocol type="MERGE3"/>
<socket-protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd" client-socket-binding="jgroups-client-fd"/>
<protocol type="FD"/>
<protocol type="VERIFY_SUSPECT"/>
<encrypt-protocol type="SYM_ENCRYPT" key-store="my-key-store" key-alias="${jgroups.maximal.key-alias:alias}">
<key-credential-reference store="my-credential-store" alias="credential-alias" type="PASSWORD"/>
</encrypt-protocol>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<auth-protocol type="AUTH">
<cipher-token algorithm="${jgroups.maximal.auth.algorithm:RSA}" key-store="my-key-store" key-alias="${jgroups.maximal.auth.alias:alias}">
<shared-secret-reference clear-text="changeme"/>
<key-credential-reference store="my-credential-store" alias="credential-alias" type="PASSWORD"/>
</cipher-token>
</auth-protocol>
<protocol type="UFC"/>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
<protocol type="RSVP"/>
<relay site="${jgroups.maximal.relay.site:LON}">
<remote-site name="SFO" channel="bridge"/>
<remote-site name="NYC" channel="bridge"/>
</relay>
</stack>
</stacks>
</subsystem>