Skip to content

Commit

Permalink
Merge branch 'eclipse-platform:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael5601 authored May 7, 2024
2 parents e124e7b + 692c8fa commit 78f9406
Show file tree
Hide file tree
Showing 39 changed files with 884 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
Expand Down Expand Up @@ -108,7 +110,18 @@ public void tearDown() throws Exception {

super.tearDown();

assertThat(loggedErrors).as("logged errors").isEmpty();
assertThat(errorsToStrings()).as("logged errors").isEmpty();
}

private Stream<String> errorsToStrings() {
return loggedErrors.stream().map(status -> status.toString() + throwableToString(status.getException()));
}

private static String throwableToString(Throwable throwable) {
if (throwable == null) {
return "";
}
return System.lineSeparator() + "Stack trace: " + Stream.of(throwable.getStackTrace()).map(Object::toString).collect(Collectors.joining(System.lineSeparator()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,12 @@ public void addConsoles(IConsole[] consoles) {
List<IConsole> added = new ArrayList<>(consoles.length);
synchronized (fConsoles) {
for (IConsole console : consoles) {
if(console instanceof TextConsole) {
TextConsole ioconsole = (TextConsole)console;
createPatternMatchListeners(ioconsole);
}
if (!fConsoles.contains(console)) {
fConsoles.add(console);
added.add(console);
if (console instanceof TextConsole ioconsole) {
createPatternMatchListeners(ioconsole);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,33 @@ public void setStringAttribute(int attribute, String value) {
this.linkTarget = value;
}

/**
* For debugging purposes only.
*/
@Override
public String toString() {
return name;
StringBuilder sb = new StringBuilder();
sb.append("FileInfo ["); //$NON-NLS-1$
if (name != null) {
sb.append("name="); //$NON-NLS-1$
sb.append(name);
sb.append(", "); //$NON-NLS-1$
}
sb.append("length="); //$NON-NLS-1$
sb.append(length);
sb.append(", lastModified="); //$NON-NLS-1$
sb.append(lastModified);
sb.append(", exists="); //$NON-NLS-1$
sb.append(exists());
sb.append(", "); //$NON-NLS-1$
if (linkTarget != null) {
sb.append("linkTarget="); //$NON-NLS-1$
sb.append(linkTarget);
sb.append(", "); //$NON-NLS-1$
}
sb.append("attributes="); //$NON-NLS-1$
sb.append(attributes);
sb.append(", errorCode="); //$NON-NLS-1$
sb.append(errorCode);
sb.append("]"); //$NON-NLS-1$
return sb.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@
*******************************************************************************/
package org.eclipse.core.internal.resources;

import java.io.*;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.TreeMap;
import org.eclipse.core.internal.localstore.FileStoreRoot;
import org.eclipse.core.internal.utils.*;
import org.eclipse.core.internal.utils.IStringPoolParticipant;
import org.eclipse.core.internal.utils.ObjectMap;
import org.eclipse.core.internal.utils.StringPool;
import org.eclipse.core.internal.watson.IElementTreeData;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.QualifiedName;
Expand Down Expand Up @@ -489,6 +495,32 @@ public void writeTo(DataOutput output) throws IOException {
/** for debugging only **/
@Override
public String toString() {
return "" + fileStoreRoot + " modStamp=" + modStamp; //$NON-NLS-1$ //$NON-NLS-2$
Map<String, Integer> flagsMap = new TreeMap<>();
Field[] fields = ICoreConstants.class.getFields();
for (Field field : fields) {
String name = field.getName();
if (name.startsWith("M_")) { //$NON-NLS-1$
try {
flagsMap.put(name, field.getInt(null));
} catch (IllegalArgumentException | IllegalAccessException e) {
// don't care
}
}
}
StringBuilder sb = new StringBuilder(fileStoreRoot + " modStamp=" + modStamp); //$NON-NLS-1$
sb.append(", exists="); //$NON-NLS-1$
sb.append(flags != NULL_FLAG);
sb.append(", syncInfo="); //$NON-NLS-1$
sb.append(localInfo);
sb.append(", flags ["); //$NON-NLS-1$
for (Map.Entry<String, Integer> entry : flagsMap.entrySet()) {
String flag = entry.getKey();
Integer val = entry.getValue();
if (isSet(flags, val)) {
sb.append(flag).append(',');
}
}
sb.append("]"); //$NON-NLS-1$
return sb.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.pde.junit.runtime;bundle-version="3.5.0"
Import-Package: org.assertj.core.api,
org.junit.jupiter.api,
org.junit.platform.suite.api,
org.mockito
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@
*******************************************************************************/
package org.eclipse.core.tests.filesystem;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

/**
* Class for collecting all test classes that deal with the file system API.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({ CreateDirectoryTest.class, DeleteTest.class, EFSTest.class, FileCacheTest.class,
FileStoreTest.class, OpenOutputStreamTest.class, PutInfoTest.class, SymlinkTest.class, URIUtilTest.class })
@Suite
@SelectClasses({ CreateDirectoryTest.class, //
DeleteTest.class, //
EFSTest.class, //
FileCacheTest.class, //
FileStoreTest.class, //
OpenOutputStreamTest.class, //
PutInfoTest.class, //
SymlinkTest.class, //
URIUtilTest.class, //
})
public class AllFileSystemTests {
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.alias;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

/**
* Class for collecting all test classes that deal with alias support. An alias
* is a resource in the workspace that has the same file system location as
* another resource in the workspace. When a resource changes in a way that
* affects the contents on disk, all aliases need to be updated.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({ BasicAliasTest.class, SyncAliasTest.class })
@Suite
@SelectClasses({ //
BasicAliasTest.class, //
SyncAliasTest.class, //
})
public class AllAliasTests {
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.builders;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({ //
@Suite
@SelectClasses({ //
AutoBuildJobTest.class, //
BuildConfigurationsTest.class, //
BuildContextTest.class, //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.dtree;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({ DeltaDataTreeTest.class })
@Suite
@SelectClasses({ //
DeltaDataTreeTest.class, //
})
public class AllDtreeTests {
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.events;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({ BuildProjectFromMultipleJobsTest.class })
@Suite
@SelectClasses({ //
BuildProjectFromMultipleJobsTest.class, //
})
public class AllEventsTests {
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.localstore;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({ //
@Suite
@SelectClasses({ //
BlobStoreTest.class, //
BucketTreeTests.class, //
CaseSensitivityTest.class, //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.mapping;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

/**
* Suite containing all tests in the org.eclipse.core.tests.internal.mapping
* package.
*
* @since 3.2
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
ChangeValidationTest.class,
TestProjectDeletion.class
})
@Suite
@SelectClasses({ //
ChangeValidationTest.class, //
TestProjectDeletion.class, //
})
public class AllMappingTests {
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.properties;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@RunWith(Suite.class)

@Suite.SuiteClasses({ PropertyManagerTest.class })
@Suite
@SelectClasses({ //
PropertyManagerTest.class, //
})
public class AllPropertiesTests {
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.propertytester;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({ FilePropertyTesterTest.class })
@Suite
@SelectClasses({ //
FilePropertyTesterTest.class, //
})
public class AllPropertytesterTests {

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.resources;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

/**
* The suite method for this class contains test suites for all automated tests
* in this test package.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({ //
@Suite
@SelectClasses({ //
Bug544975Test.class, //
ModelObjectReaderWriterTest.class, //
ProjectBuildConfigsTest.class, //
Expand All @@ -31,6 +31,7 @@
ProjectReferencesTest.class, //
ResourceInfoTest.class, //
WorkspaceConcurrencyTest.class, //
WorkspacePreferencesTest.class, })
WorkspacePreferencesTest.class, //
})
public class AllInternalResourcesTests {
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.utils;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({ ObjectMapTest.class, CacheTest.class, FileUtilTest.class })
@Suite
@SelectClasses({ //
ObjectMapTest.class, //
CacheTest.class, //
FileUtilTest.class, })
public class AllUtilsTests {
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
*******************************************************************************/
package org.eclipse.core.tests.internal.watson;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({
DeltaChainFlatteningTest.class, DeltaFlatteningTest.class, ElementTreeDeltaChainTest.class,
ElementTreeIteratorTest.class, ElementTreeHasChangesTest.class, TreeFlatteningTest.class
@Suite
@SelectClasses({ //
DeltaChainFlatteningTest.class, //
DeltaFlatteningTest.class, //
ElementTreeDeltaChainTest.class, //
ElementTreeIteratorTest.class, //
ElementTreeHasChangesTest.class, //
TreeFlatteningTest.class, //
})
public class AllWatsonTests {

Expand Down
Loading

0 comments on commit 78f9406

Please sign in to comment.