Skip to content

Commit

Permalink
Add tests for different HTTP Methods
Browse files Browse the repository at this point in the history
Changed default from "any" to "GET" in order to preserve previous behavior
  • Loading branch information
bkolb committed Mar 23, 2021
1 parent 122431c commit fab5a12
Show file tree
Hide file tree
Showing 50 changed files with 10,385 additions and 8,651 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<product version="3" modelHash="-d2m6jrjxnwkh5kq8pbdmmoc54m38gc6">
<product version="3" modelHash="-4zvhr3eypqno7hwe0xzlsnub2gvcqa3">
<files names="Generator.java" />
</product>

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<classNode dependClassName="jetbrains.mps.generator.template.TemplateQueryContext" />
<classNode dependClassName="jetbrains.mps.ide.httpsupport.behavior.IParameterConverter__BehaviorDescriptor" />
<classNode dependClassName="jetbrains.mps.ide.httpsupport.behavior.PortProvider__BehaviorDescriptor" />
<classNode dependClassName="jetbrains.mps.ide.httpsupport.behavior.RequestHandler__BehaviorDescriptor" />
<classNode dependClassName="jetbrains.mps.internal.collections.runtime.ListSequence" />
<classNode dependClassName="jetbrains.mps.internal.collections.runtime.Sequence" />
<classNode dependClassName="jetbrains.mps.lang.core.behavior.INamedConcept__BehaviorDescriptor" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<product version="3" modelHash="-4rjczghon9dbj1asybt3qdsl3fqr11r">
<product version="3" modelHash="-cu4ricrei0i9z8t6krohyp37gdf6y0i">
<files names="QueriesGenerated.java" />
</product>

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import jetbrains.mps.lang.smodel.behavior.SNodeOperation__BehaviorDescriptor;
import jetbrains.mps.generator.template.TemplateArgumentContext;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodesContext;
import jetbrains.mps.ide.httpsupport.behavior.RequestHandler__BehaviorDescriptor;
import jetbrains.mps.internal.collections.runtime.Sequence;
import jetbrains.mps.generator.template.TemplateQueryContext;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SModelOperations;
Expand Down Expand Up @@ -227,9 +228,6 @@ public static Object referenceMacro_GetReferent_2_1(final ReferenceMacroContext
public static boolean ifMacro_Condition_2_0(final IfMacroContext _context) {
return SPropertyOperations.getBoolean(_context.getNode(), PROPS.required$LWmw);
}
public static boolean ifMacro_Condition_2_1(final IfMacroContext _context) {
return ListSequence.fromList(SLinkOperations.getChildren(_context.getNode(), LINKS.handledMethods$d9i1)).isNotEmpty();
}
public static boolean ifMacro_Condition_4_0(final IfMacroContext _context) {
return (SLinkOperations.getTarget(_context.getNode(), LINKS.defaultValueFunction$2M9p) != null);
}
Expand Down Expand Up @@ -411,10 +409,10 @@ public static SNode sourceNodeQuery_13_1(final SourceSubstituteMacroNodeContext
return SLinkOperations.getTarget(_context.getNode(), LINKS.operation$gs9E);
}
public static Object templateArgumentQuery_6_0(final TemplateArgumentContext _context) {
return _quotation_createNode_x583g4_a0a611(IParameterConverter__BehaviorDescriptor.getParameterType_id4rKp80ZJrgq.invoke(SLinkOperations.getTarget(SLinkOperations.getTarget(_context.getNode(), LINKS.parameter$DxS8), LINKS.parameterConverter$QDBo)), SPropertyOperations.getString(SLinkOperations.getTarget(_context.getNode(), LINKS.parameter$DxS8), PROPS.name$MnvL));
return _quotation_createNode_x583g4_a0a511(IParameterConverter__BehaviorDescriptor.getParameterType_id4rKp80ZJrgq.invoke(SLinkOperations.getTarget(SLinkOperations.getTarget(_context.getNode(), LINKS.parameter$DxS8), LINKS.parameterConverter$QDBo)), SPropertyOperations.getString(SLinkOperations.getTarget(_context.getNode(), LINKS.parameter$DxS8), PROPS.name$MnvL));
}
public static Object templateArgumentQuery_2_0(final TemplateArgumentContext _context) {
return _quotation_createNode_x583g4_a0a711(SPropertyOperations.getString(_context.getNode(), PROPS.name$MnvL) + "_serialized");
return _quotation_createNode_x583g4_a0a611(SPropertyOperations.getString(_context.getNode(), PROPS.name$MnvL) + "_serialized");
}
public static Iterable<SNode> sourceNodesQuery_2_0(final SourceSubstituteMacroNodesContext _context) {
return SLinkOperations.getChildren(SLinkOperations.getTarget(_context.getNode(), LINKS.queryPrefix$HsUP), LINKS.segmetns$sMjR);
Expand All @@ -426,11 +424,11 @@ public static Iterable<SNode> sourceNodesQuery_2_2(final SourceSubstituteMacroNo
return SLinkOperations.getChildren(_context.getNode(), LINKS.queryParameters$sPtY);
}
public static Iterable<SNode> sourceNodesQuery_2_3(final SourceSubstituteMacroNodesContext _context) {
return SLinkOperations.getChildren(_context.getNode(), LINKS.handledMethods$d9i1);
return (Iterable<SNode>) RequestHandler__BehaviorDescriptor.supportedMethodsOrDefault_id22cXLi_Q1OU.invoke(_context.getNode());
}
public static Iterable<SNode> sourceNodesQuery_2_4(final SourceSubstituteMacroNodesContext _context) {
if ((SLinkOperations.getTarget(_context.getNode(), LINKS.canHandleFunction$Shog) == null)) {
return Sequence.<SNode>singleton(_quotation_createNode_x583g4_a0a0a0a221());
return Sequence.<SNode>singleton(_quotation_createNode_x583g4_a0a0a0a121());
}
return SLinkOperations.getChildren(SLinkOperations.getTarget(SLinkOperations.getTarget(_context.getNode(), LINKS.canHandleFunction$Shog), LINKS.body$e68K), LINKS.statement$53DE);
}
Expand Down Expand Up @@ -803,7 +801,7 @@ public SNode evaluate(@NotNull SourceSubstituteMacroNodeContext ctx) throws Gene
snsqMethods.put("6040064942662561774", new SNsQ(i++));
snsqMethods.put("2332657309400883165", new SNsQ(i++));
snsqMethods.put("2332657309400728060", new SNsQ(i++));
snsqMethods.put("3520791039920649796", new SNsQ(i++));
snsqMethods.put("3465992077578659613", new SNsQ(i++));
snsqMethods.put("6004610301070392427", new SNsQ(i++));
snsqMethods.put("8564455257661591745", new SNsQ(i++));
snsqMethods.put("5111696079055160168", new SNsQ(i++));
Expand Down Expand Up @@ -874,7 +872,7 @@ public Collection<SNode> evaluate(@NotNull SourceSubstituteMacroNodesContext ctx
pvqMethods.put("2332657309400696583", new PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "value"));
pvqMethods.put("4622937352054799555", new PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "_serialized"));
pvqMethods.put("4403308017443232880", new PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), ""));
pvqMethods.put("3520791039920650432", new PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), "GET"));
pvqMethods.put("3465992077578677678", new PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), "GET"));
pvqMethods.put("4622937352053698051", new PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "map_ParameterConverter"));
pvqMethods.put("4622937352055429558", new PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), null));
pvqMethods.put("4622937352056077046", new PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), ""));
Expand Down Expand Up @@ -953,7 +951,6 @@ public Object evaluate(@NotNull PropertyMacroContext ctx) throws GenerationFailu
{
int i = 0;
imcMethods.put("1546095305979194294", new IfMC(i++));
imcMethods.put("3520791039920680384", new IfMC(i++));
imcMethods.put("1546095305979810535", new IfMC(i++));
imcMethods.put("1546095305979349200", new IfMC(i++));
}
Expand All @@ -977,10 +974,8 @@ public boolean check(@NotNull IfMacroContext ctx) throws GenerationFailureExcept
case 0:
return QueriesGenerated.ifMacro_Condition_2_0(ctx);
case 1:
return QueriesGenerated.ifMacro_Condition_2_1(ctx);
case 2:
return QueriesGenerated.ifMacro_Condition_4_0(ctx);
case 3:
case 2:
return QueriesGenerated.ifMacro_Condition_10_0(ctx);
default:
throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no condition method for if macro %s (key: #%d)", ctx.getTemplateReference(), methodKey));
Expand Down Expand Up @@ -1286,7 +1281,7 @@ private static SNode _quotation_createNode_x583g4_b0a0a82() {
quotedNode_1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x101de48bf9eL, 0x101de490babL, "classifier"), quotedNode_1, facade.createModelReference("6ed54515-acc8-4d1e-a16c-9fd6cfe951ea/java:jetbrains.mps.project(MPS.Core/)"), facade.createNodeId("~Project")));
return quotedNode_1;
}
private static SNode _quotation_createNode_x583g4_a0a611(Object parameter_1, Object parameter_2) {
private static SNode _quotation_createNode_x583g4_a0a511(Object parameter_1, Object parameter_2) {
PersistenceFacade facade = PersistenceFacade.getInstance();
SNode quotedNode_3 = null;
SNode quotedNode_4 = null;
Expand All @@ -1298,7 +1293,7 @@ private static SNode _quotation_createNode_x583g4_a0a611(Object parameter_1, Obj
}
return quotedNode_3;
}
private static SNode _quotation_createNode_x583g4_a0a711(Object parameter_1) {
private static SNode _quotation_createNode_x583g4_a0a611(Object parameter_1) {
PersistenceFacade facade = PersistenceFacade.getInstance();
SNode quotedNode_2 = null;
SNode quotedNode_3 = null;
Expand All @@ -1309,7 +1304,7 @@ private static SNode _quotation_createNode_x583g4_a0a711(Object parameter_1) {
quotedNode_2.addChild(MetaAdapterFactory.getContainmentLink(0xdf345b11b8c74213L, 0xac6648d2a9b75d88L, 0x111fb5bb1f2L, 0x111fb5c4f4cL, "type"), quotedNode_3);
return quotedNode_2;
}
private static SNode _quotation_createNode_x583g4_a0a0a0a221() {
private static SNode _quotation_createNode_x583g4_a0a0a0a121() {
PersistenceFacade facade = PersistenceFacade.getInstance();
SNode quotedNode_1 = null;
SNode quotedNode_2 = null;
Expand All @@ -1329,7 +1324,6 @@ private static final class LINKS {
/*package*/ static final SReferenceLink parameter$DxS8 = MetaAdapterFactory.getReferenceLink(0x817e4e70961e4a95L, 0x98a115e9f32231f1L, 0x4027f9073ff5cf17L, 0x4027f9073ff5cf18L, "parameter");
/*package*/ static final SReferenceLink declaration$TFiC = MetaAdapterFactory.getReferenceLink(0x817e4e70961e4a95L, 0x98a115e9f32231f1L, 0x46f064803fbdb465L, 0x46f064803fbdb466L, "declaration");
/*package*/ static final SReferenceLink queryParameter$QWu8 = MetaAdapterFactory.getReferenceLink(0x817e4e70961e4a95L, 0x98a115e9f32231f1L, 0x205f4376c5884e95L, 0x205f4376c5884e96L, "queryParameter");
/*package*/ static final SContainmentLink handledMethods$d9i1 = MetaAdapterFactory.getContainmentLink(0x817e4e70961e4a95L, 0x98a115e9f32231f1L, 0x4d5ac72154f4d780L, 0x30dc5ccbfece8930L, "handledMethods");
/*package*/ static final SContainmentLink defaultValueFunction$2M9p = MetaAdapterFactory.getContainmentLink(0x817e4e70961e4a95L, 0x98a115e9f32231f1L, 0x3d1bb14fe8385046L, 0x2d9d5d4572ccb260L, "defaultValueFunction");
/*package*/ static final SContainmentLink parameterConverter$QDBo = MetaAdapterFactory.getContainmentLink(0x817e4e70961e4a95L, 0x98a115e9f32231f1L, 0x205f4376c585b439L, 0x46f064803fbfba0fL, "parameterConverter");
/*package*/ static final SContainmentLink parameterType$5sXM = MetaAdapterFactory.getContainmentLink(0x817e4e70961e4a95L, 0x98a115e9f32231f1L, 0x3d1bb14fe8385046L, 0x3d1bb14fe83869abL, "parameterType");
Expand Down
Loading

0 comments on commit fab5a12

Please sign in to comment.