-
Notifications
You must be signed in to change notification settings - Fork 9
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
Migrate to JUnit 5 - Jenkins #51 #589
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
* Tasktop Technologies - improvements | ||
* Eike Stepper - improvements for bug 323759 | ||
* Benjamin Muskalla - 323920: [build] config retrival fails for jobs with whitespaces | ||
* See git histpry | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. history |
||
*******************************************************************************/ | ||
|
||
package org.eclipse.mylyn.internal.jenkins.core.client; | ||
|
@@ -470,18 +471,11 @@ public JenkinsServerInfo execute() throws IOException, JenkinsException, JAXBExc | |
protected JenkinsServerInfo doProcess(CommonHttpResponse response, IOperationMonitor monitor) | ||
throws IOException, JenkinsException, JAXBException { | ||
Header header = response.getResponse().getFirstHeader("X-Jenkins"); //$NON-NLS-1$ | ||
Type type; | ||
if (header == null) { | ||
type = Type.HUDSON; | ||
header = response.getResponse().getFirstHeader("X-Hudson"); //$NON-NLS-1$ | ||
if (header == null) { | ||
throw new JenkinsException(NLS.bind("{0} does not appear to be a Hudson or Jenkins instance", //$NON-NLS-1$ | ||
baseUrl())); | ||
} | ||
} else { | ||
type = Type.JENKINS; | ||
throw new JenkinsException(NLS.bind("{0} does not appear to be a Jenkins instance", //$NON-NLS-1$ | ||
baseUrl())); | ||
} | ||
JenkinsServerInfo info = new JenkinsServerInfo(type, header.getValue()); | ||
JenkinsServerInfo info = new JenkinsServerInfo(Type.JENKINS, header.getValue()); | ||
return info; | ||
} | ||
}.run(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,11 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0", | |
org.eclipse.search;bundle-version="0.0.0", | ||
org.eclipse.ui;bundle-version="0.0.0", | ||
org.eclipse.ui.workbench.texteditor;bundle-version="0.0.0", | ||
org.junit;bundle-version="4.8.2" | ||
junit-jupiter-api;bundle-version="5.10.3", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would recommend to prefer "Import-Package" for 3rd party libs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I tried "importing" and had to add the libraries to the .target file with older versions. So I don't know what is the best solution? I'm still trying to figure out how all this works. |
||
junit-platform-suite-api;bundle-version="1.10.3", | ||
junit-platform-suite-engine;bundle-version="1.10.3", | ||
junit-platform-suite-commons;bundle-version="1.10.3", | ||
org.hamcrest;bundle-version="2.2.0" | ||
Bundle-RequiredExecutionEnvironment: JavaSE-17 | ||
Bundle-Vendor: Eclipse Mylyn | ||
Export-Package: org.eclipse.mylyn.jenkins.tests;x-internal:=true, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 George Lindholm | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html. | ||
* | ||
* Contributors: | ||
* See git history | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.mylyn.jenkins.tests; | ||
|
||
import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil; | ||
import org.eclipse.mylyn.commons.sdk.util.ManagedSuite; | ||
import org.eclipse.mylyn.commons.sdk.util.TestConfiguration; | ||
import org.eclipse.mylyn.jenkins.tests.support.JenkinsFixture; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SuiteSetup { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need instead a JUnit 5 Extensions or some other new feature so that we can support multible fixtures |
||
private static boolean notLocalOnly = false; | ||
|
||
private static boolean useCertificateAuthentication = false; | ||
|
||
private static boolean fixtureActive = false; | ||
|
||
static { | ||
if (CommonTestUtil.fixProxyConfiguration()) { | ||
CommonTestUtil.dumpSystemInfo(System.err); | ||
} | ||
TestConfiguration configuration = ManagedSuite.getTestConfigurationOrCreateDefault(); | ||
|
||
if (!configuration.isLocalOnly()) { | ||
// network tests | ||
notLocalOnly = true; | ||
for (JenkinsFixture fixture : configuration.discover(JenkinsFixture.class, "jenkins")) { //$NON-NLS-1$ | ||
if (fixture.isExcluded() | ||
|| fixture.isUseCertificateAuthentication() && CommonTestUtil.isCertificateAuthBroken()) { | ||
continue; | ||
} | ||
fixtureActive = true; | ||
useCertificateAuthentication = !fixture.isUseCertificateAuthentication(); | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
public void dummyTest() { | ||
// This is a dummy test to ensure the setup method is run | ||
} | ||
|
||
public static boolean isNotLocalOnly() { | ||
return notLocalOnly; | ||
} | ||
|
||
public static boolean isUseCertificateAuthentication() { | ||
return useCertificateAuthentication; | ||
} | ||
|
||
public static boolean isFixtureActive() { | ||
return fixtureActive; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
history
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D'oh!