]> source.dussan.org Git - archiva.git/commitdiff
rename rule class
authorOlivier Lamy <olamy@apache.org>
Fri, 2 Mar 2012 18:39:07 +0000 (18:39 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 2 Mar 2012 18:39:07 +0000 (18:39 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1296374 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ScreenshotCaptureRule.java [deleted file]

index b06bcb25649126e8b7fa93fdf192e0361f079bc5..42d9895b476ccd5d5e5e4fdf36ee203c69d208fa 100644 (file)
@@ -1,7 +1,5 @@
 package org.apache.archiva.web.test.parent;
 
-import org.apache.archiva.web.test.tools.ScreenshotCaptureRule;
-import org.junit.Rule;
 import org.junit.runner.RunWith;
 import org.junit.runners.BlockJUnit4ClassRunner;
 
index 786be69e0d0b95eafd548e6a1412a54a554a891a..25325b7d55606f5f27de4b185ec9042b42924a57 100644 (file)
@@ -21,7 +21,7 @@ package org.apache.archiva.web.test.parent;
 
 import com.thoughtworks.selenium.DefaultSelenium;
 import com.thoughtworks.selenium.Selenium;
-import org.apache.archiva.web.test.tools.ScreenshotCaptureRule;
+import org.apache.archiva.web.test.tools.ArchivaSeleniumExecutionRule;
 import org.junit.Assert;
 import org.junit.Rule;
 
@@ -44,7 +44,7 @@ public abstract class AbstractSeleniumTest
 {
 
     @Rule
-    public ScreenshotCaptureRule screenshotCaptureRule = new ScreenshotCaptureRule();
+    public ArchivaSeleniumExecutionRule archivaSeleniumExecutionRule = new ArchivaSeleniumExecutionRule();
 
     public String browser = System.getProperty( "browser" );
 
@@ -70,7 +70,7 @@ public abstract class AbstractSeleniumTest
         p = new Properties();
         p.load( this.getClass().getClassLoader().getResourceAsStream( "test.properties" ) );
         open( baseUrl, browser, seleniumHost, seleniumPort, maxWaitTimeInMs );
-        screenshotCaptureRule.selenium = selenium;
+        archivaSeleniumExecutionRule.selenium = selenium;
         assertAdminCreated();
     }
 
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java
new file mode 100644 (file)
index 0000000..f7a7eb6
--- /dev/null
@@ -0,0 +1,68 @@
+package org.apache.archiva.web.test.tools;
+/*
+ * 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.thoughtworks.selenium.Selenium;
+import org.apache.archiva.web.test.parent.AbstractSeleniumTest;
+import org.junit.rules.MethodRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+/**
+ * @author Olivier Lamy
+ */
+public class ArchivaSeleniumExecutionRule
+    implements MethodRule //TestRule
+{
+
+    public Selenium selenium;
+
+    public Statement apply( Statement base, FrameworkMethod method, Object target )
+    {
+        try
+        {
+            ( (AbstractSeleniumTest) target ).open();
+            method.getMethod().invoke( target );
+        }
+        catch ( Throwable e )
+        {
+            ( (AbstractSeleniumTest) target ).captureScreenShotOnFailure( e, method.getMethod().getName(),
+                                                                          target.getClass().getName() );
+        }
+        finally
+        {
+            ( (AbstractSeleniumTest) target ).close();
+        }
+        return new Statement()
+        {
+            @Override
+            public void evaluate()
+                throws Throwable
+            {
+                // no op
+            }
+        };
+    }
+
+    public Statement apply( Statement base, Description description )
+    {
+        return base;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ScreenshotCaptureRule.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ScreenshotCaptureRule.java
deleted file mode 100644 (file)
index c96bc2c..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.apache.archiva.web.test.tools;
-/*
- * 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.thoughtworks.selenium.Selenium;
-import org.apache.archiva.web.test.parent.AbstractSeleniumTest;
-import org.junit.rules.MethodRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-
-/**
- * @author Olivier Lamy
- */
-public class ScreenshotCaptureRule
-    implements MethodRule //TestRule
-{
-
-    public Selenium selenium;
-
-    public Statement apply( Statement base, FrameworkMethod method, Object target )
-    {
-        try
-        {
-            ( (AbstractSeleniumTest) target ).open();
-            method.getMethod().invoke( target );
-        }
-        catch ( Throwable e )
-        {
-            ( (AbstractSeleniumTest) target ).captureScreenShotOnFailure( e, method.getMethod().getName(),
-                                                                          target.getClass().getName() );
-        }
-        finally
-        {
-            ( (AbstractSeleniumTest) target ).close();
-        }
-        return new Statement()
-        {
-            @Override
-            public void evaluate()
-                throws Throwable
-            {
-                // no op
-            }
-        };
-    }
-
-    public Statement apply( Statement base, Description description )
-    {
-        return base;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-}