blob: 799d683309b6097f088f7d13d2085c20fe9c3d04 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005, 2009 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.tests.markers;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.tests.navigator.AbstractNavigatorTest;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
@Ignore
public class ResourceMappingMarkersTest extends AbstractNavigatorTest {
/**
* Create an instance of the receiver.
*
* @param testName
*/
public ResourceMappingMarkersTest() {
super(ResourceMappingMarkersTest.class.getSimpleName());
}
/**
* Set up the receiver.
*
* @throws Exception
*/
@Override
protected void doSetUp() throws Exception {
super.doSetUp();
createTestFile();
}
@Test
public void testResourceMappings() {
IWorkbenchWindow window = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
ResourceMappingTestView view;
try {
view = (ResourceMappingTestView) page
.showView("org.eclipse.ui.tests.resourceMappingView");
} catch (PartInitException e) {
assertTrue(e.getLocalizedMessage(), false);
return;
}
final MarkersTestMarkersView problemView;
try {
problemView = (MarkersTestMarkersView) page
.showView("org.eclipse.ui.tests.markerTests");
} catch (PartInitException e) {
assertTrue(e.getLocalizedMessage(), false);
return;
}
IMarker marker=view.addMarkerToFirstProject();
assertNotNull("Marker creation failed", marker);
try {
Job.getJobManager().join(
problemView.MARKERSVIEW_UPDATE_JOB_FAMILY,
new NullProgressMonitor());
} catch (OperationCanceledException | InterruptedException e) {
}
IMarker[] markers=problemView.getCurrentMarkers();
boolean markerFound = false;
for (IMarker marker2 : markers) {
if(marker2.equals(marker)){
markerFound = true;
break;
}
}
assertTrue("No markers generated",markerFound);
}
}