Skip to content

Commit

Permalink
Merge pull request #6685 from apache/delivery
Browse files Browse the repository at this point in the history
Sync delivery to release200 for 20-rc4
  • Loading branch information
neilcsmith-net authored Nov 14, 2023
2 parents cbc39f8 + ff57190 commit 91f9ed8
Show file tree
Hide file tree
Showing 24 changed files with 317 additions and 107 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ jobs:
- name: ide/libs.freemarker
run: ant $OPTS -f ide/libs.freemarker test

# - name: ide/libs.git
# run: ant $OPTS -f ide/libs.git test
- name: ide/libs.git
run: ant $OPTS -f ide/libs.git test

- name: ide/libs.graalsdk
run: ant $OPTS -f ide/libs.graalsdk test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ group = "com.example"

repositories {
mavenCentral()
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
micronautVersion=3.10.1
micronautVersion=3.10.2
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ group = "com.example"

repositories {
mavenCentral()
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
package org.netbeans.modules.micronaut.gradle;

import java.io.File;
import java.util.Set;
import java.util.stream.Collectors;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
import org.netbeans.api.project.Project;
import org.netbeans.api.project.ProjectActionContext;
import org.netbeans.api.project.ProjectManager;
import org.netbeans.junit.NbTestCase;
import org.netbeans.modules.gradle.NbGradleProjectImpl;
import org.netbeans.modules.gradle.ProjectTrust;
import org.netbeans.modules.gradle.api.GradleReport;
import org.netbeans.modules.gradle.api.NbGradleProject;
import org.netbeans.modules.project.dependency.ArtifactSpec;
import org.netbeans.modules.project.dependency.ProjectArtifactsQuery;
Expand All @@ -40,6 +44,14 @@
*/
public class MicronautGradleArtifactsImplTest extends NbTestCase {

static {
// TODO remove ASAP from MicronautGradleArtifactsImplTest and ProjectViewTest
// investigate "javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure"
// during gradle download "at org.netbeans.modules.gradle.spi.newproject.TemplateOperation$InitStep.execute(TemplateOperation.java:317)"
// this looks like a misconfigured webserver to me
System.setProperty("https.protocols", "TLSv1.2");
}

public MicronautGradleArtifactsImplTest(String name) {
super(name);
}
Expand All @@ -51,8 +63,7 @@ private static File getTestNBDestDir() throws Exception {
return new File(destDir);
}

FileObject d;
FileObject dataFO;
private FileObject dataFO;

@org.openide.util.lookup.ServiceProvider(service=org.openide.modules.InstalledFileLocator.class, position = 1000)
public static class InstalledFileLocator extends DummyInstalledFileLocator {
Expand All @@ -66,7 +77,6 @@ public static class InstalledFileLocator extends DummyInstalledFileLocator {
// it back to System.err - loop is formed. Initialize IOProvider first, it gets
// the real System.err/out references.
IOProvider p = IOProvider.getDefault();
d = FileUtil.toFileObject(getWorkDir());
System.setProperty("test.reload.sync", "true");
dataFO = FileUtil.toFileObject(getDataDir());

Expand All @@ -83,7 +93,9 @@ public void testProjectArtifactWithNormalQuery() throws Exception {

Project p = ProjectManager.getDefault().findProject(prjCopy);
ProjectTrust.getDefault().trustProject(p);

NbGradleProject.get(p).toQuality("Test", NbGradleProject.Quality.FULL, true).toCompletableFuture().get();
assertNoProblems(p);
ProjectArtifactsQuery.ArtifactsResult ar = ProjectArtifactsQuery.findArtifacts(p, ProjectArtifactsQuery.newQuery(null));

assertNotNull(ar);
Expand All @@ -100,7 +112,9 @@ public void testNativeOutputInRegularBuild() throws Exception {

Project p = ProjectManager.getDefault().findProject(prjCopy);
ProjectTrust.getDefault().trustProject(p);

NbGradleProject.get(p).toQuality("Test", NbGradleProject.Quality.FULL, true).toCompletableFuture().get();
assertNoProblems(p);
ProjectArtifactsQuery.ArtifactsResult ar = ProjectArtifactsQuery.findArtifacts(p, ProjectArtifactsQuery.newQuery("exe"));

assertNotNull(ar);
Expand All @@ -115,7 +129,9 @@ public void testNativeCompileDefaultOutput() throws Exception {

Project p = ProjectManager.getDefault().findProject(prjCopy);
ProjectTrust.getDefault().trustProject(p);

NbGradleProject.get(p).toQuality("Test", NbGradleProject.Quality.FULL, true).toCompletableFuture().get();
assertNoProblems(p);
ProjectArtifactsQuery.ArtifactsResult ar = ProjectArtifactsQuery.findArtifacts(p,
ProjectArtifactsQuery.newQuery(null, null,
ProjectActionContext.newBuilder(p).forProjectAction("native-build").context()
Expand All @@ -136,7 +152,9 @@ public void testDefaultNativeCompilationOutput() throws Exception {

Project p = ProjectManager.getDefault().findProject(prjCopy);
ProjectTrust.getDefault().trustProject(p);

NbGradleProject.get(p).toQuality("Test", NbGradleProject.Quality.FULL, true).toCompletableFuture().get();
assertNoProblems(p);
ProjectArtifactsQuery.ArtifactsResult ar = ProjectArtifactsQuery.findArtifacts(p,
ProjectArtifactsQuery.newQuery(null, null,
ProjectActionContext.newBuilder(p).forProjectAction("native-build").context()
Expand All @@ -157,7 +175,9 @@ public void testJarInNativeCompilation() throws Exception {

Project p = ProjectManager.getDefault().findProject(prjCopy);
ProjectTrust.getDefault().trustProject(p);
NbGradleProject.get(p).toQuality("TEst", NbGradleProject.Quality.FULL, true).toCompletableFuture().get();

NbGradleProject.get(p).toQuality("Test", NbGradleProject.Quality.FULL, true).toCompletableFuture().get();
assertNoProblems(p);
ProjectArtifactsQuery.ArtifactsResult ar = ProjectArtifactsQuery.findArtifacts(p,
ProjectArtifactsQuery.newQuery("jar", null,
ProjectActionContext.newBuilder(p).forProjectAction("native-build").context()
Expand All @@ -178,7 +198,9 @@ public void testNativeOutputInNativeBuild() throws Exception {

Project p = ProjectManager.getDefault().findProject(prjCopy);
ProjectTrust.getDefault().trustProject(p);

NbGradleProject.get(p).toQuality("Test", NbGradleProject.Quality.FULL, true).toCompletableFuture().get();
assertNoProblems(p);
ProjectArtifactsQuery.ArtifactsResult ar = ProjectArtifactsQuery.findArtifacts(p,
ProjectArtifactsQuery.newQuery("exe", null,
ProjectActionContext.newBuilder(p).forProjectAction("native-build").context()
Expand All @@ -203,6 +225,7 @@ public void testSubprojectJarOutput() throws Exception {
ProjectTrust.getDefault().trustProject(p);

NbGradleProject.get(p).toQuality("Test", NbGradleProject.Quality.FULL, true).toCompletableFuture().get();
assertNoProblems(p);
ProjectArtifactsQuery.ArtifactsResult ar = ProjectArtifactsQuery.findArtifacts(p, ProjectArtifactsQuery.newQuery(null));

assertNotNull(ar);
Expand All @@ -223,6 +246,7 @@ public void testSubprojectShadowOutput() throws Exception {
ProjectTrust.getDefault().trustProject(p);

NbGradleProject.get(p).toQuality("Test", NbGradleProject.Quality.FULL, true).toCompletableFuture().get();
assertNoProblems(p);
ProjectArtifactsQuery.ArtifactsResult ar = ProjectArtifactsQuery.findArtifacts(p,
ProjectArtifactsQuery.newQuery(null, null, null, ArtifactSpec.TAG_SHADED)
);
Expand All @@ -242,7 +266,9 @@ public void testNativeOutputInSubprojectNativeBuild() throws Exception {

Project p = ProjectManager.getDefault().findProject(prjCopy.getFileObject("oci"));
ProjectTrust.getDefault().trustProject(p);

NbGradleProject.get(p).toQuality("Test", NbGradleProject.Quality.FULL, true).toCompletableFuture().get();
assertNoProblems(p);
ProjectArtifactsQuery.ArtifactsResult ar = ProjectArtifactsQuery.findArtifacts(p,
ProjectArtifactsQuery.newQuery("exe", null,
ProjectActionContext.newBuilder(p).forProjectAction("native-build").context()
Expand All @@ -254,5 +280,18 @@ public void testNativeOutputInSubprojectNativeBuild() throws Exception {
ArtifactSpec spec = ar.getArtifacts().get(0);
assertEquals("exe", spec.getType());
}

private static void assertNoProblems(Project project) {
assertNotNull(project);
Set<GradleReport> problems = ((NbGradleProjectImpl)project).getGradleProject().getBaseProject().getProblems();
assertTrue(
problems.size()+" problem(s) found>>>\n"+
problems.stream()
.map(p -> p.toString())
.collect(Collectors.joining("\n"))
+"\n<<<end of problems",
problems.isEmpty()
);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.netbeans.modules.gradle.api.NbGradleProject.Quality;
import org.openide.loaders.DataFolder;
import org.openide.loaders.DataObject;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;

/**
Expand Down Expand Up @@ -315,8 +316,7 @@ public Set<FileObject> execute() {

pconn.newBuild().withArguments("--offline").forTasks(args.toArray(new String[0])).run(); //NOI18N
} catch (GradleConnectionException | IllegalStateException ex) {
// Well for some reason we were not able to load Gradle.
// Ignoring that for now
Exceptions.printStackTrace(ex);
}
gconn.disconnect();
return Collections.singleton(FileUtil.toFileObject(target));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@
public class CreateBranchAction extends SingleRepositoryAction {

private static final Logger LOG = Logger.getLogger(CreateBranchAction.class.getName());
private static final String ICON_RESOURCE = "org/netbeans/modules/git/resources/icons/branch.png"; //NOI18N

public CreateBranchAction() {
super(ICON_RESOURCE);
}

@Override
protected String iconResource() {
return ICON_RESOURCE;
}

@Override
protected void performAction (File repository, File[] roots, VCSContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@
@ActionRegistration(displayName = "#LBL_SwitchBranchAction_Name")
public class SwitchBranchAction extends AbstractCheckoutAction {

private static final String ICON_RESOURCE = "org/netbeans/modules/git/resources/icons/active_branch.png"; //NOI18N

public SwitchBranchAction() {
super(ICON_RESOURCE);
}

@Override
protected String iconResource() {
return ICON_RESOURCE;
}

@Override
protected void performAction (File repository, File[] roots, VCSContext context) {
RepositoryInfo info = RepositoryInfo.getInstance(repository);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ private static void setTestMethodsImpl(StyledDocument doc, List<TestMethod> meth
doc.putProperty(TestMethodAnnotation.DOCUMENT_ANNOTATION_LINES_KEY, annotationLines);
}

Map<TestMethod, TestMethodAnnotation> removed = new HashMap<>(annotations);

methods.forEach(tm -> removed.remove(tm));

Set<TestMethod> added = new HashSet<>(methods);
Map<TestMethod, TestMethodAnnotation> removed = new HashMap<>(annotations);

removed.keySet().removeAll(added);
added.removeAll(annotations.keySet());

for (TestMethod method : added) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.List;
import java.util.MissingResourceException;
import javax.swing.Action;
import javax.swing.UIManager;
import org.netbeans.modules.gsf.testrunner.api.OutputLine;
import org.netbeans.modules.gsf.testrunner.api.Report;
import org.netbeans.modules.gsf.testrunner.api.Status;
Expand All @@ -47,20 +46,22 @@ public class TestsuiteNode extends AbstractNode {
* The max number of output lines to display in the tooltip.
*/
static final int MAX_TOOLTIP_LINES = Integer.getInteger("testrunner.max.tooltip.lines", 4); //NOI18N

/**
* The max line length to display in the tooltip.
*/
private static final int MAX_TOOLTIP_LINE_LENGTH = Integer.getInteger("testrunner.max.tooltip.line.length", 80); //NOI18N

/**
* The system property for enabling/disabling tooltips.
*/
static final boolean DISPLAY_TOOLTIPS = Boolean.valueOf(System.getProperty("testrunner.display.tooltips", "true"));//NOI18N
static final boolean DISPLAY_TOOLTIPS = Boolean.parseBoolean(System.getProperty("testrunner.display.tooltips", "true"));//NOI18N

/**
* The max line length to display in the messages.
*
* By default, the max line length for the messages in the Test Results
* window will be set to 120 for the GTK look and feel or JDK8, and won't be limited
* for other look and feels or JDKs. For any look and feel or JDK a user can change the
* window will be set to 250. A user can change the
* default setting via the system property
* {@code testrunner.max.msg.line.length=MAX_LINE_LENGTH},
* where {@code MAX_LINE_LENGTH} is a desired value.
Expand All @@ -69,9 +70,7 @@ public class TestsuiteNode extends AbstractNode {
* See Issue #175430
* See Issue #188632
*/
static final int MAX_MSG_LINE_LENGTH =
Integer.getInteger("testrunner.max.msg.line.length", //NOI18N
isGTK() || isJDK8() ? 120 : Integer.MAX_VALUE);
static final int MAX_MSG_LINE_LENGTH = Integer.getInteger("testrunner.max.msg.line.length", 250);

protected String suiteName;
protected TestSuite suite;
Expand Down Expand Up @@ -207,7 +206,7 @@ public Image getIcon(int type) {
public void displayReport(final Report report) {
assert (report != null);
assert report.getSuiteClassName().equals(this.suiteName)
|| (this.suiteName == TestSuite.ANONYMOUS_SUITE);
|| TestSuite.ANONYMOUS_SUITE.equals(this.suiteName);

this.report = report;
suiteName = report.getSuiteClassName();
Expand Down Expand Up @@ -274,7 +273,7 @@ public String getHtmlDisplayName() {
assert suiteName != null;

StringBuilder buf = new StringBuilder(60);
if (suiteName != TestSuite.ANONYMOUS_SUITE) {
if (!TestSuite.ANONYMOUS_SUITE.equals(suiteName)) {
buf.append(suiteName);
} else {
buf.append(Bundle.MSG_TestsuiteNoname());
Expand Down Expand Up @@ -304,7 +303,7 @@ public String getHtmlDisplayName() {
"MSG_TestsuiteAborted_HTML=Aborted",
"MSG_TestsuiteSkipped_HTML=Skipped"})
static String suiteStatusToMsg(Status status, boolean html) {
String result = null;
String result;
if(Status.ABORTED == status){
result = html ? Bundle.MSG_TestsuiteAborted_HTML() : Bundle.MSG_TestsuiteAborted("");
} else if (Status.ERROR == status || Status.FAILED == status) {
Expand Down Expand Up @@ -369,7 +368,7 @@ public Action[] getActions(boolean context) {
}

private List<OutputLine> getOutput() {
List<OutputLine> result = new ArrayList<OutputLine>();
List<OutputLine> result = new ArrayList<>();
for (Testcase testcase : report.getTests()) {
result.addAll(testcase.getOutput());
}
Expand Down Expand Up @@ -414,25 +413,4 @@ public static String cutLine(String line, int maxLength, boolean isHTML)
return line;
}


/**
* Checks whether a currently used look and feel is GTK.
*
* @return {@code true} if a currently used look and feel has got the
* identifier "GTK", otherwise {@code true}.
*/
private static boolean isGTK() {
return "GTK".equals(UIManager.getLookAndFeel().getID());
}

/**
* Checks whether the currently used JDK version is 1.8.x_xx
*
* @return {@code true} if the currently used JDK version is 8, otherwise {@code false}.
*/
private static boolean isJDK8() {
final String javaVersion = System.getProperty("java.version"); //NOI18N
return javaVersion != null && javaVersion.startsWith("1.8"); //NOI18N
}

}
Loading

0 comments on commit 91f9ed8

Please sign in to comment.