Author: adietish
Date: 2011-07-20 05:16:55 -0400 (Wed, 20 Jul 2011)
New Revision: 33069
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/PathUtils.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DeploymentMarkerUtils.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeploymentWarUpdateXML.java
Log:
[JBIDE-9374] fixed test to now assert removal of markers and war (was: asserted only
removal of markers). Corrected test to not assert fixed file removal order
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DeploymentMarkerUtils.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DeploymentMarkerUtils.java 2011-07-20
08:34:08 UTC (rev 33068)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DeploymentMarkerUtils.java 2011-07-20
09:16:55 UTC (rev 33069)
@@ -217,4 +217,16 @@
return Status.OK_STATUS;
}
+ public static String getDeployedMarker(String file) {
+ return file + DEPLOYED;
+ }
+
+ public static String getFailedMarkerName(String file) {
+ return file + FAILED_DEPLOY;
+ }
+
+ public static String getDoDeployMarkerName(String file) {
+ return file + DO_DEPLOY;
+ }
}
+
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeploymentWarUpdateXML.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeploymentWarUpdateXML.java 2011-07-20
08:34:08 UTC (rev 33068)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeploymentWarUpdateXML.java 2011-07-20
09:16:55 UTC (rev 33069)
@@ -11,10 +11,7 @@
package org.jboss.ide.eclipse.as.test.publishing.v2;
import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -25,6 +22,7 @@
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerUtil;
import org.jboss.ide.eclipse.as.core.server.internal.v7.DeploymentMarkerUtils;
+import org.jboss.ide.eclipse.as.test.util.PathUtils;
import org.jboss.ide.eclipse.as.test.util.ServerRuntimeUtils;
import org.jboss.ide.eclipse.as.test.util.wtp.JavaEEFacetConstants;
import org.jboss.ide.eclipse.as.test.util.wtp.OperationTestCase;
@@ -45,7 +43,7 @@
IModule mod = ServerUtil.getModule(project);
IModule[] module = new IModule[] { mod };
verifyJSTPublisher(module);
- IFile f =
project.getFolder(CONTENT_DIR).getFolder("WEB-INF").getFile("web.xml");
+// IFile f =
project.getFolder(CONTENT_DIR).getFolder("WEB-INF").getFile("web.xml");
server = ServerRuntimeUtils.addModule(server,mod);
ServerRuntimeUtils.publish(server);
@@ -80,15 +78,18 @@
server = ServerRuntimeUtils.createMockJBoss7Server();
server = ServerRuntimeUtils.useMockPublishMethod(server);
/*
- * removing module newModule.war will remove 2 markers:
+ * removing module newModule.war will remove 2 markers and the war:
* <ul>
+ * <li>newModule.war</li>
* <li>newModule.war.deployed</li>
* <li>newModule.war.failed</li>
* </ul>
*/
- testMockPublishMethod(8, "newModule.war",
- "newModule.war" + DeploymentMarkerUtils.FAILED_DEPLOY,
- "newModule.war" + DeploymentMarkerUtils.DEPLOYED);
+ String moduleName = "newModule.war";
+ testMockPublishMethod(8,
+ moduleName,
+ DeploymentMarkerUtils.getFailedMarkerName(moduleName),
+ DeploymentMarkerUtils.getDeployedMarker(moduleName));
}
private void testMockPublishMethod(int initial, String... filesToRemove) throws
CoreException, IOException {
@@ -97,19 +98,16 @@
IModule mod = ServerUtil.getModule(project);
server = ServerRuntimeUtils.addModule(server,mod);
ServerRuntimeUtils.publish(server);
- IPath[] changed = MockPublishMethod.getChanged();
- assertEquals(initial, changed.length);
+ assertEquals(initial, MockPublishMethod.getChanged().length);
MockPublishMethod.reset();
// remove
server = ServerRuntimeUtils.removeModule(server, mod);
ServerRuntimeUtils.publish(server);
- IPath[] rem = MockPublishMethod.getRemoved();
- assertEquals(filesToRemove.length, rem.length);
+ assertEquals(filesToRemove.length, MockPublishMethod.getRemoved().length);
IPath[] removedFiles = MockPublishMethod.getRemoved();
- List<IPath> removedAsList = Arrays.asList(removedFiles);
for(int i = 0; i < removedFiles.length; i++) {
- assertTrue(removedAsList.contains(new Path(MockPublishMethod.MOCK_ROOT + "/"
+ filesToRemove[i])));
+ assertTrue(PathUtils.containsPath(MockPublishMethod.MOCK_ROOT + "/" +
filesToRemove[i], removedFiles));
}
MockPublishMethod.reset();
}
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/PathUtils.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/PathUtils.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/PathUtils.java 2011-07-20
09:16:55 UTC (rev 33069)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010 - 2011 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.ide.eclipse.as.test.util;
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * @author André Dietisheim
+ */
+public class PathUtils {
+
+ /**
+ * Returns <code>true</code> if the given path (string) is contained in the
+ * given array of paths
+ *
+ * @param pathString
+ * the path (string) to check
+ * @param pathArray
+ * the array of paths to check
+ * @return true if the path was found in the array
+ */
+ public static boolean containsPath(String pathString, IPath[] pathArray) {
+ if (pathArray == null
+ || pathString == null) {
+ return false;
+ }
+ for (IPath path : pathArray) {
+ if (pathString.equals(path.toString())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/PathUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain