adding "temp dir" fix to 1.0.2 build stream.
diff --git a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/environment/tests/EclipseURITests.java b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/environment/tests/EclipseURITests.java index 12fd86c..b96bd5f 100644 --- a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/environment/tests/EclipseURITests.java +++ b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/environment/tests/EclipseURITests.java
@@ -1,11 +1,16 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2005 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 +/******************************************************************************* + * Copyright (c) 2003, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are 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: IBM Corporation - initial API and implementation - **************************************************************************************************/ + * + * Contributors: + * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20060217 128456 pmoogk@ca.ibm.com - Peter Moogk + *******************************************************************************/ package org.eclipse.wst.common.environment.tests; import java.io.BufferedReader; import java.io.File; @@ -40,6 +45,8 @@ public class EclipseURITests extends TestCase { private final String projectName_ = "TestProject"; + private File tempFile; + private File tempDir; public EclipseURITests(String name) { @@ -84,6 +91,10 @@ { super.setUp(); + tempFile = File.createTempFile("tmp", "tmp", null ); + tempDir = new File( tempFile.getParentFile(), "tmpDir" ); + tempDir.mkdir(); + // Create a test project in the workbench IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IProject project = workspaceRoot.getProject( projectName_ ); @@ -110,6 +121,8 @@ IProject project = workspaceRoot.getProject( projectName_ ); project.delete( true, null ); + tempFile.delete(); + deleteDir( tempDir ); } public static Test getTest() @@ -126,7 +139,7 @@ try { IURI uri1 = factory.newURI( "platform:/resource/" + projectName_ + "/myfile" ); - IURI uri2 = factory.newURI( "file:/tmp/somedirectory/somefile" ); + IURI uri2 = factory.newURI( getTmpFileURL( "somefile" ) ); IURI uri3 = factory.newURI( "relativedirectory/relativefile" ); assertTrue( "Not available as URL", uri1.isAvailableAsURL() ); @@ -198,17 +211,17 @@ try { IURIScheme scheme1 = factory.newURIScheme( "platform:/resource/myproj/myfile" ); - IURIScheme scheme2 = factory.newURIScheme( "file:/tmp/somedirectory/somefile" ); + IURIScheme scheme2 = factory.newURIScheme( getTmpFileURL( "somefile2" ) ); IURIScheme scheme3 = factory.newURIScheme( "platform" ); IURIScheme scheme4 = factory.newURIScheme( "file" ); IURIScheme scheme5 = factory.newURI( "rel1/rel2" ).getURIScheme(); IURI uri1 = factory.newURI( "platform:/resource/myproj/myfile" ); - IURI uri2 = factory.newURI( "file:/somedirectory/somefile" ); + IURI uri2 = factory.newURI( getTmpFileURL( "somefile3" ) ); IURI uri3 = factory.newURI( "relativedirectory/relativefile" ); IURI uri4 = factory.newURI( new URL( "platform:/resource/myproj/myfile" )); - IURI uri5 = factory.newURI( new URL( "file:/tmp/somedirectory/somefile" ) ); + IURI uri5 = factory.newURI( new URL( getTmpFileURL( "somefile4" ) ) ); assertTrue( "Scheme not platform protocol", scheme1.toString().equals("platform") ); @@ -868,6 +881,29 @@ return "platform:/resource" + absolutePath; } + private String getTmpFileURL( String fileName ) + { + File newFile = new File( tempDir, fileName ); + + return "file:/" + newFile.getAbsolutePath(); + } + + private void deleteDir( File fileOrDirectory ) + { + File[] childFiles = fileOrDirectory.listFiles(); + + if( childFiles != null ) + { + // Delete all the child files or directories first before this one. + for( int index = 0; index < childFiles.length; index++ ) + { + deleteDir( childFiles[index] ); + } + } + + fileOrDirectory.delete(); + } + private class NodeEntry { public NodeEntry()
diff --git a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/environment/tests/FileURITests.java b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/environment/tests/FileURITests.java index 57e9f2d..6777b26 100644 --- a/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/environment/tests/FileURITests.java +++ b/tests/org.eclipse.wst.common.tests/frameworktests/org/eclipse/wst/common/environment/tests/FileURITests.java
@@ -1,11 +1,16 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 2005 IBM Corporation and others. All rights reserved. This program and the - * accompanying materials are made available under the terms of the Eclipse Public License v1.0 +/******************************************************************************* + * Copyright (c) 2003, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are 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: IBM Corporation - initial API and implementation - **************************************************************************************************/ + * + * Contributors: + * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20060217 128456 pmoogk@ca.ibm.com - Peter Moogk + *******************************************************************************/ package org.eclipse.wst.common.environment.tests; import java.io.BufferedReader; import java.io.File; @@ -33,7 +38,8 @@ public class FileURITests extends TestCase { - private File tempDir = null; + private File tempFile; + private File tempDir; public FileURITests(String name) { @@ -78,7 +84,8 @@ { super.setUp(); - tempDir = new File( "/tmp/uritests" ); + tempFile = File.createTempFile("tmp", "tmp", null ); + tempDir = new File( tempFile.getParentFile(), "tmpDir" ); tempDir.mkdir(); } @@ -90,6 +97,7 @@ super.tearDown(); deleteFiles( tempDir ); + tempFile.delete(); } private void deleteFiles( File directory ) @@ -109,6 +117,13 @@ } } + private String getTmpFileURL( String fileName ) + { + File newFile = new File( tempDir, fileName ); + + return "file:/" + newFile.getAbsolutePath(); + } + public static Test getTest() { return new FileURITests("FileURITests"); @@ -122,7 +137,7 @@ try { - IURI uri2 = factory.newURI( "file:/tmp/somedirectory/somefile" ); + IURI uri2 = factory.newURI( getTmpFileURL( "somefile" ) ); IURI uri3 = factory.newURI( "relativedirectory/relativefile" ); assertTrue( "Not available as URL", uri2.isAvailableAsURL() );
diff --git a/tests/org.eclipse.wst.common.tests/plugin.xml b/tests/org.eclipse.wst.common.tests/plugin.xml index cfe22f9..921551a 100644 --- a/tests/org.eclipse.wst.common.tests/plugin.xml +++ b/tests/org.eclipse.wst.common.tests/plugin.xml
@@ -3,7 +3,7 @@ <plugin id="org.eclipse.wst.common.tests" name="org.eclipse.wst.common.tests" - version="1.0.0" + version="1.0.100" provider-name="Eclipse.org" class="org.eclipse.wst.common.tests.CommonTestsPlugin">