From: Olivier Lamy Date: Fri, 2 Mar 2012 18:38:40 +0000 (+0000) Subject: more cleanup remove not used classes X-Git-Tag: archiva-1.4-M3~1127 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fe746a16a908d7d4085206f57264af3302fbac44;p=archiva.git more cleanup remove not used classes git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1296373 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java index d4811606d..786be69e0 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java @@ -21,7 +21,6 @@ package org.apache.archiva.web.test.parent; import com.thoughtworks.selenium.DefaultSelenium; import com.thoughtworks.selenium.Selenium; -import org.apache.archiva.web.test.tools.AfterSeleniumFailure; import org.apache.archiva.web.test.tools.ScreenshotCaptureRule; import org.junit.Assert; import org.junit.Rule; @@ -61,6 +60,10 @@ public abstract class AbstractSeleniumTest public Properties p; + /** + * this method is called by the Rule before executing a test + * @throws Exception + */ public void open() throws Exception { @@ -72,7 +75,7 @@ public abstract class AbstractSeleniumTest } /** - * Close selenium session. + * this method is called by the Rule after executing a tests */ public void close() { @@ -646,7 +649,6 @@ public abstract class AbstractSeleniumTest Assert.assertEquals( getSelenium().getValue( locator ), expectedValue ); } - @AfterSeleniumFailure public void captureScreenShotOnFailure( Throwable failure, String methodName, String className ) { SimpleDateFormat sdf = new SimpleDateFormat( "yyyy.MM.dd-HH_mm_ss" ); diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/AfterSeleniumFailure.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/AfterSeleniumFailure.java deleted file mode 100644 index a461be4d0..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/AfterSeleniumFailure.java +++ /dev/null @@ -1,38 +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. - */ - -/** - * @author Olivier Lamy - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation to mark a method being called after a failure - * - */ -@Retention( RetentionPolicy.RUNTIME) -@Target( ElementType.METHOD) -public @interface AfterSeleniumFailure -{ -} diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumRunner.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumRunner.java deleted file mode 100644 index a11b2d8ad..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumRunner.java +++ /dev/null @@ -1,62 +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 org.junit.runners.BlockJUnit4ClassRunner; -import org.junit.runners.model.FrameworkMethod; -import org.junit.runners.model.InitializationError; -import org.junit.runners.model.Statement; - -import java.util.List; - -/** - * @author Olivier Lamy - */ -public class ArchivaSeleniumRunner - extends BlockJUnit4ClassRunner -{ - - /** - * @param clazz Test class - * @throws InitializationError if the test class is malformed. - */ - public ArchivaSeleniumRunner( Class clazz ) - throws InitializationError - { - super( clazz ); - } - - - - /* - * FIXME move that to a Rule. - */ - @Override - protected Statement withAfters( FrameworkMethod method, Object target, Statement statement ) - { - statement = super.withAfters( method, target, statement ); - return withAfterFailures( method, target, statement ); - } - - protected Statement withAfterFailures( FrameworkMethod method, Object target, Statement statement ) - { - List failures = getTestClass().getAnnotatedMethods( AfterSeleniumFailure.class ); - return new RunAfterSeleniumFailures( statement, failures, target ); - } -} diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/RunAfterSeleniumFailures.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/RunAfterSeleniumFailures.java deleted file mode 100644 index a817876ba..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/RunAfterSeleniumFailures.java +++ /dev/null @@ -1,85 +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 org.junit.runners.model.FrameworkMethod; -import org.junit.runners.model.MultipleFailureException; -import org.junit.runners.model.Statement; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Olivier Lamy - */ -public class RunAfterSeleniumFailures - extends Statement -{ - - private final Statement next; - - private final Object target; - - private final List afterFailures; - - public RunAfterSeleniumFailures( Statement next, List afterFailures, Object target ) - { - this.next = next; - this.afterFailures = afterFailures; - this.target = target; - } - - @Override - public void evaluate() - throws Throwable - { - List errors = new ArrayList(); - errors.clear(); - try - { - next.evaluate(); - } - catch ( Throwable t ) - { - errors.add( t ); - for ( FrameworkMethod each : afterFailures ) - { - try - { - each.invokeExplosively( target, t ); - } - catch ( Throwable t2 ) - { - errors.add( t2 ); - } - } - } - if ( errors.isEmpty() ) - { - return; - } - if ( errors.size() == 1 ) - { - throw errors.get( 0 ); - } - throw new MultipleFailureException( errors ); - } - -}