package jetbrains.mps.testbench.suite.generator.template.main; /*Generated by MPS */ import jetbrains.mps.generator.runtime.Generated; import jetbrains.mps.generator.impl.query.QueryProviderBase; import jetbrains.mps.generator.template.PropertyMacroContext; import jetbrains.mps.testbench.suite.behavior.ITestRef__BehaviorDescriptor; import jetbrains.mps.internal.collections.runtime.IterableUtils; import jetbrains.mps.internal.collections.runtime.Sequence; import jetbrains.mps.testbench.suite.behavior.IModuleRef__BehaviorDescriptor; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.util.NameUtil; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.generator.template.SourceSubstituteMacroNodesContext; import jetbrains.mps.testbench.suite.behavior.ModuleSuite__BehaviorDescriptor; import java.util.Map; import jetbrains.mps.generator.impl.query.SourceNodesQuery; import java.util.HashMap; import org.jetbrains.annotations.NotNull; import jetbrains.mps.generator.impl.query.QueryKey; import jetbrains.mps.generator.impl.query.QueryKeyImpl; import java.util.Collection; import jetbrains.mps.generator.impl.GenerationFailureException; import jetbrains.mps.util.IterableUtil; import jetbrains.mps.generator.impl.query.PropertyValueQuery; import org.jetbrains.mps.openapi.language.SProperty; import org.jetbrains.annotations.Nullable; @Generated public class QueriesGenerated extends QueryProviderBase { public QueriesGenerated() { super(1); } public static Object propertyMacro_GetPropertyValue_2956932267233365622(final PropertyMacroContext _context) { String fqn = ITestRef__BehaviorDescriptor.fqClassName_id2$98zG5liRT.invoke(_context.getNode()); if ((fqn == null || fqn.length() == 0)) { _context.showErrorMessage(_context.getNode(), "no class name"); return "NO CLASS NAME"; } return fqn; } public static Object propertyMacro_GetPropertyValue_4089647634161018296(final PropertyMacroContext _context) { String tns = IterableUtils.join(Sequence.fromIterable(ITestRef__BehaviorDescriptor.testNames_id3z1mdFUF$j3.invoke(_context.getNode())), ","); if ((tns == null || tns.length() == 0)) { _context.showWarningMessage(_context.getNode(), "empty test case"); } return tns; } public static Object propertyMacro_GetPropertyValue_4089647634160960602(final PropertyMacroContext _context) { return IModuleRef__BehaviorDescriptor.moduleReference_id173Z5qAOun8.invoke(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0xd3c5a46fb8c247dbL, 0xad0a30b8f19c2055L, 0x3e81ed1e2be77cb5L, 0x11c3fc56a6d1cc88L, "moduleRef"))).toString(); } public static Object propertyMacro_GetPropertyValue_2956932267233340150(final PropertyMacroContext _context) { return _context.getTemplateValue() + "_" + NameUtil.toValidIdentifier(SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"))); } public static Iterable<SNode> sourceNodesQuery_2956932267233365615(final SourceSubstituteMacroNodesContext _context) { return (Iterable<SNode>) ModuleSuite__BehaviorDescriptor.getNotMutedTests_id7tF7F0nXrAX.invoke(_context.getNode()); } public static Iterable<SNode> sourceNodesQuery_4089647634161018289(final SourceSubstituteMacroNodesContext _context) { return (Iterable<SNode>) ModuleSuite__BehaviorDescriptor.getNotMutedTests_id7tF7F0nXrAX.invoke(_context.getNode()); } private final Map<String, SourceNodesQuery> snsqMethods = new HashMap<String, SourceNodesQuery>(); { int i = 0; snsqMethods.put("2956932267233365615", new QueriesGenerated.SNsQ(i++)); snsqMethods.put("4089647634161018289", new QueriesGenerated.SNsQ(i++)); } @NotNull @Override public SourceNodesQuery getSourceNodesQuery(@NotNull QueryKey identity) { final String id = ((QueryKeyImpl) identity).getQueryNodeId().toString(); if (!(snsqMethods.containsKey(id))) { return super.getSourceNodesQuery(identity); } return snsqMethods.get(id); } private static class SNsQ implements SourceNodesQuery { private final int methodKey; public SNsQ(int methodKey) { this.methodKey = methodKey; } @NotNull public Collection<SNode> evaluate(@NotNull SourceSubstituteMacroNodesContext ctx) throws GenerationFailureException { switch (methodKey) { case 0: return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_2956932267233365615(ctx)); case 1: return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_4089647634161018289(ctx)); default: throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey)); } } } private final Map<String, PropertyValueQuery> pvqMethods = new HashMap<String, PropertyValueQuery>(); { int i = 0; pvqMethods.put("2956932267233365621", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), "")); pvqMethods.put("4089647634161018295", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), "")); pvqMethods.put("4089647634160960601", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf93d565d10L, 0xf93d565d11L, "value"), "")); pvqMethods.put("2956932267233340149", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "TestModule")); } @NotNull @Override public PropertyValueQuery getPropertyValueQuery(@NotNull QueryKey identity) { final String id = identity.getTemplateNode().getNodeId().toString(); if (!(pvqMethods.containsKey(id))) { return super.getPropertyValueQuery(identity); } return pvqMethods.get(id); } private static class PVQ extends PropertyValueQuery.Base { private final int methodKey; /*package*/ PVQ(int methodKey, SProperty property, String templateValue) { super(property, templateValue); this.methodKey = methodKey; } @Nullable public Object evaluate(@NotNull PropertyMacroContext ctx) throws GenerationFailureException { switch (methodKey) { case 0: return QueriesGenerated.propertyMacro_GetPropertyValue_2956932267233365622(ctx); case 1: return QueriesGenerated.propertyMacro_GetPropertyValue_4089647634161018296(ctx); case 2: return QueriesGenerated.propertyMacro_GetPropertyValue_4089647634160960602(ctx); case 3: return QueriesGenerated.propertyMacro_GetPropertyValue_2956932267233340150(ctx); default: throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey)); } } } }