Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tests/org.eclipse.core.filebuffers.tests/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.compliance=21
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
Expand Down Expand Up @@ -149,7 +149,7 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.compiler.source=21
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
Expand Down
8 changes: 4 additions & 4 deletions tests/org.eclipse.core.filebuffers.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.core.filebuffers.tests;singleton:=true
Bundle-Version: 3.13.700.qualifier
Bundle-Version: 3.14.0.qualifier
Bundle-Activator: org.eclipse.core.filebuffers.tests.FileBuffersTestPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Plugin.providerName
Expand All @@ -13,10 +13,10 @@ Require-Bundle:
org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)";resolution:=optional,
org.eclipse.core.filebuffers;bundle-version="[3.5.0,4.0.0)",
org.eclipse.text;bundle-version="[3.5.0,4.0.0)",
org.junit;bundle-version="4.12.0"
org.eclipse.text;bundle-version="[3.5.0,4.0.0)"
Import-Package: org.junit.jupiter.api;version="[5.14.0,6.0.0)",
org.junit.jupiter.api.extension;version="[5.14.0,6.0.0)",
org.junit.platform.suite.api;version="[1.14.0,2.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-RequiredExecutionEnvironment: JavaSE-21
Eclipse-BundleShape: dir
Automatic-Module-Name: org.eclipse.core.filebuffers.tests
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
*******************************************************************************/
package org.eclipse.core.filebuffers.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import org.eclipse.core.runtime.IPath;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
*******************************************************************************/
package org.eclipse.core.filebuffers.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.function.Function;

import org.junit.Test;
import org.junit.jupiter.api.Test;


