Commits

Anonymous committed a9584e4

Solved XW-712 - moved classes from src/main/java to src/test/java

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@2031e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 4240f4e

Comments (0)

Files changed (4)

File core/src/main/java/com/opensymphony/xwork2/TestNGXWorkTestCase.java

-/*
- * Copyright (c) 2002-2006 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork2;
-
-import com.opensymphony.xwork2.config.Configuration;
-import com.opensymphony.xwork2.config.ConfigurationManager;
-import com.opensymphony.xwork2.config.ConfigurationProvider;
-import com.opensymphony.xwork2.config.impl.MockConfiguration;
-import com.opensymphony.xwork2.inject.Container;
-import com.opensymphony.xwork2.util.XWorkTestCaseHelper;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-
-/**
- * Base test class for TestNG unit tests.  Provides common XWork variables
- * and performs XWork setup and teardown processes
- */
-public class TestNGXWorkTestCase {
-
-    protected ConfigurationManager configurationManager;
-    protected Configuration configuration;
-    protected Container container;
-    protected ActionProxyFactory actionProxyFactory;
-    
-    @BeforeTest
-    protected void setUp() throws Exception {
-        configurationManager = XWorkTestCaseHelper.setUp();
-        configuration = new MockConfiguration();
-        ((MockConfiguration)configuration).selfRegister();
-        container = configuration.getContainer();
-        actionProxyFactory = container.getInstance(ActionProxyFactory.class);
-    }
-    
-    @AfterTest
-    protected void tearDown() throws Exception {
-        XWorkTestCaseHelper.tearDown(configurationManager);
-        configurationManager = null;
-        configuration = null;
-        container = null;
-        actionProxyFactory = null;
-    }
-    
-    protected void loadConfigurationProviders(ConfigurationProvider... providers) {
-        configurationManager = XWorkTestCaseHelper.loadConfigurationProviders(configurationManager, providers);
-        configuration = configurationManager.getConfiguration();
-        container = configuration.getContainer();
-        actionProxyFactory = container.getInstance(ActionProxyFactory.class);
-    }
-}

File core/src/main/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork2.config.impl;
-
-import com.opensymphony.xwork2.config.*;
-import com.opensymphony.xwork2.config.entities.PackageConfig;
-import com.opensymphony.xwork2.config.entities.UnknownHandlerConfig;
-import com.opensymphony.xwork2.config.providers.XWorkConfigurationProvider;
-import com.opensymphony.xwork2.inject.Container;
-import com.opensymphony.xwork2.inject.ContainerBuilder;
-import com.opensymphony.xwork2.inject.Scope;
-import com.opensymphony.xwork2.util.location.LocatableProperties;
-
-import java.util.*;
-
-
-/**
- * Simple configuration used for unit testing
- */
-public class MockConfiguration implements Configuration {
-
-    private Map<String, PackageConfig> packages = new HashMap<String, PackageConfig>();
-    private Set<String> loadedFiles = new HashSet<String>();
-    private Container container;
-    protected List<UnknownHandlerConfig> unknownHandlerStack;
-    private ContainerBuilder builder;
-
-    public MockConfiguration() {
-        builder = new ContainerBuilder();
-    }
-
-    public void selfRegister() {
-        //this cannot be done in the constructor, as it causes an infinite loop
-        builder.factory(Configuration.class, MockConfiguration.class, Scope.SINGLETON);
-        LocatableProperties props = new LocatableProperties();
-        new XWorkConfigurationProvider().register(builder, props);
-        builder.constant("devMode", "false");
-        container = builder.create(true);
-    }
-
-    public PackageConfig getPackageConfig(String name) {
-        return packages.get(name);
-    }
-
-    public Set<String> getPackageConfigNames() {
-        return packages.keySet();
-    }
-
-    public Map<String, PackageConfig> getPackageConfigs() {
-        return packages;
-    }
-
-    public RuntimeConfiguration getRuntimeConfiguration() {
-        throw new UnsupportedOperationException();
-    }
-
-    public void addPackageConfig(String name, PackageConfig packageContext) {
-        packages.put(name, packageContext);
-    }
-
-    public void buildRuntimeConfiguration() {
-        throw new UnsupportedOperationException();
-    }
-
-    public void destroy() {
-        throw new UnsupportedOperationException();
-    }
-
-    public void rebuildRuntimeConfiguration() {
-        throw new UnsupportedOperationException();
-    }
-
-    public void reload(List<ConfigurationProvider> providers) throws ConfigurationException {
-        throw new UnsupportedOperationException();
-    }
-
-    public PackageConfig removePackageConfig(String name) {
-        return packages.remove(name);
-    }
-
-    public Container getContainer() {
-        return container;
-    }
-
-    public Set<String> getLoadedFileNames() {
-        return loadedFiles;
-    }
-
-    public List<PackageProvider> reloadContainer(
-            List<ContainerProvider> containerProviders)
-            throws ConfigurationException {
-        throw new UnsupportedOperationException();
-    }
-
-    public List<UnknownHandlerConfig> getUnknownHandlerStack() {
-        return unknownHandlerStack;
-    }
-
-    public void setUnknownHandlerStack(List<UnknownHandlerConfig> unknownHandlerStack) {
-        this.unknownHandlerStack = unknownHandlerStack;
-    }
-}

