Skip to content

Commit

Permalink
WFLY-5606 ManagementOnlyModeTestCase uses non-standard reload idioms
Browse files Browse the repository at this point in the history
  • Loading branch information
ctomc committed Aug 18, 2016
1 parent 06ccfa7 commit cdb5a2e
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 368 deletions.

This file was deleted.

Expand Up @@ -22,38 +22,34 @@

package org.jboss.as.test.integration.management.api.expression;

import javax.ejb.EJB;
import static org.jboss.as.test.shared.integration.ejb.security.PermissionUtils.createPermissionsXmlAsset;

import org.junit.Assert;
import java.util.PropertyPermission;
import javax.ejb.EJB;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.as.arquillian.container.ManagementClient;
import org.jboss.as.test.integration.management.util.ModelUtil;
import org.jboss.as.test.shared.TestSuiteEnvironment;
import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Ignore;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.PropertyPermission;

import static org.jboss.as.test.shared.integration.ejb.security.PermissionUtils.createPermissionsXmlAsset;
import org.wildfly.test.api.Authentication;

/**
* Validation of the system property substitution for expressions handling. Test for AS7-6120.
* Global parameters testing could be found in domain module: ExpressionSupportSmokeTestCase
* <p>
* The expression substitution test runs the evaluation of expressions in bean deployed in container.
* The managementClient injected by arquillian is taken via remote interface.
* We need to operate directly with management client controller residing in container.
* It's provided by management service hack - {@link ExpressionTestManagementService}
* Maybe there will be an api for this in future: AS7-4657
*
* @author <a href="ochaloup@jboss.com">Ondrej Chaloupka</a>
*/
Expand All @@ -70,24 +66,22 @@ public class ExpressionSubstitutionInContainerTestCase {
private static final String INNER_PROP_NAME = "qa.test.inner.property";
private static final String INNER_PROP_DEFAULT_VALUE = "inner.value";

@EJB(mappedName = "java:global/expression-substitution-test/StatelessBean")
private IStatelessBean bean;
@EJB
private StatelessBean bean;

@ArquillianResource
private ManagementClient managementClient;

@Deployment
public static Archive<?> deploy() {
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, ARCHIVE_NAME + ".jar");
jar.addClasses(ExpressionTestManagementService.class, Utils.class, ModelUtil.class,
IStatelessBean.class, StatelessBean.class);
jar.addPackage(ExpressionSubstitutionInContainerTestCase.class.getPackage());
jar.addClasses(ModelUtil.class, TestSuiteEnvironment.class, Authentication.class);

jar.addAsManifestResource(new StringAsset(ExpressionTestManagementService.class.getName()),
"services/org.jboss.msc.service.ServiceActivator");
jar.addAsManifestResource(new StringAsset(
"Manifest-Version: 1.0\n" +
"Class-Path: \n" + // there has to be a spacer - otherwise you meet "java.io.IOException: invalid header field"
"Dependencies: org.jboss.msc,org.jboss.as.controller-client,org.jboss.as.controller,org.jboss.as.server, org.jboss.dmr\n"),
"Dependencies: org.jboss.as.controller-client,org.jboss.as.controller,org.jboss.dmr\n"),
"MANIFEST.MF");
jar.addAsManifestResource(createPermissionsXmlAsset(
// Needed by the StatelessBean#addSystemProperty()
Expand Down Expand Up @@ -117,13 +111,13 @@ public void testPropertyDefinedFirst() {
}
}

/**
* <system-properties>
* <property name="qa.test.property" value="${qa.test.exp:defaultValue}"/>
* <property name="qa.test.exp" value="expression.value"/>
* </system-properties>
/*
* <system-properties>
* <property name="qa.test.property" value="${qa.test.exp:defaultValue}"/>
* <property name="qa.test.exp" value="expression.value"/>
* </system-properties>
*/
@Ignore("AS7-6431")
/*@Ignore("AS7-6431")
@Test
@InSequence(2)
public void testExpressionDefinedFirst() {
Expand All @@ -136,7 +130,7 @@ public void testExpressionDefinedFirst() {
Utils.removeProperty(EXPRESSION_PROP_NAME, managementClient.getControllerClient());
Utils.removeProperty(PROP_NAME, managementClient.getControllerClient());
}
}
}*/

/**
* <system-properties>
Expand Down Expand Up @@ -237,7 +231,7 @@ public void testMultipleLevelExpression() {
* <p>
* Write attribute set:
* <property name="qa.test.exp" value="expression.value"/>
*/
*//*
@Ignore("AS7-6431") // for this test works there will be :reload after redefinition
@Test
@InSequence(6)
Expand All @@ -253,8 +247,7 @@ public void testRedefinitionExpressionValue() {
Utils.removeProperty(EXPRESSION_PROP_NAME, managementClient.getControllerClient());
Utils.removeProperty(PROP_NAME, managementClient.getControllerClient());
}
}

}*/
private void expresionEvaluation() {
String result = bean.getJBossProperty(EXPRESSION_PROP_NAME);
log.infof("expressionEvaluation: JBoss property %s was resolved to %s", EXPRESSION_PROP_NAME, result);
Expand All @@ -274,4 +267,4 @@ private void expresionEvaluation() {
log.infof("expressionEvaluation: System property %s has value %s", PROP_NAME, result);
Assert.assertEquals("system property " + PROP_NAME + " from evaluated jboss property", EXPRESSION_PROP_VALUE, result);
}
}
}

This file was deleted.

0 comments on commit cdb5a2e

Please sign in to comment.