-
Notifications
You must be signed in to change notification settings - Fork 159
Enh/ap 25396 system info collector to collect more than 5 processes #14
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
Closed
bernd-wiswedel
wants to merge
2
commits into
master
from
enh/AP-25396-system-info-collector-to-collect-more-than-5-processes
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
132 changes: 132 additions & 0 deletions
132
...ests/src/org/knime/core/internal/diagnostics/DiagnosticInstructionsSerializationTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| /* | ||
| * ------------------------------------------------------------------------ | ||
| * | ||
| * Copyright by KNIME AG, Zurich, Switzerland | ||
| * Website: http://www.knime.com; Email: [email protected] | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License, Version 3, as | ||
| * published by the Free Software Foundation. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, but | ||
| * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program; if not, see <http://www.gnu.org/licenses>. | ||
| * | ||
| * Additional permission under GNU GPL version 3 section 7: | ||
| * | ||
| * KNIME interoperates with ECLIPSE solely via ECLIPSE's plug-in APIs. | ||
| * Hence, KNIME and ECLIPSE are both independent programs and are not | ||
| * derived from each other. Should, however, the interpretation of the | ||
| * GNU GPL Version 3 ("License") under any applicable laws result in | ||
| * KNIME and ECLIPSE being a combined program, KNIME AG herewith grants | ||
| * you the additional permission to use and propagate KNIME together with | ||
| * ECLIPSE with only the license terms in place for ECLIPSE applying to | ||
| * ECLIPSE and the GNU GPL Version 3 applying for KNIME, provided the | ||
| * license terms of ECLIPSE themselves allow for the respective use and | ||
| * propagation of ECLIPSE together with KNIME. | ||
| * | ||
| * Additional permission relating to nodes for KNIME that extend the Node | ||
| * Extension (and in particular that are based on subclasses of NodeModel, | ||
| * NodeDialog, and NodeView) and that only interoperate with KNIME through | ||
| * standard APIs ("Nodes"): | ||
| * Nodes are deemed to be separate and independent programs and to not be | ||
| * covered works. Notwithstanding anything to the contrary in the | ||
| * License, the License does not apply to Nodes, you are not required to | ||
| * license Nodes under the License, and you are granted a license to | ||
| * prepare and propagate Nodes, in each case even if such Nodes are | ||
| * propagated with or for interoperation with KNIME. The owner of a Node | ||
| * may freely choose the license terms applicable to such Node, including | ||
| * when such Node is propagated with or for interoperation with KNIME. | ||
| * --------------------------------------------------------------------- | ||
| * | ||
| * History | ||
| * Dec 13, 2025 (github-copilot): created | ||
| */ | ||
| package org.knime.core.internal.diagnostics; | ||
|
|
||
| import static org.junit.Assert.assertEquals; | ||
| import static org.junit.Assert.assertNull; | ||
| import static org.junit.Assert.assertTrue; | ||
|
|
||
| import java.nio.file.Path; | ||
|
|
||
| import org.junit.Test; | ||
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import com.fasterxml.jackson.databind.SerializationFeature; | ||
|
|
||
| /** | ||
| * Tests for serialization of {@link DiagnosticInstructions}. | ||
| */ | ||
| public class DiagnosticInstructionsSerializationTest { | ||
|
|
||
| /** | ||
| * Tests serialization of DiagnosticInstructions from JSON. | ||
| * | ||
| * @throws Exception if an error occurs | ||
| */ | ||
| @Test | ||
| public void testSerialization() throws Exception { | ||
| final var objectMapper = new ObjectMapper(); | ||
| objectMapper.enable(SerializationFeature.INDENT_OUTPUT); | ||
| final var defaultsAsString = | ||
| objectMapper.writeValueAsString(DiagnosticInstructions.createDefaults(Path.of("diagnostic-output"))); | ||
|
|
||
| final var json = """ | ||
| { | ||
| "outputDirectory" : "diagnostic-output", | ||
| "heapDump" : null, | ||
| "systemInfo" : true, | ||
| "jvmInfo" : true, | ||
| "gcInfo" : true, | ||
| "applicationHealth" : true, | ||
| "knimeInfo" : true, | ||
| "workflowManagers" : true, | ||
| "threadDump" : true | ||
| } | ||
| """; | ||
|
|
||
| assertEquals("Serialized JSON should match expected", defaultsAsString.trim(), json.trim()); | ||
| } | ||
|
|
||
| /** | ||
| * Tests deserialization of DiagnosticInstructions from JSON. | ||
| * | ||
| * @throws Exception if an error occurs | ||
| */ | ||
| @Test | ||
| public void testDeserialization() throws Exception { | ||
| final var objectMapper = new ObjectMapper(); | ||
|
|
||
| final var json = """ | ||
| { | ||
| "outputDirectory" : "diagnostic-output", | ||
| "heapDump" : null, | ||
| "systemInfo" : false, | ||
| "jvmInfo" : false, | ||
| "gcInfo" : false, | ||
| "applicationHealth" : false, | ||
| "knimeInfo" : false, | ||
| "workflowManagers" : false, | ||
| "threadDump" : false | ||
| } | ||
| """; | ||
|
|
||
| final var instructions = objectMapper.readValue(json, DiagnosticInstructions.class); | ||
|
|
||
| assertEquals("Output directory should match", Path.of("diagnostic-output"), instructions.outputDirectory()); | ||
| assertNull("Heap dump path should be null", instructions.heapDumpPath()); | ||
| assertTrue("System info should be false", !instructions.systemInfo()); | ||
| assertTrue("JVM info should be false", !instructions.jvmInfo()); | ||
| assertTrue("GC info should be false", !instructions.gcInfo()); | ||
| assertTrue("Application health should be false", !instructions.applicationHealth()); | ||
| assertTrue("KNIME info should be false", !instructions.knimeInfo()); | ||
| assertTrue("Workflow managers should be false", !instructions.workflowManagers()); | ||
| assertTrue("Thread dump should be false", !instructions.threadDump()); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Use assertFalse instead of assertTrue with negation (!). This makes the test assertions clearer and produces more helpful failure messages. For example, replace
assertTrue(\"System info should be false\", !instructions.systemInfo())withassertFalse(\"System info should be false\", instructions.systemInfo()).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.
@copilot add a new commit to this branch implementing this feedback