[embjopr-commits] EMBJOPR SVN: r567 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5 and 1 other directories.
embjopr-commits at lists.jboss.org
embjopr-commits at lists.jboss.org
Mon Jul 20 13:32:46 EDT 2009
Author: ozizka at redhat.com
Date: 2009-07-20 13:32:46 -0400 (Mon, 20 Jul 2009)
New Revision: 567
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryConfigurationTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryTest.java
Log:
* JAAS security added to ConnFactoryTest - done, all tests pass.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-07-20 15:05:38 UTC (rev 566)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-07-20 17:32:46 UTC (rev 567)
@@ -26,7 +26,6 @@
import com.gargoylesoftware.htmlunit.html.*;
import java.io.IOException;
import java.util.*;
-import java.util.logging.Level;
import org.jboss.logging.*;
import org.apache.cactus.ServletTestCase;
import org.jboss.jsfunit.framework.WebClientSpec;
@@ -947,7 +946,20 @@
protected Map<String, MetaValue> getSpecificComponentProperties(String componentName,
ComponentType type,
String specificProperties[]) throws Exception {
- ManagedComponent component = getManagedComponent(componentName, type);
+ return getSpecificComponentProperties(componentName, type, specificProperties, false);
+ }
+
+ /**
+ * Create a map of property names to property values for a particular
+ * component. The desired property names are given by specificProperties.
+ * (This is useful when we need to check the values of some specific properties
+ * only - eg. the configuration tests)
+ */
+ protected Map<String, MetaValue> getSpecificComponentProperties(String componentName,
+ ComponentType type,
+ String specificProperties[],
+ boolean secured) throws Exception {
+ ManagedComponent component = getManagedComponent(componentName, type, secured);
assertNotNull("The returned component was null", component);
assertEquals(componentName, component.getName());
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java 2009-07-20 15:05:38 UTC (rev 566)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java 2009-07-20 17:32:46 UTC (rev 567)
@@ -24,7 +24,6 @@
import com.gargoylesoftware.htmlunit.html.*;
import java.io.IOException;
-import junit.framework.Test;
import org.jboss.jopr.jsfunit.*;
import java.util.Map;
import org.jboss.metatype.api.values.MetaValue;
@@ -33,12 +32,10 @@
import org.jdom.input.SAXBuilder;
import java.io.File;
import org.jboss.managed.api.ComponentType;
-import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.LinkedHashMap;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit;
import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.NavTreeNode;
import org.jboss.jopr.jsfunit.exceptions.*;
@@ -176,7 +173,8 @@
Map<String, String> formattedPropertiesMap = formatPropertiesMap(propertiesMap);
fillOutForm(formattedPropertiesMap, RESOURCE_CONFIGURATION_FORM);
}
-
+
+
/**
* Configure the properties associated with this resource
* and verify that the properties were updated appropriately.
@@ -217,19 +215,29 @@
// Verify that the properties were set correctly
checkComponentProperties(propertiesMapChanges, resourceName, componentType, secured);
}
-
+
+
/**
* Unset the specified properties for the given resource.
- *
* @param propertiesMap is a map of property names to expected property values
*/
+ protected void unsetResourceProperties(String category, String subCategory, String name, Map<String, MetaValue> propsMap,
+ String[] propsToUnset, ComponentType componentType, String expectedMessage) throws Exception {
+ unsetResourceProperties(subCategory, subCategory, name, propsMap, propsToUnset, componentType, expectedMessage, false);
+ }
+
+ /**
+ * Unset the specified properties for the given resource.
+ * @param propertiesMap is a map of property names to expected property values
+ */
protected void unsetResourceProperties(String resourceCategory,
String resourceSubCategory,
String resourceName,
Map<String, MetaValue> propertiesMap,
String[] propertiesToUnset,
ComponentType componentType,
- String expectedMessage) throws Exception {
+ String expectedMessage,
+ boolean secured) throws Exception {
// Navigate to the configuration page for the resource
navigateToPage(resourceCategory, resourceSubCategory,
@@ -246,9 +254,10 @@
checkClientAndServerMessages(expectedMessage, expectedMessage, false);
// Make sure the rest of the properties remained unchanged
- checkComponentProperties(propertiesMap, resourceName, componentType);
+ checkComponentProperties(propertiesMap, resourceName, componentType, secured);
}
-
+
+
/**
* Delete the given resource.
*
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryConfigurationTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryConfigurationTest.java 2009-07-20 15:05:38 UTC (rev 566)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryConfigurationTest.java 2009-07-20 17:32:46 UTC (rev 567)
@@ -33,15 +33,16 @@
/**
* This class contains tests for configuring Connection Factories with JBoss AS 5.
- *
+ *
+ * Note: Fixed to work with JAAS. Could have been coded more nicely by providing some TestInfo interface,
+ * but I got that idea when it was already done through "boolean secured"...
+ * So now all methods involved in this test working with ProfileService have this param added.
+ *
* @author Farah Juma
*
*/
-
public class ConnFactoryConfigurationTest extends ConnFactoryTest {
- private static final boolean SECURED = true;
- private static final boolean UNSECURED = false;
/*
@@ -113,7 +114,7 @@
*/
public void testConfigureNoTxConnectionFactoryChangePropertiesUsingExistingDSFile() throws Exception {
String jndiName = "ChangePropertiesExistingNoTxCF";
- Map<String, MetaValue> propertiesMap = getComponentProperties(jndiName, NO_TX_COMPONENT_TYPE);
+ Map<String, MetaValue> propertiesMap = getComponentProperties(jndiName, NO_TX_COMPONENT_TYPE, SECURED);
// Change some property values that are already set
Map<String, MetaValue> propertiesMapChanges = new LinkedHashMap<String, MetaValue>();
@@ -229,7 +230,7 @@
unsetResourceProperties(CF_NAV_LABEL, cfType.getLabel(),
jndiName, propertiesMap, propertiesToUnset,
- componentType, expectedMessage);
+ componentType, expectedMessage, SECURED);
assertTrue("The connection factory is not deployed ", isDeployed(jndiName + "-ds.xml", SECURED));
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryTest.java 2009-07-20 15:05:38 UTC (rev 566)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/connfactories/ConnFactoryTest.java 2009-07-20 17:32:46 UTC (rev 567)
@@ -22,12 +22,7 @@
package org.jboss.jopr.jsfunit.as5.connfactories;
-import com.gargoylesoftware.htmlunit.html.*;
-import org.jboss.jopr.jsfunit.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.jboss.jopr.jsfunit.exceptions.*;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit;
import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
import org.jboss.jopr.jsfunit.as5.ResourceTestBase;
import org.jboss.deployers.spi.management.KnownComponentTypes;
@@ -58,8 +53,12 @@
*/
public abstract class ConnFactoryTest extends ResourceTestBase {
- public enum CFType {
+ protected static final boolean SECURED = true;
+ protected static final boolean UNSECURED = false;
+
+ public enum CFType {
+
NO_TX_CF("No Tx ConnectionFactories", NO_TXCF_DEFAULT_TEMPLATE,
"No Tx ConnectionFactory", "no-tx-connection-factory"),
LOCAL_TX_CF("Tx ConnectionFactories", TXCF_LOCAL_TEMPLATE,
@@ -353,6 +352,6 @@
"prefill", "idle-timeout-minutes",
"allocation-retry", "use-java-context",
"no-tx-separate-pools", "blocking-timeout-millis" };
- return super.getSpecificComponentProperties(componentName, type, specificProperties);
+ return super.getSpecificComponentProperties(componentName, type, specificProperties, SECURED);
}
}
More information about the embjopr-commits
mailing list