Skip to content

Commit

Permalink
concurrent cache is no longer included in default configuration, so u…
Browse files Browse the repository at this point in the history
…se install cache configuration via @serversetup.
  • Loading branch information
pferraro committed Jul 19, 2017
1 parent 88eb1bc commit 469ed0b
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
import org.infinispan.transaction.TransactionMode;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.TargetsContainer;
import org.jboss.as.arquillian.api.ServerSetup;
import org.jboss.as.test.clustering.ClusterTestUtil;
import org.jboss.as.test.clustering.single.web.Mutable;
import org.jboss.as.test.clustering.single.web.SimpleServlet;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;

@ServerSetup(ConcurrentWebFailoverServerSetup.class)
public class ConcurrentCoarseWebFailoverTestCase extends AbstractWebFailoverTestCase {
private static final String DEPLOYMENT_NAME = "coarse-concurrent-distributable.war";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.infinispan.transaction.TransactionMode;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.TargetsContainer;
import org.jboss.as.arquillian.api.ServerSetup;
import org.jboss.as.test.clustering.ClusterTestUtil;
import org.jboss.as.test.clustering.single.web.Mutable;
import org.jboss.as.test.clustering.single.web.SimpleServlet;
Expand All @@ -35,6 +36,7 @@
* @author Radoslav Husar
* @version April 2012
*/
@ServerSetup(ConcurrentWebFailoverServerSetup.class)
public class ConcurrentFineWebFailoverTestCase extends AbstractWebFailoverTestCase {
private static final String DEPLOYMENT_NAME = "fine-concurrent-distributable.war";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.test.clustering.cluster.web;

import org.jboss.as.arquillian.api.ServerSetupTask;
import org.jboss.as.arquillian.container.ManagementClient;
import org.jboss.as.clustering.controller.Operations;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
import org.jboss.as.controller.operations.common.Util;
import org.jboss.as.test.integration.management.ManagementOperations;
import org.jboss.dmr.ModelNode;

/**
* @author Paul Ferraro
*/
public class ConcurrentWebFailoverServerSetup implements ServerSetupTask {
private static final String CONTAINER_NAME = "web";
private static final String CACHE_NAME = "concurrent";

@Override
public void setup(ManagementClient client, String containerId) throws Exception {
if (!client.isClosed()) {
PathAddress cacheAddress = getCacheAddress();
ModelNode addCacheOperation = Util.createAddOperation(cacheAddress);
ModelNode addCacheStoreOperation = Util.createAddOperation(getCacheStoreAddress(cacheAddress));

ManagementOperations.executeOperationRaw(client.getControllerClient(), Operations.createCompositeOperation(addCacheOperation, addCacheStoreOperation));
}
}

@Override
public void tearDown(ManagementClient client, String containerId) throws Exception {
if (!client.isClosed()) {
PathAddress cacheAddress = getCacheAddress();
ModelNode removeCacheOperation = Util.createRemoveOperation(cacheAddress);
ModelNode removeCacheStoreOperation = Util.createRemoveOperation(getCacheStoreAddress(cacheAddress));

ManagementOperations.executeOperationRaw(client.getControllerClient(), Operations.createCompositeOperation(removeCacheOperation, removeCacheStoreOperation));
}
}

private static PathAddress getCacheAddress() {
return PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "infinispan"), PathElement.pathElement("cache-container", CONTAINER_NAME), PathElement.pathElement("distributed-cache", CACHE_NAME));
}

private static PathAddress getCacheStoreAddress(PathAddress cacheAddress) {
return cacheAddress.append("store", "file");
}
}

0 comments on commit 469ed0b

Please sign in to comment.