Skip to content

Commit

Permalink
1. Added UML diagram
Browse files Browse the repository at this point in the history
2. renamed javacontainer_ctpg_test.cc => javacontainer_extractor_v2_test.cc
3. Moved test `basic_jars_ordering` to javacontainer_test.cc
  • Loading branch information
tomuben committed Oct 25, 2024
1 parent e30b172 commit afa0797
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 17 deletions.
2 changes: 1 addition & 1 deletion exaudfclient/base/javacontainer/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cc_test(

cc_test(
name = "javacontainer-test-ctpg-parser",
srcs = JAVACONTAINER_TEST_SRCS + ["cpp/javacontainer_ctpg_test.cc"],
srcs = JAVACONTAINER_TEST_SRCS + ["cpp/javacontainer_extractor_v2_test.cc"],
deps = [
"//base/javacontainer:javacontainer",
"@googletest//:gtest_main",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,3 @@ TEST(JavaContainer, import_script_with_escaped_options) {
"-XX:+UseSerialGC" };
EXPECT_EQ(vm.getJavaVMInternalStatus().m_jvmOptions, expectedJVMOptions);
}

TEST(JavaContainer, basic_jars_order_remains) {
const std::string script_code = "%jar base/javacontainer/test/test1.jar:base/javacontainer/test/abc.jar;";

EXPECT_THROW({
try
{
JavaVMTest vm(script_code);
}
catch( const SWIGVMContainers::JavaVMach::exception& e )
{
EXPECT_THAT( e.what(), MatchesRegex("^.*Java VM cannot find 'base/javacontainer/test/test1\\.jar': No such file or directory$"));
throw;
}
}, SWIGVMContainers::JavaVMach::exception );
}
29 changes: 29 additions & 0 deletions exaudfclient/base/javacontainer/test/cpp/javacontainer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,35 @@ TEST(JavaContainer, basic_jar_with_white_spaces) {
#endif
}

TEST(JavaContainer, basic_jars_ordering) {
/*
* This test validates correct behavior of collecting the %jar options in Extractor V1/V2.
* Both jar files referenced in `script_code` do not exist.
* The JavaVM will throw an exception with the first JAR file it gets from Extractor.
* For extractor V21 Our assumption is that the exception will be for `base/javacontainer/test/abc.jar`
* as this is alphabetically the first JAR file. (re-ordering)
* For extractor V2: Our assumption is that the exception will be for `base/javacontainer/test/test1.jar`
* as this is the first JAR file. (no re-ordering)
*/
const std::string script_code = "%jar base/javacontainer/test/test1.jar:base/javacontainer/test/abc.jar;";

#ifndef USE_CTPG_PARSER
const char* regexExpectedException = "^.*Java VM cannot find 'base/javacontainer/test/abc\\.jar': No such file or directory$";
#else
const char* regexExpectedException = "^.*Java VM cannot find 'base/javacontainer/test/test1\\.jar': No such file or directory$";
#endif
EXPECT_THROW({
try
{
JavaVMTest vm(script_code);
}
catch( const SWIGVMContainers::JavaVMach::exception& e )
{
EXPECT_THAT( e.what(), MatchesRegex("^.*Java VM cannot find 'base/javacontainer/test/test1\\.jar': No such file or directory$"));
throw;
}
}, SWIGVMContainers::JavaVMach::exception );
}

TEST(JavaContainer, basic_inline) {
const std::string script_code = "import java.time.LocalDateTime;"
Expand Down
147 changes: 147 additions & 0 deletions exaudfclient/docs/java_script_options_parser.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.7.17 Chrome/128.0.6613.36 Electron/32.0.1 Safari/537.36" version="24.7.17">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="1941" dy="1027" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="zkfFHV4jXpPFQw0GAbJ--0" value="Extractor" style="swimlane;fontStyle=2;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeLast=0;collapsible=1;marginBottom=0;rounded=0;shadow=0;strokeWidth=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="220" y="114" width="160" height="138" as="geometry">
<mxRectangle x="230" y="140" width="160" height="26" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--4" value="" style="line;html=1;strokeWidth=1;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;" parent="zkfFHV4jXpPFQw0GAbJ--0" vertex="1">
<mxGeometry y="26" width="160" height="8" as="geometry" />
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--5" value="extract" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="zkfFHV4jXpPFQw0GAbJ--0" vertex="1">
<mxGeometry y="34" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;startArrow=diamond;startFill=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="zkfFHV4jXpPFQw0GAbJ--6" target="cAzvCynLCVfaQQ1azyM7-2">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--6" value="tExtractorLegacy" style="swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeLast=0;collapsible=1;marginBottom=0;rounded=0;shadow=0;strokeWidth=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="-10" y="370" width="160" height="138" as="geometry">
<mxRectangle x="130" y="380" width="160" height="26" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--9" value="" style="line;html=1;strokeWidth=1;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;" parent="zkfFHV4jXpPFQw0GAbJ--6" vertex="1">
<mxGeometry y="26" width="160" height="8" as="geometry" />
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--10" value="extract" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontStyle=4" parent="zkfFHV4jXpPFQw0GAbJ--6" vertex="1">
<mxGeometry y="34" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--12" value="" style="endArrow=block;endSize=10;endFill=0;shadow=0;strokeWidth=1;rounded=0;curved=0;edgeStyle=elbowEdgeStyle;elbow=vertical;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="zkfFHV4jXpPFQw0GAbJ--6" target="zkfFHV4jXpPFQw0GAbJ--0" edge="1">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="200" y="203" as="sourcePoint" />
<mxPoint x="200" y="203" as="targetPoint" />
<Array as="points">
<mxPoint x="190" y="320" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--17" value="JavaVMImpl" style="swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeLast=0;collapsible=1;marginBottom=0;rounded=0;shadow=0;strokeWidth=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="530" y="110" width="160" height="216" as="geometry">
<mxRectangle x="550" y="140" width="160" height="26" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--22" value="m_extractor" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rounded=0;shadow=0;html=0;" parent="zkfFHV4jXpPFQw0GAbJ--17" vertex="1">
<mxGeometry y="26" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--23" value="" style="line;html=1;strokeWidth=1;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;" parent="zkfFHV4jXpPFQw0GAbJ--17" vertex="1">
<mxGeometry y="52" width="160" height="8" as="geometry" />
</mxCell>
<mxCell id="zkfFHV4jXpPFQw0GAbJ--25" value="parseScriptOptions" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="zkfFHV4jXpPFQw0GAbJ--17" vertex="1">
<mxGeometry y="60" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;endArrow=block;endFill=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cAzvCynLCVfaQQ1azyM7-0" target="cAzvCynLCVfaQQ1azyM7-15">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-0" value="ParserLegacy" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="-80" y="600" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=block;endFill=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cAzvCynLCVfaQQ1azyM7-1" target="cAzvCynLCVfaQQ1azyM7-15">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-1" value="ParserCTPG" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="510" y="585" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;endArrow=block;endFill=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cAzvCynLCVfaQQ1azyM7-2" target="cAzvCynLCVfaQQ1azyM7-26">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-2" value="ConverterLegacy" style="whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="100" y="570" width="100" height="100" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=block;endFill=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cAzvCynLCVfaQQ1azyM7-3" target="cAzvCynLCVfaQQ1azyM7-26">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-3" value="ConverterV2" style="whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="270" y="570" width="90" height="90" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.75;entryY=0;entryDx=0;entryDy=0;startArrow=diamond;startFill=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cAzvCynLCVfaQQ1azyM7-4" target="cAzvCynLCVfaQQ1azyM7-3">
<mxGeometry relative="1" as="geometry">
<mxPoint x="380" y="459" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cAzvCynLCVfaQQ1azyM7-4" target="zkfFHV4jXpPFQw0GAbJ--0">
<mxGeometry relative="1" as="geometry">
<mxPoint x="300" y="260" as="targetPoint" />
<Array as="points">
<mxPoint x="470" y="320" />
<mxPoint x="301" y="320" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;startArrow=diamond;startFill=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="cAzvCynLCVfaQQ1azyM7-4" target="cAzvCynLCVfaQQ1azyM7-1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-4" value="tExtractorV2" style="swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeLast=0;collapsible=1;marginBottom=0;rounded=0;shadow=0;strokeWidth=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="390" y="390" width="160" height="138" as="geometry">
<mxRectangle x="130" y="380" width="160" height="26" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-5" value="" style="line;html=1;strokeWidth=1;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;" vertex="1" parent="cAzvCynLCVfaQQ1azyM7-4">
<mxGeometry y="26" width="160" height="8" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-6" value="extract" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontStyle=4" vertex="1" parent="cAzvCynLCVfaQQ1azyM7-4">
<mxGeometry y="34" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.417;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;startArrow=diamond;startFill=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="zkfFHV4jXpPFQw0GAbJ--6" target="cAzvCynLCVfaQQ1azyM7-0">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="zkfFHV4jXpPFQw0GAbJ--25" target="zkfFHV4jXpPFQw0GAbJ--0">
<mxGeometry relative="1" as="geometry">
<mxPoint x="402" y="190" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-15" value="Parser" style="swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeLast=0;collapsible=1;marginBottom=0;rounded=0;shadow=0;strokeWidth=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="170" y="820" width="160" height="190" as="geometry">
<mxRectangle x="130" y="380" width="160" height="26" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-16" value="" style="line;html=1;strokeWidth=1;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;" vertex="1" parent="cAzvCynLCVfaQQ1azyM7-15">
<mxGeometry y="26" width="160" height="8" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-17" value="prepareScriptCode&#xa;" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontStyle=4" vertex="1" parent="cAzvCynLCVfaQQ1azyM7-15">
<mxGeometry y="34" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-20" value="parseForScriptClass&#xa;" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontStyle=4" vertex="1" parent="cAzvCynLCVfaQQ1azyM7-15">
<mxGeometry y="60" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-21" value="parseForJvmOptions&#xa;" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontStyle=4" vertex="1" parent="cAzvCynLCVfaQQ1azyM7-15">
<mxGeometry y="86" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-22" value="parseForExternalJars&#xa;" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontStyle=4" vertex="1" parent="cAzvCynLCVfaQQ1azyM7-15">
<mxGeometry y="112" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-23" value="extractImportScripts&#xa;" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontStyle=4" vertex="1" parent="cAzvCynLCVfaQQ1azyM7-15">
<mxGeometry y="138" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-24" value="getScriptCode&#xa;" style="text;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontStyle=4" vertex="1" parent="cAzvCynLCVfaQQ1azyM7-15">
<mxGeometry y="164" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="cAzvCynLCVfaQQ1azyM7-26" value="Converter" style="whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="190" y="690" width="100" height="100" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit afa0797

Please sign in to comment.