Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JBIDE-14977 - JBoss Central tests fail #133

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bin/
cache/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is "cache" ? should it be in target/cache instead ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache directory is created during running tests in the test-resources directory.
That isn't related to this jira.

target/
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.central.internal.ImageUtil;
import org.jboss.tools.central.internal.discovery.wizards.ProxyWizardManager.ProxyWizardManagerListener;
import org.jboss.tools.central.internal.discovery.wizards.ProxyWizardManager.UpdateEvent;
Expand All @@ -39,7 +40,7 @@

public class ProxyWizardManagerTest extends AbstractProxyWizardDiscoveryTest implements ProxyWizardManagerListener {

private static final long MAX_WAIT_TIME = 10*1000;
private static final long MAX_WAIT_TIME = 60*1000;
private ProxyWizardManager pwm;
private NullProgressMonitor monitor;
private List<ProxyWizard> remoteWizards;
Expand Down Expand Up @@ -124,14 +125,28 @@ private void waitForDownload(long limit) {
boolean timeout = (System.currentTimeMillis() - start ) > limit;
assertFalse("Timeout while waiting for completion of job: " + job, timeout);
job.wakeUp();
try {
Thread.sleep(100);
} catch(InterruptedException e) {
// ignore and keep waiting
}
delay(100);
}
}

public static void delay(long waitTimeMillis) {
Display display = Display.getCurrent();
if(PlatformUI.isWorkbenchRunning() && display!= null) {
long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
while (System.currentTimeMillis() < endTimeMillis) {
if (!display.readAndDispatch())
display.sleep();
}
display.update();
} else { // Otherwise, perform a simple sleep.
try {
Thread.sleep(waitTimeMillis);
} catch (InterruptedException e) {
// Ignored.
}
}
}

private Job getProxyWizardUpdateJob() {
Job[] jobs = Job.getJobManager().find(null);
for(int i = 0; i < jobs.length; i++ ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,16 @@ private void testActionInNonUIThread(IFile file) {
CheatSheetView view = null;
try {
if (!file.exists()) {
createCheatSheet(file);
IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
String oldValue = ProjectExamplesActivator.getDefault().getShowCheatsheets();
try {
store.putValue(ProjectExamplesActivator.SHOW_CHEATSHEETS,
ProjectExamplesActivator.SHOW_CHEATSHEETS_NEVER);
createCheatSheet(file);
} finally {
store.putValue(ProjectExamplesActivator.SHOW_CHEATSHEETS,
oldValue);
}
delete = true;
}
view = openCheatSheet(file);
Expand Down