Skip to content

Commit

Permalink
WFLY-7617 Remove workaround for WFCORE-1941 in infinispan subsystem t…
Browse files Browse the repository at this point in the history
…ransform/reject tests
  • Loading branch information
rhusar committed Nov 30, 2016
1 parent ea93d82 commit 5c65b3c
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 122 deletions.
@@ -0,0 +1,63 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2016, 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.
*/

package org.jboss.as.clustering.infinispan.subsystem;

import java.io.Serializable;

import org.jboss.as.clustering.jgroups.subsystem.JGroupsSubsystemInitialization;
import org.jboss.as.connector.subsystems.datasources.DataSourcesExtension;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.capability.registry.RuntimeCapabilityRegistry;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
import org.jboss.as.controller.extension.ExtensionRegistry;
import org.jboss.as.controller.extension.ExtensionRegistryType;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.registry.Resource;

/**
* @author Radoslav Husar
*/
public class InfinispanAdditionalInitialization extends JGroupsSubsystemInitialization implements Serializable {

private static final long serialVersionUID = 6976221515049410278L;

@Override
protected void initializeExtraSubystemsAndModel(ExtensionRegistry registry, Resource root, ManagementResourceRegistration registration, RuntimeCapabilityRegistry capabilityRegistry) {
super.initializeExtraSubystemsAndModel(registry, root, registration, capabilityRegistry);

initializeDatasources(registry, root, registration, capabilityRegistry);
}

private void initializeDatasources(ExtensionRegistry registry, Resource root, ManagementResourceRegistration registration, RuntimeCapabilityRegistry capabilityRegistry) {
// Needed to test org.jboss.as.clustering.infinispan.subsystem.JDBCStoreResourceDefinition.DeprecatedAttribute.DATASOURCE conversion
new DataSourcesExtension().initialize(registry.getExtensionContext("datasources", registration, ExtensionRegistryType.MASTER));

Resource subsystem = Resource.Factory.create();
PathElement path = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, DataSourcesExtension.SUBSYSTEM_NAME);
root.registerChild(path, subsystem);

Resource dataSource = Resource.Factory.create();
dataSource.getModel().get("jndi-name").set("java:jboss/jdbc/store");
subsystem.registerChild(PathElement.pathElement("data-source", "ExampleDS"), dataSource);
}
}
Expand Up @@ -39,14 +39,15 @@


import org.jboss.as.clustering.controller.CommonUnaryRequirement; import org.jboss.as.clustering.controller.CommonUnaryRequirement;
import org.jboss.as.clustering.controller.Operations; import org.jboss.as.clustering.controller.Operations;
import org.jboss.as.clustering.jgroups.subsystem.JGroupsSubsystemInitialization;
import org.jboss.as.clustering.subsystem.AdditionalInitialization;
import org.jboss.as.controller.ModelVersion; import org.jboss.as.controller.ModelVersion;
import org.jboss.as.controller.PathAddress; import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.PathElement; import org.jboss.as.controller.PathElement;
import org.jboss.as.model.test.FailedOperationTransformationConfig; import org.jboss.as.model.test.FailedOperationTransformationConfig;
import org.jboss.as.model.test.ModelFixer; import org.jboss.as.model.test.ModelFixer;
import org.jboss.as.model.test.ModelTestControllerVersion; import org.jboss.as.model.test.ModelTestControllerVersion;
import org.jboss.as.model.test.ModelTestUtils; import org.jboss.as.model.test.ModelTestUtils;
import org.jboss.as.subsystem.test.AdditionalInitialization;
import org.jboss.as.subsystem.test.KernelServices; import org.jboss.as.subsystem.test.KernelServices;
import org.jboss.as.subsystem.test.KernelServicesBuilder; import org.jboss.as.subsystem.test.KernelServicesBuilder;
import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelNode;
Expand Down Expand Up @@ -133,7 +134,7 @@ private static String[] getDependencies(ModelTestControllerVersion version) {
formatArtifact("org.jboss.eap:wildfly-clustering-common:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-common:%s", version),
formatArtifact("org.jboss.eap:wildfly-clustering-service:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-service:%s", version),
formatArtifact("org.jboss.eap:wildfly-clustering-jgroups-spi:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-jgroups-spi:%s", version),
// Following are needed for LegacyControllerAdditionalInitialization // Following are needed for InfinispanAdditionalInitialization
formatArtifact("org.jboss.eap:wildfly-clustering-jgroups-extension:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-jgroups-extension:%s", version),
formatArtifact("org.jboss.eap:wildfly-connector:%s", version), formatArtifact("org.jboss.eap:wildfly-connector:%s", version),
formatArtifact("org.jboss.eap:wildfly-clustering-infinispan-spi:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-infinispan-spi:%s", version),
Expand All @@ -145,8 +146,8 @@ private static String[] getDependencies(ModelTestControllerVersion version) {
} }


