@Order(3) @Test public void testResolve() throws Throwable { given(documentationSpec) .param("alias", "c") .param("uuid", uuid) .cookie("JSESSIONID", jSessionID) .port(port) .accept("application/json") .filter(document("resolve", requestParameters( parameterWithName("uuid").description("The unique identifier of the VTL session"), parameterWithName("alias").description("The alias of the object whose value is returned") ), requestHeaders( headerWithName("JSESSIONID").description("The Java Servlet server session cookie.").optional() ), responseFields( fieldWithPath("type").description("Always SCALAR for scalar values"), fieldWithPath("domain").description("The VTL domain of the scalar value"), fieldWithPath("value").description("The computed scalar value") ) )) .when() .get("/resolve") .then().assertThat() .statusCode(OK.value()) .and() .body("type", equalTo("SCALAR")) .and() .body("domain", equalTo("integer")) .and() .body("value", equalTo(3)); }
@GetMapping("/resolve") public @NonNull ResultBean resolve(@RequestParam @NonNull UUID uuid, @RequestParam @NonNull String alias) { VTLSession session = manager.getSession(uuid); VTLValue value = session.resolve(alias); if (value instanceof ScalarValue) return new ScalarResultBean((ScalarValue<?, ?, ?>) value); else return new DataSetResultBean((DataSet) value); }
VTLRESTfulServices extends SpringBootServletInitializer { @GetMapping("/resolve") public @NonNull ResultBean resolve(@RequestParam @NonNull UUID uuid, @RequestParam @NonNull String alias) { VTLSession session = manager.getSession(uuid); VTLValue value = session.resolve(alias); if (value instanceof ScalarValue) return new ScalarResultBean((ScalarValue<?, ?, ?>) value); else return new DataSetResultBean((DataSet) value); } }
VTLRESTfulServices extends SpringBootServletInitializer { @GetMapping("/resolve") public @NonNull ResultBean resolve(@RequestParam @NonNull UUID uuid, @RequestParam @NonNull String alias) { VTLSession session = manager.getSession(uuid); VTLValue value = session.resolve(alias); if (value instanceof ScalarValue) return new ScalarResultBean((ScalarValue<?, ?, ?>) value); else return new DataSetResultBean((DataSet) value); }  }
VTLRESTfulServices extends SpringBootServletInitializer { @GetMapping("/resolve") public @NonNull ResultBean resolve(@RequestParam @NonNull UUID uuid, @RequestParam @NonNull String alias) { VTLSession session = manager.getSession(uuid); VTLValue value = session.resolve(alias); if (value instanceof ScalarValue) return new ScalarResultBean((ScalarValue<?, ?, ?>) value); else return new DataSetResultBean((DataSet) value); }  @PostMapping(path = "/compile", params = "code") @NonNull UUIDBean compile(@RequestParam @NonNull String code); @GetMapping("/resolve") @NonNull ResultBean resolve(@RequestParam @NonNull UUID uuid, @RequestParam @NonNull String alias); @GetMapping("/metadata") @NonNull List<DomainBean> getMetadata(@RequestParam @NonNull UUID uuid, @RequestParam @NonNull String alias); }
VTLRESTfulServices extends SpringBootServletInitializer { @GetMapping("/resolve") public @NonNull ResultBean resolve(@RequestParam @NonNull UUID uuid, @RequestParam @NonNull String alias) { VTLSession session = manager.getSession(uuid); VTLValue value = session.resolve(alias); if (value instanceof ScalarValue) return new ScalarResultBean((ScalarValue<?, ?, ?>) value); else return new DataSetResultBean((DataSet) value); }  @PostMapping(path = "/compile", params = "code") @NonNull UUIDBean compile(@RequestParam @NonNull String code); @GetMapping("/resolve") @NonNull ResultBean resolve(@RequestParam @NonNull UUID uuid, @RequestParam @NonNull String alias); @GetMapping("/metadata") @NonNull List<DomainBean> getMetadata(@RequestParam @NonNull UUID uuid, @RequestParam @NonNull String alias);  }