Author: dgolovin
Date: 2009-03-05 20:15:19 -0500 (Thu, 05 Mar 2009)
New Revision: 14063
Modified:
branches/jbosstools-3.0.x/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
Log:
fix error in JUnit Test
SeamCoreAllTests.testEarProject
Failing for the past 7 builds (Since Unstable#4 )
Took 39 sec.
Error Message: War project must see component 'authenticator' declared in ejb
project
Modified:
branches/jbosstools-3.0.x/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
===================================================================
---
branches/jbosstools-3.0.x/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2009-03-05
23:49:40 UTC (rev 14062)
+++
branches/jbosstools-3.0.x/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2009-03-06
01:15:19 UTC (rev 14063)
@@ -1,92 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.test.util;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-
-import org.eclipse.core.internal.resources.ResourceException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * @author eskimo
- *
- */
-public class ProjectImportTestSetup extends TestSetup {
-
- private String bundleName;
- private String[] projectPaths;
- private String[] projectNames;
-
- /**
- * @param test
- */
- public ProjectImportTestSetup(Test test, String bundleName, String projectPath, String
projectName) {
- super(test);
- this.bundleName = bundleName;
- this.projectPaths = new String[]{projectPath};
- this.projectNames = new String[]{projectName};
- }
-
- public ProjectImportTestSetup(Test test, String bundleName, String[] projectPaths,
String[] projectNames) {
- super(test);
- this.bundleName = bundleName;
- this.projectPaths = projectPaths;
- this.projectNames = projectNames;
- }
-
- public IProject importProject() throws Exception {
- return importProjects()[0];
- }
-
- public IProject[] importProjects() throws Exception {
- IProject[] projects = new IProject[projectPaths.length];
- JobUtils.waitForIdle();
- for (int i = 0; i < projectPaths.length; i++) {
- projects[i] = (IProject)ResourcesUtils.importProject(bundleName, projectPaths[i]);
- JobUtils.waitForIdle();
- }
- return projects;
- }
-
- public static IProject loadProject(String projectName) throws CoreException {
- IResource project = ResourcesPlugin.getWorkspace().getRoot().findMember(projectName);
- assertNotNull("Can't load " + projectName, project);
- IProject result = project.getProject();
- try {
- result.build(IncrementalProjectBuilder.FULL_BUILD, null);
- } catch (ResourceException e) {
- JUnitUtils.fail(e.getMessage(), e);
- }
- JobUtils.waitForIdle();
- return result;
- }
-
- @Override
- protected void setUp() throws Exception {
- importProjects();
- }
-
- @Override
- protected void tearDown() throws Exception {
- boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
- JobUtils.waitForIdle();
- for (int i = 0; i < projectNames.length; i++) {
- ResourcesUtils.deleteProject(projectNames[i]);
- JobUtils.waitForIdle();
- }
- ResourcesUtils.setBuildAutomatically(saveAutoBuild);
- }
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.test.util;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.eclipse.core.internal.resources.ResourceException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * @author eskimo
+ *
+ */
+public class ProjectImportTestSetup extends TestSetup {
+
+ private String bundleName;
+ private String[] projectPaths;
+ private String[] projectNames;
+
+ /**
+ * @param test
+ */
+ public ProjectImportTestSetup(Test test, String bundleName, String projectPath, String
projectName) {
+ super(test);
+ this.bundleName = bundleName;
+ this.projectPaths = new String[]{projectPath};
+ this.projectNames = new String[]{projectName};
+ }
+
+ public ProjectImportTestSetup(Test test, String bundleName, String[] projectPaths,
String[] projectNames) {
+ super(test);
+ this.bundleName = bundleName;
+ this.projectPaths = projectPaths;
+ this.projectNames = projectNames;
+ }
+
+ public IProject importProject() throws Exception {
+ return importProjects()[0];
+ }
+
+ public IProject[] importProjects() throws Exception {
+ IProject[] projects = new IProject[projectPaths.length];
+ JobUtils.waitForIdle();
+ for (int i = 0; i < projectPaths.length; i++) {
+ projects[i] = (IProject)ResourcesUtils.importProject(bundleName, projectPaths[i]);
+ JobUtils.waitForIdle();
+ }
+ return projects;
+ }
+
+ public static IProject loadProject(String projectName) throws CoreException {
+ IResource project = ResourcesPlugin.getWorkspace().getRoot().findMember(projectName);
+ assertNotNull("Can't load " + projectName, project);
+ IProject result = project.getProject();
+ try {
+ result.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ } catch (ResourceException e) {
+ JUnitUtils.fail(e.getMessage(), e);
+ }
+ JobUtils.waitForIdle();
+ return result;
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ importProjects();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ JobUtils.waitForIdle();
+ for (int i = 0; i < projectNames.length; i++) {
+ ResourcesUtils.deleteProject(projectNames[i]);
+ JobUtils.waitForIdle();
+ }
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ }
+
+ public void deleteProjects() throws Exception {
+ tearDown();
+ }
}
\ No newline at end of file