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
JavaJoeS authored Mar 31, 2024
2 parents cd26772 + 06c0105 commit 8d23737
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 197 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
import org.eclipse.swt.widgets.Display;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

public class LaunchConfigurationTabGroupViewerTest {
Expand Down Expand Up @@ -70,8 +69,8 @@ public void testAllTabsAreInitializedByDefault() {

final ILaunchConfigurationTab[] tabs = runOnDialog(createAndSelect1LaunchConfig);

for (int i = 0; i < tabs.length; i++) {
assertThat(((SpyTab) tabs[i])).withFailMessage("tab %s was not initialized", i).matches(SpyTab::isInitialized);
for (ILaunchConfigurationTab tab : tabs) {
assertThat(((SpyTab) tab)).matches(SpyTab::isInitialized, "should have been initialized");
}
}

Expand All @@ -83,7 +82,7 @@ public void testFirstTabIsActivatedByDefault() {
};

final ILaunchConfigurationTab[] tabs = runOnDialog(createAndSelect1LaunchConfig);
assertThat(((SpyTab) tabs[0])).matches(SpyTab::isActivated, "is activated");
assertThat(((SpyTab) tabs[0])).matches(SpyTab::isActivated, "should have been activated");
}

@Test
Expand All @@ -104,12 +103,11 @@ public void testOtherTabInOtherConfigIsActivated() {

final ILaunchConfigurationTab[] tabs = runOnDialog(setActiveTab);

assertThat((SpyTab) tabs[0]).withFailMessage("the 1st tab of the other launch configuration shouldn't have been activated").matches(not(SpyTab::isActivated));
assertThat((SpyTab) tabs[secondTabIndex]).matches(SpyTab::isActivated, "is activated");
assertThat(((SpyTab) tabs[0])).matches(not(SpyTab::isActivated), "should not have been activated");
assertThat(((SpyTab) tabs[secondTabIndex])).matches(SpyTab::isActivated, "should have been activated");
}

@Test
@Ignore("https://github.com/eclipse-platform/eclipse.platform/issues/1075")
public void testOnlyDefaultTabInOtherConfigIsActivated() {
int overflowTabIndex = Integer.MAX_VALUE;

Expand All @@ -127,11 +125,13 @@ public void testOnlyDefaultTabInOtherConfigIsActivated() {

final ILaunchConfigurationTab[] tabs = runOnDialog(setActiveTab);

assertThat(((SpyTab) tabs[0])).withFailMessage("the 1st tab of the other launch configuration should have been activated").matches(SpyTab::isActivated);
// The 1st tab of the other launch configuration should have been
// activated
assertThat(((SpyTab) tabs[0])).matches(SpyTab::isActivated, "Should have been activated");

// All other tabs should not have been initialized
// All other tabs should not have been activated
for (int i = 1; i < tabs.length; i++) {
assertThat((SpyTab) tabs[i]).withFailMessage("tab %s should not have been initialized", i).matches(not(SpyTab::isInitialized));
assertThat(((SpyTab) tabs[i])).matches(not(SpyTab::isActivated), "Should not have been activated");
}
}

Expand All @@ -149,7 +149,7 @@ public void testOtherTabIsActivated() {

final ILaunchConfigurationTab[] tabs = runOnDialog(setActiveTab);

assertThat((SpyTab) tabs[secondTabIndex]).matches(SpyTab::isActivated, "is activated");
assertThat(((SpyTab) tabs[secondTabIndex])).matches(SpyTab::isActivated, "should have been activated");
}

private ILaunchConfigurationWorkingCopy createLaunchConfigurationInstance() throws CoreException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public abstract class SpyTab extends AbstractLaunchConfigurationTab {
private boolean initialized;
private boolean activated;

@Override
public String toString() {
return getClass().getSimpleName() + " [initialized=" + initialized + ", activated=" + activated + "]";
}

@Override
public void createControl(Composite parent) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
import org.junit.runners.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({ PropertyManagerTest.class,
// Bug468PerformanceTest.class
})

@Suite.SuiteClasses({ PropertyManagerTest.class })
public class AllPropertiesTests {
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2017 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -43,11 +43,15 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.tests.resources.WorkspaceTestRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

public class PropertyManagerTest {

Expand Down Expand Up @@ -550,4 +554,39 @@ public void testSimpleUpdate() throws CoreException {
}
}

/**
* Whenever a delete operation is called on an IFile it's properties also
* deleted from .index file. This Test case validates for given IFile resource
* Zero depth is calculated to traverse through folders for loading right index
* file and delete its properties, because the required index file is present
* under corresponding bucket of the folder same as the IFile and no need to
* traverse to Infinite depth.
*/
@Test
public void testFileDeleteTraversalDepth() throws CoreException {
Workspace ws;
PropertyManager2 manager;

ArgumentCaptor<IResource> resourceArgCaptor = ArgumentCaptor.forClass(IResource.class);
ArgumentCaptor<Integer> depthArgCapture = ArgumentCaptor.forClass(Integer.class);

IFolder tempFolder = project.getFolder("temp");
tempFolder.create(true, true, new NullProgressMonitor());

IFile fileToBeDeleted = tempFolder.getFile("testfile" + 0);
fileToBeDeleted.create(createRandomContentsStream(), true, createTestMonitor());
fileToBeDeleted.setPersistentProperty(new QualifiedName(this.getClass().getName(), fileToBeDeleted.getName()),
fileToBeDeleted.getName());

MockitoAnnotations.openMocks(this);
ws = Mockito.spy(new Workspace());
manager = Mockito.spy(new PropertyManager2(ws));

manager.deleteResource(fileToBeDeleted);

Mockito.verify(manager).deleteProperties(resourceArgCaptor.capture(), depthArgCapture.capture());
Integer expectedDepth = 0;
assertEquals(expectedDepth, depthArgCapture.getValue());

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public TestWorkspaceEncodingExistingWorkspace() {
}

public void testExpectedEncoding1() throws Exception {
String defaultValue = System.getProperty("file.encoding");
String defaultValue = System.getProperty("native.encoding");
IWorkspace workspace = ResourcesPlugin.getWorkspace();

// Should be system default
Expand Down
8 changes: 4 additions & 4 deletions runtime/tests/org.eclipse.core.contenttype.tests/test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

<!-- This target defines the tests that need to be run. -->
<target name="suite">
<property name="expressions-folder"
value="${eclipse-home}/expressions_folder"/>
<delete dir="${expressions-folder}" quiet="true"/>
<property name="contenttype-folder"
value="${eclipse-home}/contenttype_folder"/>
<delete dir="${contenttype-folder}" quiet="true"/>
<ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
<property name="data-dir" value="${expressions-folder}"/>
<property name="data-dir" value="${contenttype-folder}"/>
<property name="plugin-name" value="${plugin-name}"/>
<property name="classname"
value="org.eclipse.core.internal.contenttype.tests.AllContenttypeTests"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public void fillCommandLine(List<String> commandLine) {
fillClassPath(commandLine);
fillVMArgs(commandLine);
fillSystemProperties(commandLine);
commandLine.add("org.eclipse.core.launcher.Main");
commandLine.add("org.eclipse.equinox.launcher.Main");
fillEclipseArgs(commandLine);
}

Expand Down
2 changes: 1 addition & 1 deletion ua/org.eclipse.help.base/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Export-Package: org.apache.lucene.demo.html;x-internal:=true,
Require-Bundle: org.eclipse.ant.core;bundle-version="[3.2.200,4.0.0)";resolution:=optional,
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
org.eclipse.help;bundle-version="[3.5.0,4.0.0)";visibility:=reexport,
org.eclipse.core.net;bundle-version="[1.2.200,2.0.0]",
org.eclipse.core.net;bundle-version="[1.2.200,2.0.0)",
org.apache.lucene.analysis-common;bundle-version="[9.4.2,10.0.0)",
org.apache.lucene.core;bundle-version="[9.4.2,10.0.0)",
org.apache.lucene.analysis-smartcn;bundle-version="[9.4.2,10.0.0)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

/**
* Eclipse launcher. Spawns eclipse executable or
* org.eclipse.core.launcher.Main.
* org.eclipse.equinox.launcher.Main.
*/
public class Eclipse extends Thread {
// Eclipse exit codes
Expand Down Expand Up @@ -81,7 +81,7 @@ private void prepareJavaCommand() throws Exception {
}
cmdarray[1 + vmArgs.size()] = "-cp"; //$NON-NLS-1$
cmdarray[2 + vmArgs.size()] = getStartupJar();
cmdarray[3 + vmArgs.size()] = "org.eclipse.core.launcher.Main"; //$NON-NLS-1$
cmdarray[3 + vmArgs.size()] = "org.eclipse.equinox.launcher.Main"; //$NON-NLS-1$
for (int i = 0; i < eclipseArgs.size(); i++) {
cmdarray[4 + vmArgs.size() + i] = eclipseArgs.get(i);
}
Expand Down
2 changes: 1 addition & 1 deletion ua/org.eclipse.help.ui/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: %help_system_plugin_name
Bundle-SymbolicName: org.eclipse.help.ui; singleton:=true
Bundle-Version: 4.6.300.qualifier
Bundle-Version: 4.7.0.qualifier
Bundle-Activator: org.eclipse.help.ui.internal.HelpUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Loading

0 comments on commit 8d23737

Please sign in to comment.