-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix/63 array merge #71
Merged
SebastianBezold
merged 4 commits into
eclipse-tractusx:main
from
catenax-ng:fix/63-ArrayMerge
Jan 30, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
84e946b
fix: KA-389: Remoting Agent: Merging of Arrays does not always work a…
Martin0815bla 38e0a05
fix/63-ArrayMerge
Martin0815bla f872378
fix: preventing IllegalArbumentException when starting rdf4j server
Martin0815bla 6f6c94b
fix: preventing IllegalArbumentException when starting rdf4j server (…
Martin0815bla 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
This file contains 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 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
45 changes: 45 additions & 0 deletions
45
remoting/src/test/java/org/eclipse/tractusx/agents/remoting/MergeObjectNodesTest.java
This file contains 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,45 @@ | ||
package org.eclipse.tractusx.agents.remoting; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
|
||
public class MergeObjectNodesTest { | ||
|
||
private final ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
@Test | ||
public void testMerge() throws Exception { | ||
|
||
// Load input resources | ||
JsonNode input1 = loadJsonResource("MergeObjectNodesIn1.json"); | ||
JsonNode input2 = loadJsonResource("MergeObjectNodesIn2.json"); | ||
|
||
// Load expected result resource | ||
JsonNode expectedResult = loadJsonResource("MergeObjectNodesResult.json"); | ||
|
||
// Invoke merge method with the input resources | ||
input1 = Invocation.mergeObjectNodes((ObjectNode)input1, (ObjectNode)input2); | ||
|
||
// Assert the result against the expected result | ||
assertEquals(expectedResult, input1); | ||
} | ||
|
||
private JsonNode loadJsonResource(String resourceName) throws IOException { | ||
// Use the class loader to load the resource | ||
ClassLoader classLoader = getClass().getClassLoader(); | ||
try (InputStream inputStream = classLoader.getResourceAsStream(resourceName)) { | ||
|
||
// Parse JSON content into ObjectNode | ||
return objectMapper.readTree(inputStream); | ||
} | ||
} | ||
|
||
} |
This file contains 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,83 @@ | ||
{ | ||
"Koepfchen in das Wasser":"Schwänzchen in die Höh", | ||
"content":{ | ||
"endurancePredictorInputs":[ | ||
{ | ||
"alle":"meine Entchen", | ||
"classifiedLoadSpectrumGearSet":{ | ||
"schwimmen":"auf dem See", | ||
"metadata":{ | ||
"projectDescription":"pnr_76543", | ||
"routeDescription":"logged", | ||
"status":{ | ||
"mileage":865432, | ||
"operatingHours":32137.9, | ||
"date":"2023-02-28T01:27:20.020Z" | ||
}, | ||
"componentDescription":"GearSet" | ||
}, | ||
"bammId":"urn:bamm:io.openmanufacturing.digitaltwin:1.0.0#ClassifiedLoadSpectrum", | ||
"targetComponentId":"urn:uuid:2", | ||
"header":{ | ||
"countingMethod":"TimeAtLevel", | ||
"countingValue":"Time", | ||
"channels":[ | ||
{ | ||
"channelName":"TC_SU", | ||
"unit":"unit:degreeCelsius", | ||
"lowerLimit":0, | ||
"upperLimit":640, | ||
"numberOfBins":128 | ||
} | ||
], | ||
"countingUnit":"unit:secondUnitOfTime" | ||
}, | ||
"body":{ | ||
"counts":{ | ||
"countsName":"Time", | ||
"countsList":[ | ||
34968.93, | ||
739782.51, | ||
4013185.15, | ||
4.675505556E7, | ||
2.526895835E7, | ||
8649735.95, | ||
9383635.35, | ||
1.918926077E7, | ||
1353867.54 | ||
] | ||
}, | ||
"classes":[ | ||
{ | ||
"className":"TC_SU-class", | ||
"classList":[ | ||
14, | ||
15, | ||
16, | ||
17, | ||
18, | ||
19, | ||
20, | ||
21, | ||
22 | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"componentId":"urn:uuid:2" | ||
} | ||
] | ||
}, | ||
"header":{ | ||
"classification":"RemainingUsefulLifePredictor", | ||
"targetDate":"2042-04-06T05:53:40.040Z", | ||
"timeStamp":"2022-12-03T02:09:20.020Z", | ||
"senderBPN":"bpn:legal:BPNLOEM", | ||
"severity":"MINOR", | ||
"recipientBPN":"bpn:legal:BPNLSUPPLIER", | ||
"senderAddress":"edc://sender", | ||
"status":"SENT", | ||
"recipientAddress":"edc://recipient" | ||
} | ||
} |
This file contains 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,31 @@ | ||
{ | ||
"Koepfchen in das Wasser":"Schwänzchen in die Höh", | ||
"content":{ | ||
"endurancePredictorInputs":[ | ||
{ | ||
"alle":"meine Entchen", | ||
"classifiedLoadSpectrumGearSet":{ | ||
"schwimmen":"auf dem See", | ||
"body":{ | ||
"counts":{ | ||
"countsName":"Time", | ||
"countsList": [ | ||
4711.0815, | ||
739782.51, | ||
4013185.15, | ||
4.675505556E7, | ||
2.526895835E7, | ||
8649735.95, | ||
9383635.35, | ||
1.918926077E7, | ||
1353867.54, | ||
123.456 | ||
] | ||
} | ||
} | ||
} | ||
|
||
} | ||
] | ||
} | ||
} |
This file contains 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,84 @@ | ||
{ | ||
"Koepfchen in das Wasser":"Schwänzchen in die Höh", | ||
"content":{ | ||
"endurancePredictorInputs":[ | ||
{ | ||
"alle":"meine Entchen", | ||
"classifiedLoadSpectrumGearSet":{ | ||
"schwimmen":"auf dem See", | ||
"metadata":{ | ||
"projectDescription":"pnr_76543", | ||
"routeDescription":"logged", | ||
"status":{ | ||
"mileage":865432, | ||
"operatingHours":32137.9, | ||
"date":"2023-02-28T01:27:20.020Z" | ||
}, | ||
"componentDescription":"GearSet" | ||
}, | ||
"bammId":"urn:bamm:io.openmanufacturing.digitaltwin:1.0.0#ClassifiedLoadSpectrum", | ||
"targetComponentId":"urn:uuid:2", | ||
"header":{ | ||
"countingMethod":"TimeAtLevel", | ||
"countingValue":"Time", | ||
"channels":[ | ||
{ | ||
"channelName":"TC_SU", | ||
"unit":"unit:degreeCelsius", | ||
"lowerLimit":0, | ||
"upperLimit":640, | ||
"numberOfBins":128 | ||
} | ||
], | ||
"countingUnit":"unit:secondUnitOfTime" | ||
}, | ||
"body":{ | ||
"counts":{ | ||
"countsName":"Time", | ||
"countsList":[ | ||
4711.0815, | ||
739782.51, | ||
4013185.15, | ||
4.675505556E7, | ||
2.526895835E7, | ||
8649735.95, | ||
9383635.35, | ||
1.918926077E7, | ||
1353867.54, | ||
123.456 | ||
] | ||
}, | ||
"classes":[ | ||
{ | ||
"className":"TC_SU-class", | ||
"classList":[ | ||
14, | ||
15, | ||
16, | ||
17, | ||
18, | ||
19, | ||
20, | ||
21, | ||
22 | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"componentId":"urn:uuid:2" | ||
} | ||
] | ||
}, | ||
"header":{ | ||
"classification":"RemainingUsefulLifePredictor", | ||
"targetDate":"2042-04-06T05:53:40.040Z", | ||
"timeStamp":"2022-12-03T02:09:20.020Z", | ||
"senderBPN":"bpn:legal:BPNLOEM", | ||
"severity":"MINOR", | ||
"recipientBPN":"bpn:legal:BPNLSUPPLIER", | ||
"senderAddress":"edc://sender", | ||
"status":"SENT", | ||
"recipientAddress":"edc://recipient" | ||
} | ||
} |
Oops, something went wrong.
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.
That XML warning never occured to me. Seems to be an eclipse IDE issue. But does not harm