mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 06:55:23 +02:00
fix for bug 333874
This commit is contained in:
parent
03b87be959
commit
bdb90daffd
2 changed files with 44 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Johnson Ma (Wind River) - [195402] Extracted from FileServiceArchiveTest
|
* Johnson Ma (Wind River) - [195402] Extracted from FileServiceArchiveTest
|
||||||
|
* Xuan Chen (IBM) [333874] - Added more logging code to track junit failure
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.tests.subsystems.files;
|
package org.eclipse.rse.tests.subsystems.files;
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ import org.eclipse.core.filesystem.IFileStore;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.rse.core.model.ISystemResourceSet;
|
import org.eclipse.rse.core.model.ISystemResourceSet;
|
||||||
import org.eclipse.rse.core.model.SystemRemoteResourceSet;
|
import org.eclipse.rse.core.model.SystemRemoteResourceSet;
|
||||||
import org.eclipse.rse.core.model.SystemWorkspaceResourceSet;
|
import org.eclipse.rse.core.model.SystemWorkspaceResourceSet;
|
||||||
|
@ -920,8 +922,10 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
//now, verify the content of the local file
|
//now, verify the content of the local file
|
||||||
IFileStore localFile = temp.getChild(fileContentToVerifyName1);
|
IFileStore localFile = temp.getChild(fileContentToVerifyName1);
|
||||||
|
File actualFile = localFile.toLocalFile(EFS.NONE, new NullProgressMonitor());
|
||||||
|
assertTrue("The file does not exist", actualFile.exists());
|
||||||
//Check the content of the download file:
|
//Check the content of the download file:
|
||||||
boolean sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null));
|
boolean sameContent = compareContent1(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null));
|
||||||
assertTrue(sameContent);
|
assertTrue(sameContent);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
* - <copied code from org.eclipse.core.tests.harness/CoreTest (C) IBM>
|
* - <copied code from org.eclipse.core.tests.harness/CoreTest (C) IBM>
|
||||||
* Martin Oberhuber (Wind River) - [195402] Add constructor with test name
|
* Martin Oberhuber (Wind River) - [195402] Add constructor with test name
|
||||||
* David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService
|
* David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService
|
||||||
|
* Xuan Chen (IBM) [333874] - Added more logging code to track junit failure
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.tests.subsystems.files;
|
package org.eclipse.rse.tests.subsystems.files;
|
||||||
|
|
||||||
|
@ -338,6 +339,44 @@ public class FileServiceBaseTest extends RSEBaseConnectionTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <copied code from org.eclipse.core.tests.resources/ResourceTest.java (C) IBM>
|
||||||
|
*
|
||||||
|
* Returns a boolean value indicating whether or not the contents
|
||||||
|
* of the given streams are considered to be equal. Closes both input streams.
|
||||||
|
* @param a input stream a
|
||||||
|
* @param b input stream b
|
||||||
|
* @return if both stream are consider to be equal
|
||||||
|
*/
|
||||||
|
public boolean compareContent1(InputStream a, InputStream b) {
|
||||||
|
int c, d;
|
||||||
|
if (a == null && b == null)
|
||||||
|
return true;
|
||||||
|
try {
|
||||||
|
if (a == null || b == null)
|
||||||
|
{
|
||||||
|
fail("only one of the input stream is null");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
while ((c = a.read()) == (d = b.read()) && (c != -1 && d != -1)) {
|
||||||
|
//body not needed
|
||||||
|
}
|
||||||
|
if (c == -1 && d == -1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
String msg = "difference: c is " + c + " but d is " + d;
|
||||||
|
fail(msg);
|
||||||
|
return false;
|
||||||
|
} catch (IOException e) {
|
||||||
|
fail("IOException: " + e.getMessage());
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
assertClose(a);
|
||||||
|
assertClose(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the data from the input stream to the output stream.
|
* Copy the data from the input stream to the output stream.
|
||||||
* Close both streams when finished.
|
* Close both streams when finished.
|
||||||
|
|
Loading…
Add table
Reference in a new issue