77import gov .nasa .jpl .aerie .e2e .types .ValueSchema ;
88import gov .nasa .jpl .aerie .e2e .utils .GatewayRequests ;
99import gov .nasa .jpl .aerie .e2e .utils .HasuraRequests ;
10+ import gov .nasa .jpl .aerie .merlin .protocol .types .SerializedValue ;
1011import org .junit .jupiter .api .AfterAll ;
1112import org .junit .jupiter .api .BeforeAll ;
1213import org .junit .jupiter .api .Test ;
1314import org .junit .jupiter .api .TestInstance ;
1415
1516import javax .json .Json ;
17+ import javax .json .JsonObject ;
1618import java .io .IOException ;
1719import java .util .ArrayList ;
20+ import java .util .Arrays ;
1821import java .util .List ;
1922import java .util .Map ;
2023
@@ -97,7 +100,7 @@ private ArrayList<ActivityType> expectedActivityTypesBanananation() {
97100 activityTypes .add (new ActivityType (
98101 "BiteBanana" ,
99102 Map .of ("biteSize" , new Parameter (0 , new ValueSchemaMeta (Map .of ("unit" , Json .createObjectBuilder (Map .of ("value" , "m" )).build (), "banannotation" , Json .createObjectBuilder ().add ("value" , Json .createValue ("Specifies the size of bite to take" )).build ()), VALUE_SCHEMA_REAL ))),
100- new ValueSchemaStruct (Map .of ("biteSizeWasBig" , VALUE_SCHEMA_BOOLEAN , "newFlag" , new ValueSchemaVariant (List .of (new Variant ("A" , "A" ), new Variant ("B" , "B" ))))),
103+ new ValueSchemaMeta ( Map . of ( "item_order" , Json . createArrayBuilder (). add ( "biteSizeWasBig" ). add ( "newFlag" ). build ()), new ValueSchemaStruct (Map .of ("biteSizeWasBig" , VALUE_SCHEMA_BOOLEAN , "newFlag" , new ValueSchemaVariant (List .of (new Variant ("A" , "A" ), new Variant ("B" , "B" ) ))))),
101104 "Eat"
102105 ));
103106 activityTypes .add (new ActivityType ("ChangeProducer" , Map .of ("producer" , new Parameter (0 , VALUE_SCHEMA_STRING ))));
@@ -115,17 +118,81 @@ private ArrayList<ActivityType> expectedActivityTypesBanananation() {
115118 activityTypes .add (new ActivityType (
116119 "DurationParameterActivity" ,
117120 Map .of ("duration" , new Parameter (0 , VALUE_SCHEMA_DURATION )),
118- new ValueSchemaStruct ( Map . of (
119- "duration " , VALUE_SCHEMA_DURATION ,
120- "durationInSeconds" , new ValueSchemaMeta (Map .of ("unit " , Json . createObjectBuilder ( Map . of ( "value" , "s" )). build ()), VALUE_SCHEMA_REAL ))) ,
121- null
122- ));
121+ new ValueSchemaMeta (
122+ Map . of ( "item_order " , Json . createArrayBuilder (). add ( "duration" ). add ( "durationInSeconds" ). build ()) ,
123+ new ValueSchemaStruct (Map .of ("duration " , VALUE_SCHEMA_DURATION ,
124+ "durationInSeconds" , new ValueSchemaMeta ( Map . of ( "unit" , Json . createObjectBuilder ( Map . of ( "value" , "s" )). build ()), VALUE_SCHEMA_REAL )))),
125+ null ));
123126 activityTypes .add (new ActivityType ("ExceptionActivity" , Map .of ("throwException" , new Parameter (0 , VALUE_SCHEMA_BOOLEAN ))));
124127 activityTypes .add (new ActivityType ("grandchild" , Map .of ("counter" , new Parameter (0 , VALUE_SCHEMA_INT ))));
125128 activityTypes .add (new ActivityType ("GrowBanana" , Map .of (
126129 "quantity" , new Parameter (0 , VALUE_SCHEMA_INT ),
127130 "growingDuration" , new Parameter (1 , VALUE_SCHEMA_DURATION ))));
128131 activityTypes .add (new ActivityType ("LineCount" , Map .of ("path" , new Parameter (0 , VALUE_SCHEMA_PATH ))));
132+ final var allSubs = new String [] {"primitiveDouble" ,
133+ "primitiveFloat" ,
134+ "primitiveByte" ,
135+ "primitiveShort" ,
136+ "primitiveInt" ,
137+ "primitiveLong" ,
138+ "primitiveChar" ,
139+ "primitiveBoolean" ,
140+ "boxedDouble" ,
141+ "boxedFloat" ,
142+ "boxedByte" ,
143+ "boxedShort" ,
144+ "boxedInt" ,
145+ "boxedLong" ,
146+ "boxedChar" ,
147+ "boxedBoolean" ,
148+ "string" ,
149+ "doubleArray" ,
150+ "floatArray" ,
151+ "byteArray" ,
152+ "shortArray" ,
153+ "intArray" ,
154+ "longArray" ,
155+ "charArray" ,
156+ "booleanArray" ,
157+ "stringArray" ,
158+ "primDoubleArray" ,
159+ "primFloatArray" ,
160+ "primByteArray" ,
161+ "primShortArray" ,
162+ "primIntArray" ,
163+ "primLongArray" ,
164+ "primCharArray" ,
165+ "primBooleanArray" ,
166+ "doubleList" ,
167+ "floatList" ,
168+ "byteList" ,
169+ "shortList" ,
170+ "intList" ,
171+ "longList" ,
172+ "charList" ,
173+ "booleanList" ,
174+ "stringList" ,
175+ "doubleMap" ,
176+ "floatMap" ,
177+ "byteMap" ,
178+ "shortMap" ,
179+ "intMap" ,
180+ "longMap" ,
181+ "charMap" ,
182+ "booleanMap" ,
183+ "stringMap" ,
184+ "testDuration" ,
185+ "testEnum" ,
186+ "mappyBoi" ,
187+ "doublePrimIntArray" ,
188+ "intListArrayArray" ,
189+ "obnoxious" ,
190+ "nested" ,
191+ "genericParameter" };
192+ final var parameterTestItemOrder = Json .createArrayBuilder ();
193+ for (final var param : allSubs ){
194+ parameterTestItemOrder .add (param );
195+ }
129196 activityTypes .add (new ActivityType (
130197 "ParameterTest" ,
131198 //region ParameterTest Parameters
@@ -135,15 +202,17 @@ private ArrayList<ActivityType> expectedActivityTypesBanananation() {
135202 entry ("record" ,
136203 new Parameter (
137204 58 ,
138- new ValueSchemaStruct (Map .<String , ValueSchema >ofEntries (
205+ new ValueSchemaMeta ( Map . of ( "item_order" , parameterTestItemOrder . build ()), new ValueSchemaStruct (Map .<String , ValueSchema >ofEntries (
139206 entry ("intMap" , new ValueSchemaSeries (new ValueSchemaStruct (Map .of (
140207 "key" , VALUE_SCHEMA_INT ,
141208 "value" , VALUE_SCHEMA_INT )))),
142- entry ("nested" , new ValueSchemaStruct (Map .of (
209+ entry ("nested" , new ValueSchemaMeta (
210+ Map .of ( "item_order" , Json .createArrayBuilder ().add ("a" ).add ("b" ).build ()),
211+ new ValueSchemaStruct (Map .of (
143212 "a" , VALUE_SCHEMA_STRING ,
144213 "b" , new ValueSchemaSeries (new ValueSchemaStruct (Map .of (
145214 "key" , VALUE_SCHEMA_INT ,
146- "value" , VALUE_SCHEMA_STRING )))))),
215+ "value" , VALUE_SCHEMA_STRING ))))))) ,
147216 entry ("string" , VALUE_SCHEMA_STRING ),
148217 entry ("byteMap" , new ValueSchemaSeries (new ValueSchemaStruct (Map .of (
149218 "key" , VALUE_SCHEMA_INT ,
@@ -226,7 +295,7 @@ private ArrayList<ActivityType> expectedActivityTypesBanananation() {
226295 entry ("primBooleanArray" , new ValueSchemaSeries (VALUE_SCHEMA_BOOLEAN )),
227296 entry ("primitiveBoolean" , VALUE_SCHEMA_BOOLEAN ),
228297 entry ("intListArrayArray" , new ValueSchemaSeries (new ValueSchemaSeries (new ValueSchemaSeries (VALUE_SCHEMA_INT )))),
229- entry ("doublePrimIntArray" , new ValueSchemaSeries (new ValueSchemaSeries (VALUE_SCHEMA_INT ))))))),
298+ entry ("doublePrimIntArray" , new ValueSchemaSeries (new ValueSchemaSeries (VALUE_SCHEMA_INT )))))))) ,
230299 //endregion record
231300 entry ("string" , new Parameter (16 , VALUE_SCHEMA_STRING )),
232301 entry ("byteMap" , new Parameter (45 ,new ValueSchemaSeries (new ValueSchemaStruct (Map .of (
0 commit comments