import org.eclipse.core.runtime.IPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@
*******************************************************************************/
package org.eclipse.core.filebuffers.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
Expand Down Expand Up @@ -59,12 +58,12 @@ public class FileBufferCreation {
private IProject fProject;


@Before
@BeforeEach
public void setUp() throws Exception {
fProject= ResourceHelper.createProject("project");
}

@After
@AfterEach
public void tearDown() throws Exception {
ResourceHelper.deleteProject("project");
}
Expand Down Expand Up @@ -195,11 +194,11 @@ public void test3_1() throws Exception {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connect(path, LocationKind.NORMALIZE, null);
ITextFileBuffer buffer= manager.getTextFileBuffer(path, LocationKind.NORMALIZE);
Assert.assertNotNull(buffer);
Comment thread
akurtakov marked this conversation as resolved.
assertNotNull(buffer);

IDocument document= buffer.getDocument();
Assert.assertNotNull(document);
Assert.assertTrue(CONTENT2.equals(document.get()));
assertNotNull(document);
assertTrue(CONTENT2.equals(document.get()));
assertSame(buffer, manager.getTextFileBuffer(document));

manager.disconnect(path, LocationKind.NORMALIZE, null);
Expand All @@ -218,11 +217,11 @@ public void test3_2() throws Exception {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connect(path, LocationKind.NORMALIZE, null);
ITextFileBuffer buffer= manager.getTextFileBuffer(path, LocationKind.NORMALIZE);
Assert.assertNotNull(buffer);
assertNotNull(buffer);

IDocument document= buffer.getDocument();
Assert.assertNotNull(document);
Assert.assertTrue(CONTENT4.equals(document.get()));
assertNotNull(document);
assertTrue(CONTENT4.equals(document.get()));
assertSame(buffer, manager.getTextFileBuffer(document));

manager.disconnect(path, LocationKind.NORMALIZE, null);
Expand Down Expand Up @@ -263,7 +262,7 @@ public void test4() throws Exception {
try {
document1.replace(0, document1.getLength(), CONTENT1);
} catch (BadLocationException x) {
Assert.assertFalse(false);
assertFalse(false);
}

assertFalse(document1.get().equals(document2.get()));
Expand Down Expand Up @@ -334,7 +333,7 @@ public void test6() throws Exception {
try {
document1.replace(0, document1.getLength(), CONTENT1);
} catch (BadLocationException x) {
Assert.assertFalse(false);
assertFalse(false);
}

assertFalse(document1.get().equals(document2.get()));
Expand All @@ -356,11 +355,11 @@ public void test7() throws Exception {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connect(path, LocationKind.NORMALIZE, null);
ITextFileBuffer buffer= manager.getTextFileBuffer(path, LocationKind.NORMALIZE);
Assert.assertNotNull(buffer);
assertNotNull(buffer);

IDocument document= buffer.getDocument();
Assert.assertNotNull(document);
Assert.assertTrue("".equals(document.get()));
assertNotNull(document);
assertTrue("".equals(document.get()));
assertSame(buffer, manager.getTextFileBuffer(document));

manager.disconnect(path, LocationKind.NORMALIZE, null);
Expand Down Expand Up @@ -457,11 +456,11 @@ public void test3_1_IFILE() throws Exception {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connect(path, LocationKind.IFILE, null);
ITextFileBuffer buffer= manager.getTextFileBuffer(path, LocationKind.IFILE);
Assert.assertNotNull(buffer);
assertNotNull(buffer);

IDocument document= buffer.getDocument();
Assert.assertNotNull(document);
Assert.assertTrue(CONTENT2.equals(document.get()));
assertNotNull(document);
assertTrue(CONTENT2.equals(document.get()));
assertSame(buffer, manager.getTextFileBuffer(document));

manager.disconnect(path, LocationKind.IFILE, null);
Expand All @@ -480,11 +479,11 @@ public void test3_2_new() throws Exception {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connect(path, LocationKind.IFILE, null);
ITextFileBuffer buffer= manager.getTextFileBuffer(path, LocationKind.IFILE);
Assert.assertNotNull(buffer);
assertNotNull(buffer);

IDocument document= buffer.getDocument();
Assert.assertNotNull(document);
Assert.assertTrue(CONTENT4.equals(document.get()));
assertNotNull(document);
assertTrue(CONTENT4.equals(document.get()));
assertSame(buffer, manager.getTextFileBuffer(document));

manager.disconnect(path, LocationKind.IFILE, null);
Expand Down Expand Up @@ -525,7 +524,7 @@ public void test4_IFILE() throws Exception {
try {
document1.replace(0, document1.getLength(), CONTENT1);
} catch (BadLocationException x) {
Assert.assertFalse(false);
assertFalse(false);
}

assertFalse(document1.get().equals(document2.get()));
Expand Down Expand Up @@ -571,11 +570,11 @@ public void test7_location() throws Exception {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connect(path, LocationKind.LOCATION, null);
ITextFileBuffer buffer= manager.getTextFileBuffer(path, LocationKind.LOCATION);
Assert.assertNotNull(buffer);
assertNotNull(buffer);

IDocument document= buffer.getDocument();
Assert.assertNotNull(document);
Assert.assertTrue("".equals(document.get()));
assertNotNull(document);
assertTrue("".equals(document.get()));
assertSame(buffer, manager.getTextFileBuffer(document));

manager.disconnect(path, LocationKind.LOCATION, null);
Expand All @@ -594,11 +593,11 @@ public void test7_IFileStore() throws Exception {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connectFileStore(fileStore, null);
ITextFileBuffer buffer= manager.getFileStoreTextFileBuffer(fileStore);
Assert.assertNotNull(buffer);
assertNotNull(buffer);

IDocument document= buffer.getDocument();
Assert.assertNotNull(document);
Assert.assertTrue("".equals(document.get()));
assertNotNull(document);
assertTrue("".equals(document.get()));
assertSame(buffer, manager.getTextFileBuffer(document));

manager.disconnectFileStore(fileStore, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@
*******************************************************************************/
package org.eclipse.core.filebuffers.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.io.PrintStream;
import java.io.PrintWriter;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.TestWatcher;


import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo;
Expand Down Expand Up @@ -78,7 +79,7 @@ public abstract class FileBufferFunctions {
protected abstract Class<IAnnotationModel> getAnnotationModelClass() throws Exception;


@Before
@BeforeEach
public void setUp() throws Exception {
fManager= FileBuffers.getTextFileBufferManager();
fProject= ResourceHelper.createProject("project");
Expand All @@ -91,7 +92,7 @@ protected IProject getProject() {
return fProject;
}

@After
@AfterEach
public void tearDown() {
ITextFileBuffer buffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertTrue(buffer == null);
Expand All @@ -102,24 +103,24 @@ protected IPath getPath() {
return fPath;
}

@Rule
@RegisterExtension
public TestFailReporter failReporter= new TestFailReporter();

public static class TestFailReporter extends TestWatcher {
public static class TestFailReporter implements TestWatcher {

private static final String BUNDLE_ID= "org.eclipse.core.filebuffers.tests";

ILog log= ILog.of(Platform.getBundle(BUNDLE_ID));

@Override
protected void failed(Throwable e, Description description) {
IStatus status= new Status(IStatus.ERROR, BUNDLE_ID, "FAIL in " + description, e);
public void testFailed(ExtensionContext context, Throwable e) {
IStatus status= new Status(IStatus.ERROR, BUNDLE_ID, "FAIL in " + context.getDisplayName(), e);
log.log(status);
}

@Override
protected void succeeded(Description description) {
IStatus status= new Status(IStatus.INFO, BUNDLE_ID, "PASS in " + description);
public void testSuccessful(ExtensionContext context) {
IStatus status= new Status(IStatus.INFO, BUNDLE_ID, "PASS in " + context.getDisplayName());
log.log(status);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
*******************************************************************************/
package org.eclipse.core.filebuffers.tests;

import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.io.File;

import org.junit.After;
import org.junit.jupiter.api.AfterEach;

import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
Expand All @@ -36,7 +36,7 @@
public class FileBuffersForExternalFiles extends FileBufferFunctions {

@Override
@After
@AfterEach
public void tearDown() {
FileTool.delete(getPath());
FileTool.delete(FileBuffers.getSystemFileAtLocation(getPath()).getParentFile());
Expand Down
Loading
Loading