File core/src/test/java/com/opensymphony/xwork2/TestNGXWorkTestCase.java

+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2;
+
+import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.ConfigurationManager;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.impl.MockConfiguration;
+import com.opensymphony.xwork2.inject.Container;
+import com.opensymphony.xwork2.util.XWorkTestCaseHelper;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+
+/**
+ * Base test class for TestNG unit tests.  Provides common XWork variables
+ * and performs XWork setup and teardown processes
+ */
+public class TestNGXWorkTestCase {
+
+    protected ConfigurationManager configurationManager;
+    protected Configuration configuration;
+    protected Container container;
+    protected ActionProxyFactory actionProxyFactory;
+
+    @BeforeTest
+    protected void setUp() throws Exception {
+        configurationManager = XWorkTestCaseHelper.setUp();
+        configuration = new MockConfiguration();
+        ((MockConfiguration) configuration).selfRegister();
+        container = configuration.getContainer();
+        actionProxyFactory = container.getInstance(ActionProxyFactory.class);
+    }
+
+    @AfterTest
+    protected void tearDown() throws Exception {
+        XWorkTestCaseHelper.tearDown(configurationManager);
+        configurationManager = null;
+        configuration = null;
+        container = null;
+        actionProxyFactory = null;
+    }
+
+    protected void loadConfigurationProviders(ConfigurationProvider... providers) {
+        configurationManager = XWorkTestCaseHelper.loadConfigurationProviders(configurationManager, providers);
+        configuration = configurationManager.getConfiguration();
+        container = configuration.getContainer();
+        actionProxyFactory = container.getInstance(ActionProxyFactory.class);
+    }
+}

File core/src/test/java/com/opensymphony/xwork2/config/impl/MockConfiguration.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.config.impl;
+
+import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.ContainerProvider;
+import com.opensymphony.xwork2.config.PackageProvider;
+import com.opensymphony.xwork2.config.RuntimeConfiguration;
+import com.opensymphony.xwork2.config.entities.PackageConfig;
+import com.opensymphony.xwork2.config.entities.UnknownHandlerConfig;
+import com.opensymphony.xwork2.config.providers.XWorkConfigurationProvider;
+import com.opensymphony.xwork2.inject.Container;
+import com.opensymphony.xwork2.inject.ContainerBuilder;
+import com.opensymphony.xwork2.inject.Scope;
+import com.opensymphony.xwork2.util.location.LocatableProperties;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * Simple configuration used for unit testing
+ */
+public class MockConfiguration implements Configuration {
+
+    private Map<String, PackageConfig> packages = new HashMap<String, PackageConfig>();
+    private Set<String> loadedFiles = new HashSet<String>();
+    private Container container;
+    protected List<UnknownHandlerConfig> unknownHandlerStack;
+    private ContainerBuilder builder;
+
+    public MockConfiguration() {
+        builder = new ContainerBuilder();
+    }
+
+    public void selfRegister() {
+        //this cannot be done in the constructor, as it causes an infinite loop
+        builder.factory(Configuration.class, MockConfiguration.class, Scope.SINGLETON);
+        LocatableProperties props = new LocatableProperties();
+        new XWorkConfigurationProvider().register(builder, props);
+        builder.constant("devMode", "false");
+        container = builder.create(true);
+    }
+
+    public PackageConfig getPackageConfig(String name) {
+        return packages.get(name);
+    }
+
+    public Set<String> getPackageConfigNames() {
+        return packages.keySet();
+    }
+
+    public Map<String, PackageConfig> getPackageConfigs() {
+        return packages;
+    }
+
+    public RuntimeConfiguration getRuntimeConfiguration() {
+        throw new UnsupportedOperationException();
+    }
+
+    public void addPackageConfig(String name, PackageConfig packageContext) {
+        packages.put(name, packageContext);
+    }
+
+    public void buildRuntimeConfiguration() {
+        throw new UnsupportedOperationException();
+    }
+
+    public void destroy() {
+        throw new UnsupportedOperationException();
+    }
+
+    public void rebuildRuntimeConfiguration() {
+        throw new UnsupportedOperationException();
+    }
+
+    public void reload(List<ConfigurationProvider> providers) throws ConfigurationException {
+        throw new UnsupportedOperationException();
+    }
+
+    public PackageConfig removePackageConfig(String name) {
+        return packages.remove(name);
+    }
+
+    public Container getContainer() {
+        return container;
+    }
+
+    public Set<String> getLoadedFileNames() {
+        return loadedFiles;
+    }
+
+    public List<PackageProvider> reloadContainer(
+            List<ContainerProvider> containerProviders)
+            throws ConfigurationException {
+        throw new UnsupportedOperationException();
+    }
+
+    public List<UnknownHandlerConfig> getUnknownHandlerStack() {
+        return unknownHandlerStack;
+    }
+
+    public void setUnknownHandlerStack(List<UnknownHandlerConfig> unknownHandlerStack) {
+        this.unknownHandlerStack = unknownHandlerStack;
+    }
+
+}