test_class.file: runner/src/test/java/org/ananas/runner/kernel/model/DagRequestTest.java
test_class.identifier: DagRequestTest
test_case.body: @Test
    public void resolveVariables() throws IOException, TemplateException {
      ClassLoader classLoader = getClass().getClassLoader();
      URL resource = classLoader.getResource("dagrequests/example1.json");
      String jsonRequest =
          new String(Files.readAllBytes(Paths.get(resource.getPath())), StandardCharsets.UTF_8);
  
      DagRequest req = JsonUtil.fromJson(jsonRequest, DagRequest.class);
      DagRequest newReq = req.resolveVariables();
  
      assertEquals(6, newReq.dag.steps.size());
  
      String dateStrValue = newReq.params.get("DATE_VAR").value;
      // DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_DATE_TIME;
      // OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateStrValue);
      Date date = Date.from(Instant.ofEpochMilli(Long.parseLong(dateStrValue)));
  
      SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy, HH:mm");
      String dateString = sdf.format(date);
  
      Iterator<Step> it = newReq.dag.steps.iterator();
      while (it.hasNext()) {
        Step step = it.next();
  
        if (step.id.equals("5c969069d47a400e547d25d9")) {
          assertEquals("some string value", step.config.get("path"));
        }
  
        if (step.id.equals("5c9697213cc63f7d6665abb0")) {
          assertEquals("123", step.config.get("xlabel"));
  
          List<String> dimensions = (List<String>) step.config.get("dimension");
          assertEquals(dateString, dimensions.get(0));
        }
      }
    }
test_case.class_method_signature: DagRequestTest.resolveVariables()
test_case.full_signature: @Test public void resolveVariables()
test_case.identifier: resolveVariables
test_case.invocations: getClassLoader getClass getResource readAllBytes get getPath fromJson resolveVariables assertEquals size get from ofEpochMilli parseLong format iterator hasNext next equals assertEquals get equals assertEquals get get assertEquals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void resolveVariables()
focal_class.declarator: TEMPLATE_CFG = new Configuration(Configuration.VERSION_2_3_27)
focal_class.modifier: public static
focal_class.original_string: public static Configuration TEMPLATE_CFG = new Configuration(Configuration.VERSION_2_3_27);
focal_class.type: Configuration
focal_class.var_name: TEMPLATE_CFG
focal_class.declarator: dag
focal_class.modifier: public
focal_class.original_string: public Dag dag;
focal_class.type: Dag
focal_class.var_name: dag
focal_class.declarator: goals
focal_class.modifier: public
focal_class.original_string: public Set<String> goals;
focal_class.type: Set<String>
focal_class.var_name: goals
focal_class.declarator: engine
focal_class.modifier: public
focal_class.original_string: public Engine engine;
focal_class.type: Engine
focal_class.var_name: engine
focal_class.declarator: params
focal_class.modifier: public
focal_class.original_string: public Map<String, Variable> params;
focal_class.type: Map<String, Variable>
focal_class.var_name: params
focal_class.declarator: trigger
focal_class.modifier: public
focal_class.original_string: public TriggerOptions trigger;
focal_class.type: TriggerOptions
focal_class.var_name: trigger
focal_class.file: runner/src/main/java/org/ananas/runner/kernel/model/DagRequest.java
focal_class.identifier: DagRequest
focal_class.class_method_signature: DagRequest.DagRequest()
focal_class.full_signature: public  DagRequest()
focal_class.identifier: DagRequest
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  DagRequest()
focal_class.class_method_signature: DagRequest.resolveVariables()
focal_class.full_signature: public DagRequest resolveVariables()
focal_class.identifier: resolveVariables
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: DagRequest
focal_class.signature: DagRequest resolveVariables()
focal_method.body: public DagRequest resolveVariables() throws IOException, TemplateException {
      String rawReq = JsonUtil.toJson(this);
  
      Template t = new Template("DagRequest", new StringReader(rawReq), TEMPLATE_CFG);
  
      // build legacy
      Map model = new HashMap();
      for (String key : this.params.keySet()) {
        Variable v = this.params.get(key);
        switch (v.type) {
          case "number":
            model.put(key, v.convertToNumber());
            break;
          case "date":
            model.put(key, v.convertToDate());
            break;
          case "string":
            model.put(key, v.convertToString());
            break;
          case "boolean":
            model.put(key, v.convertToBoolean());
            break;
          default:
            model.put(key, v.value);
        }
      }
  
      Writer out = new StringWriter();
      t.process(model, out);
  
      String transformedTemplate = out.toString();
      return JsonUtil.fromJson(transformedTemplate, DagRequest.class);
    }
focal_method.class_method_signature: DagRequest.resolveVariables()
focal_method.full_signature: public DagRequest resolveVariables()
focal_method.identifier: resolveVariables
focal_method.invocations: toJson keySet get put convertToNumber put convertToDate put convertToString put convertToBoolean put process toString fromJson
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: DagRequest
focal_method.signature: DagRequest resolveVariables()