Author: rob.stryker(a)jboss.com
Date: 2009-11-04 18:04:04 -0500 (Wed, 04 Nov 2009)
New Revision: 18409
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackageModuleFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java
trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java
Log:
JBIDE-5121
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackageModuleFactory.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackageModuleFactory.java 2009-11-04
17:58:59 UTC (rev 18408)
+++
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackageModuleFactory.java 2009-11-04
23:04:04 UTC (rev 18409)
@@ -196,18 +196,18 @@
}
public boolean visit(IArchiveNode node) {
int type = node.getNodeType();
+ // not sure why this is giving wrong values but it seems to go deep into IArchive
code
+ IPath rootRelative = node.getRootArchiveRelativePath().removeFirstSegments(1);
if( type == IArchiveNode.TYPE_ARCHIVE && ((IArchive)node).isTopLevel()) {
- IPath rel = ((IArchive)node).getRootArchiveRelativePath();
- members.put(node, new ArchiveContainerResource(((IArchive)node).getName(), node,
rel));
- pathToNode.put(rel, node);
+ members.put(node, new ArchiveContainerResource(((IArchive)node).getName(), node,
rootRelative));
+ pathToNode.put(rootRelative, node);
} else if( type == IArchiveNode.TYPE_ARCHIVE || type ==
IArchiveNode.TYPE_ARCHIVE_FOLDER) {
String name = type == IArchiveNode.TYPE_ARCHIVE ? ((IArchive)node).getName() :
((IArchiveFolder)node).getName();
// if we're any other archive or a folder, create us and add to parent
IArchiveNode parent = node.getParent();
ArchiveContainerResource parentAsResource = members.get(parent);
- IPath rel = node.getRootArchiveRelativePath();
- members.put(node, new ArchiveContainerResource(name, node, rel));
- pathToNode.put(rel, node);
+ members.put(node, new ArchiveContainerResource(name, node, rootRelative));
+ pathToNode.put(rootRelative, node);
parentAsResource.addChild(members.get(node));
} else if( type == IArchiveNode.TYPE_ARCHIVE_FILESET ) {
ArchiveContainerResource parentAsResource = members.get(node.getParent());
@@ -242,7 +242,7 @@
this.moduleRelativePath = moduleRelativePath;
members = new HashMap<IPath, IModuleResource>();
if( node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET ) {
- fsRelative =
moduleRelativePath.removeFirstSegments(node.getParent().getRootArchiveRelativePath().segmentCount());
+ fsRelative =
moduleRelativePath.removeFirstSegments(node.getParent().getRootArchiveRelativePath().removeFirstSegments(1).segmentCount());
}
}
@@ -288,7 +288,7 @@
protected ArchiveContainerResource find(IArchiveFileSet fs, IPath fsRelative, boolean
create) {
ArchiveContainerResource resource = this;
ArchiveContainerResource tmpResource;
- IPath tmpPath = fs.getRootArchiveRelativePath();
+ IPath tmpPath = fs.getRootArchiveRelativePath().removeFirstSegments(1);
int count = fsRelative.segmentCount();
for( int i = 0; i < count; i++ ) {
tmpPath = tmpPath.append(fsRelative.segment(i));
@@ -402,7 +402,7 @@
public IModuleResource[] members() throws CoreException {
init();
- return new IModuleResource[] { rootResource };
+ return ((IModuleFolder)rootResource).members();
}
public IStatus validate() {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java 2009-11-04
17:58:59 UTC (rev 18408)
+++
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java 2009-11-04
23:04:04 UTC (rev 18409)
@@ -135,7 +135,7 @@
publishFromDelta(module, destPathRoot, sourcePath.removeLastSegments(1), delta);
} else {
// full publish, copy whole folder or file
- FileUtil.fileSafeCopy(sourcePath.toFile(),
destPathRoot.append(sourcePath.lastSegment()).toFile(), listener);
+ FileUtil.fileSafeCopy(sourcePath.toFile(), destPathRoot.toFile(), listener);
}
}
@@ -198,9 +198,9 @@
if( imr instanceof ExtendedModuleFile ) {
IPath concrete = ((ExtendedModuleFile)imr).getConcreteDestFile();
if( !changedFiles.contains(concrete)) {
+ IPath destPath =
destRoot.append(concrete.removeFirstSegments(sourcePrefix.segmentCount()+1));
+ FileUtil.fileSafeCopy(concrete.toFile(), destPath.toFile(), listener);
changedFiles.add(concrete);
- IPath destPath =
destRoot.append(concrete.removeFirstSegments(sourcePrefix.segmentCount()));
- FileUtil.fileSafeCopy(concrete.toFile(), destPath.toFile(), listener);
}
}
break;
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java 2009-11-04
17:58:59 UTC (rev 18408)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java 2009-11-04
23:04:04 UTC (rev 18409)
@@ -10,6 +10,7 @@
import java.util.HashSet;
import java.util.Set;
+import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.eclipse.core.resources.IFile;
@@ -40,8 +41,8 @@
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
import org.jboss.ide.eclipse.archives.ui.actions.BuildAction;
import org.jboss.ide.eclipse.archives.webtools.modules.ArchivesModuleModelListener;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServer;
@@ -90,7 +91,7 @@
try {
assertDeployContents(count);
assertTrue("Deployed File should not have changed", false);
- } catch( AssertionError ae) {}
+ } catch( AssertionFailedError ae) {}
// Builder is on, auto-deploy is on
@@ -115,15 +116,15 @@
try {
assertBinContents(count);
assertTrue("Bin File should not have changed", false);
- } catch( AssertionError ae ) {}
+ } catch( AssertionFailedError ae ) {}
try {
assertBuiltArchiveContents(count);
assertTrue("Built Archive File should not have changed", false);
- } catch( AssertionError ae ) {}
+ } catch( AssertionFailedError ae ) {}
try {
assertDeployContents(count);
assertTrue("Deployed File should not have changed", false);
- } catch( AssertionError ae ) {}
+ } catch( AssertionFailedError ae ) {}
// Builder is off, autodeploy is on, manually call build!
callBuild();