archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r575133 - in /maven/archiva/trunk/archiva-web/archiva-webapp/src: main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ test/java/org/apache/maven/archiva/web/action/admin/connectors/ test/java/org/apache/maven/archiva/web/a...
Date Thu, 13 Sep 2007 00:10:21 GMT
Author: brett
Date: Wed Sep 12 17:10:20 2007
New Revision: 575133

URL: http://svn.apache.org/viewvc?rev=575133&view=rev
Log:
[MRM-496] start a test case

Added:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.java
  (with props)
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.xml
  (with props)
Modified:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java?rev=575133&r1=575132&r2=575133&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java
(original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorAction.java
Wed Sep 12 17:10:20 2007
@@ -445,11 +445,6 @@
         this.connector = connector;
     }
 
-    public void setManagedRepoIdList( List managedRepoIdList )
-    {
-        this.managedRepoIdList = managedRepoIdList;
-    }
-
     public void setMode( String mode )
     {
         this.mode = mode;
@@ -465,11 +460,6 @@
         this.propertyValue = propertyValue;
     }
 
-    public void setRemoteRepoIdList( List remoteRepoIdList )
-    {
-        this.remoteRepoIdList = remoteRepoIdList;
-    }
-
     public void setSource( String source )
     {
         this.source = source;
@@ -577,5 +567,10 @@
     public void setPattern( String pattern )
     {
         this.pattern = pattern;
+    }
+
+    public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
+    {
+        this.archivaConfiguration = archivaConfiguration;
     }
 }

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.java?rev=575133&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.java
(added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.java
Wed Sep 12 17:10:20 2007
@@ -0,0 +1,95 @@
+package org.apache.maven.archiva.web.action.admin.connectors.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.opensymphony.xwork.Action;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;
+import org.easymock.MockControl;
+
+/**
+ * Test the proxy connector configuration action returns the correct data.
+ */
+public class ConfigureProxyConnectorActionTest
+    extends PlexusTestCase
+{
+    private ConfigureProxyConnectorAction action;
+
+    private MockControl archivaConfigurationControl;
+
+    private ArchivaConfiguration archivaConfiguration;
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        // TODO: purely to quiet logging - shouldn't be needed
+        String appserverBase = getTestFile( "target/appserver-base" ).getAbsolutePath();
+        System.setProperty( "appserver.base", appserverBase );
+        action = (ConfigureProxyConnectorAction) lookup( Action.class.getName(), "configureProxyConnectorAction"
);
+
+        archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class
);
+        archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
+        action.setArchivaConfiguration( archivaConfiguration );
+    }
+
+    public void testSecureActionBundle()
+        throws Exception
+    {
+        archivaConfiguration.getConfiguration();
+        archivaConfigurationControl.setReturnValue( new Configuration() );
+        archivaConfigurationControl.replay();
+
+        action.prepare();
+        SecureActionBundle bundle = action.getSecureActionBundle();
+        assertTrue( bundle.requiresAuthentication() );
+        assertEquals( 1, bundle.getAuthorizationTuples().size() );
+    }
+
+    public void testAddProxyConnectorInitialPage()
+        throws Exception
+    {
+        archivaConfiguration.getConfiguration();
+        archivaConfigurationControl.setReturnValue( new Configuration() );
+        archivaConfigurationControl.replay();
+
+        action.prepare();
+        assertNull( action.getMode() );
+        ProxyConnectorConfiguration configuration = action.getConnector();
+        assertNotNull( configuration );
+        assertNull( configuration.getProxyId() );
+        assertNull( configuration.getSourceRepoId() );
+        assertNull( configuration.getTargetRepoId() );
+        assertTrue( configuration.getPolicies().isEmpty() );
+        assertTrue( configuration.getProperties().isEmpty() );
+        assertTrue( configuration.getBlackListPatterns().isEmpty() );
+        assertTrue( configuration.getWhiteListPatterns().isEmpty() );
+
+        String status = action.add();
+        assertEquals( Action.INPUT, status );
+    }
+
+    // TODO: test the population of proxyIdOptions, *RepoIdList (from prepare) and policyMap
(from initialize)
+    // TODO: test the other methods. Should review the structure of the action in the process
as there is a lot of different combinations of parameters
+}

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.xml?rev=575133&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.xml
(added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.xml
Wed Sep 12 17:10:20 2007
@@ -0,0 +1,45 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~  http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<plexus>
+  <components>
+    <component>
+      <role>org.codehaus.plexus.logging.LoggerManager</role>
+      <implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>
+      <lifecycle-handler>basic</lifecycle-handler>
+    </component>
+    <component>
+      <role>com.opensymphony.xwork.Action</role>
+      <role-hint>configureProxyConnectorAction</role-hint>
+      <implementation>org.apache.maven.archiva.web.action.admin.connectors.proxy.ConfigureProxyConnectorAction
+      </implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role>
+          <field-name>preDownloadPolicyMap</field-name>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role>
+          <field-name>postDownloadPolicyMap</field-name>
+        </requirement>
+      </requirements>
+    </component>
+  </components>
+</plexus>

Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/action/admin/connectors/proxy/ConfigureProxyConnectorActionTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message