@Override @Override
AdditionalInitialization createAdditionalInitialization() { org.jboss.as.subsystem.test.AdditionalInitialization createAdditionalInitialization() {
return new LegacyControllerAdditionalInitialization() return new InfinispanAdditionalInitialization()
.require(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING, "hotrod-server-1", "hotrod-server-2") .require(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING, "hotrod-server-1", "hotrod-server-2")
.require(CommonUnaryRequirement.DATA_SOURCE, "ExampleDS") .require(CommonUnaryRequirement.DATA_SOURCE, "ExampleDS")
.require(JGroupsRequirement.CHANNEL_FACTORY, "maximal-channel") .require(JGroupsRequirement.CHANNEL_FACTORY, "maximal-channel")
Expand Down Expand Up @@ -390,7 +391,9 @@ private void testRejections(final ModelTestControllerVersion controller) throws


// initialize the legacy services // initialize the legacy services
builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controller, version) builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controller, version)
.addSingleChildFirstClass(LegacyControllerAdditionalInitialization.class) .addSingleChildFirstClass(InfinispanAdditionalInitialization.class)
.addSingleChildFirstClass(JGroupsSubsystemInitialization.class)
.addSingleChildFirstClass(AdditionalInitialization.class)
.addMavenResourceURL(dependencies) .addMavenResourceURL(dependencies)
//TODO storing the model triggers the weirdness mentioned in SubsystemTestDelegate.LegacyKernelServiceInitializerImpl.install() //TODO storing the model triggers the weirdness mentioned in SubsystemTestDelegate.LegacyKernelServiceInitializerImpl.install()
//which is strange since it should be loading it all from the current jboss modules //which is strange since it should be loading it all from the current jboss modules
Expand Down

This file was deleted.

Expand Up @@ -49,8 +49,9 @@ protected void initializeExtraSubystemsAndModel(ExtensionRegistry registry, Reso
new JGroupsExtension().initialize(registry.getExtensionContext("jgroups", registration, ExtensionRegistryType.MASTER)); new JGroupsExtension().initialize(registry.getExtensionContext("jgroups", registration, ExtensionRegistryType.MASTER));


Resource subsystem = Resource.Factory.create(); Resource subsystem = Resource.Factory.create();
subsystem.getModel().get(JGroupsSubsystemResourceDefinition.Attribute.DEFAULT_STACK.getName()).set("tcp"); // Need to use explicit names here due to signature change ("NoSuchMethodError: org.jboss.as.clustering.jgroups.subsystem.JGroupsSubsystemResourceDefinition$Attribute.getName()Ljava/lang/String;")
subsystem.getModel().get(JGroupsSubsystemResourceDefinition.Attribute.DEFAULT_CHANNEL.getName()).set("maximal-channel"); subsystem.getModel().get("default-stack").set("tcp");
subsystem.getModel().get("default-channel").set("maximal-channel");
root.registerChild(JGroupsSubsystemResourceDefinition.PATH, subsystem); root.registerChild(JGroupsSubsystemResourceDefinition.PATH, subsystem);


Resource channel = Resource.Factory.create(); Resource channel = Resource.Factory.create();
Expand Down

0 comments on commit 5c65b3c

Please sign in to comment.