@Test public void testAddParameters() { Model expectedModel = ModelFactory.createDefaultModel(); expectedModel.add(HobbitExperiments.New, RDF.type, HOBBIT.Experiment); expectedModel.add(HobbitExperiments.New, HOBBIT.involvesBenchmark, expectedModel.getResource("http: expectedModel.add(HobbitExperiments.New, HOBBIT.involvesSystemInstance, expectedModel.getResource("http: expectedModel.add(HobbitExperiments.New, expectedModel.getProperty("http: "2", XSDDatatype.XSDunsignedInt); expectedModel.add(HobbitExperiments.New, expectedModel.getProperty("http: expectedModel.getResource("http: expectedModel.add(HobbitExperiments.New, expectedModel.getProperty("http: XSDDatatype.XSDinteger); SubmitModelBean benchmarkConf = new SubmitModelBean(); benchmarkConf.setBenchmark("http: benchmarkConf.setSystem("http: List<ConfigurationParamValueBean> parameters = new ArrayList<>(); ConfigurationParamValueBean param = new ConfigurationParamValueBean(); param.setDatatype(Datatype.UNSIGNED_INT); param.setId("http: param.setValue("2"); param.setRange(XSD.unsignedInt.getURI()); parameters.add(param); param = new ConfigurationParamValueBean(); param.setDatatype(null); param.setId("http: param.setValue("http: param.setRange("http: parameters.add(param); param = new ConfigurationParamValueBean(); param.setDatatype(Datatype.INTEGER); param.setId("http: param.setValue("31"); param.setRange(XSD.integer.getURI()); parameters.add(param); benchmarkConf.setConfigurationParams(parameters); Model model = ModelFactory.createDefaultModel(); model.add(HobbitExperiments.New, RDF.type, HOBBIT.Experiment); model.add(HobbitExperiments.New, HOBBIT.involvesBenchmark, model.createResource(benchmarkConf.getBenchmark())); model.add(HobbitExperiments.New, HOBBIT.involvesSystemInstance, model.createResource(benchmarkConf.getSystem())); model = PlatformControllerClient.addParameters(model, HobbitExperiments.New, benchmarkConf.getConfigurationParams()); Set<Statement> stmts = ModelComparisonHelper.getMissingStatements(expectedModel, model); Assert.assertEquals(stmts.toString(), 0, stmts.size()); stmts = ModelComparisonHelper.getMissingStatements(model, expectedModel); Assert.assertEquals(stmts.toString(), 0, stmts.size()); }
protected static Model addParameters(Model model, Resource benchmarkInstanceResource, List<ConfigurationParamValueBean> list) { for (ConfigurationParamValueBean paramValue : list) { String uri = paramValue.getId(); String datatype = Datatype.getValue(paramValue.getDatatype()); String value = paramValue.getValue(); String range = paramValue.getRange(); if (range == null) { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createTypedLiteral(value, expandedXsdId(datatype))); } else { if (range.startsWith(XSD.NS)) { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createTypedLiteral(value, range)); } else { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createResource(value)); } } } StringWriter writer = new StringWriter(); model.write(writer, "Turtle"); return model; }
PlatformControllerClient implements Closeable { protected static Model addParameters(Model model, Resource benchmarkInstanceResource, List<ConfigurationParamValueBean> list) { for (ConfigurationParamValueBean paramValue : list) { String uri = paramValue.getId(); String datatype = Datatype.getValue(paramValue.getDatatype()); String value = paramValue.getValue(); String range = paramValue.getRange(); if (range == null) { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createTypedLiteral(value, expandedXsdId(datatype))); } else { if (range.startsWith(XSD.NS)) { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createTypedLiteral(value, range)); } else { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createResource(value)); } } } StringWriter writer = new StringWriter(); model.write(writer, "Turtle"); return model; } }
PlatformControllerClient implements Closeable { protected static Model addParameters(Model model, Resource benchmarkInstanceResource, List<ConfigurationParamValueBean> list) { for (ConfigurationParamValueBean paramValue : list) { String uri = paramValue.getId(); String datatype = Datatype.getValue(paramValue.getDatatype()); String value = paramValue.getValue(); String range = paramValue.getRange(); if (range == null) { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createTypedLiteral(value, expandedXsdId(datatype))); } else { if (range.startsWith(XSD.NS)) { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createTypedLiteral(value, range)); } else { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createResource(value)); } } } StringWriter writer = new StringWriter(); model.write(writer, "Turtle"); return model; } protected  PlatformControllerClient(RabbitRpcClient client); }
PlatformControllerClient implements Closeable { protected static Model addParameters(Model model, Resource benchmarkInstanceResource, List<ConfigurationParamValueBean> list) { for (ConfigurationParamValueBean paramValue : list) { String uri = paramValue.getId(); String datatype = Datatype.getValue(paramValue.getDatatype()); String value = paramValue.getValue(); String range = paramValue.getRange(); if (range == null) { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createTypedLiteral(value, expandedXsdId(datatype))); } else { if (range.startsWith(XSD.NS)) { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createTypedLiteral(value, range)); } else { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createResource(value)); } } } StringWriter writer = new StringWriter(); model.write(writer, "Turtle"); return model; } protected  PlatformControllerClient(RabbitRpcClient client); static PlatformControllerClient create(Connection connection); @Override void close(); List<BenchmarkBean> requestBenchmarks(); BenchmarkBean requestBenchmarkDetails(String benchmarkUri, UserInfoBean user); String submitBenchmark(SubmitModelBean benchmarkConf, String userName); ControllerStatus requestStatus(String userName); void closeChallenge(String challengeUri); List<SystemBean> requestSystemsOfUser(String userMail); boolean requestExperimentDeletion(String id, String userName); static void main(String[] argv); boolean terminateExperiment(String experimentId, String preferredUsername); }
PlatformControllerClient implements Closeable { protected static Model addParameters(Model model, Resource benchmarkInstanceResource, List<ConfigurationParamValueBean> list) { for (ConfigurationParamValueBean paramValue : list) { String uri = paramValue.getId(); String datatype = Datatype.getValue(paramValue.getDatatype()); String value = paramValue.getValue(); String range = paramValue.getRange(); if (range == null) { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createTypedLiteral(value, expandedXsdId(datatype))); } else { if (range.startsWith(XSD.NS)) { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createTypedLiteral(value, range)); } else { model.add(benchmarkInstanceResource, model.createProperty(uri), model.createResource(value)); } } } StringWriter writer = new StringWriter(); model.write(writer, "Turtle"); return model; } protected  PlatformControllerClient(RabbitRpcClient client); static PlatformControllerClient create(Connection connection); @Override void close(); List<BenchmarkBean> requestBenchmarks(); BenchmarkBean requestBenchmarkDetails(String benchmarkUri, UserInfoBean user); String submitBenchmark(SubmitModelBean benchmarkConf, String userName); ControllerStatus requestStatus(String userName); void closeChallenge(String challengeUri); List<SystemBean> requestSystemsOfUser(String userMail); boolean requestExperimentDeletion(String id, String userName); static void main(String[] argv); boolean terminateExperiment(String experimentId, String preferredUsername);  }