FedXRepositoryConfig extends AbstractRepositoryImplConfig { @Override public Resource export(Model m) { Resource implNode = super.export(m); m.setNamespace("fedx", NAMESPACE); if (getDataConfig() != null) { m.add(implNode, DATA_CONFIG, vf.createLiteral(getDataConfig())); } if (getMembers() != null) { Model members = getMembers(); Set<Resource> memberNodes = members.subjects(); for (Resource memberNode : memberNodes) { m.add(implNode, MEMBER, memberNode); m.addAll(members.filter(memberNode, null, null)); } } return implNode; } FedXRepositoryConfig(); @Deprecated String getFedxConfig(); @Deprecated void setFedxConfig(String fedxConfig); String getDataConfig(); void setDataConfig(String dataConfig); Model getMembers(); void setMembers(Model members); FedXConfig getConfig(); void setConfig(FedXConfig config); @Override Resource export(Model m); @Override void validate(); @Override void parse(Model m, Resource implNode); static final String NAMESPACE; static final IRI DATA_CONFIG; static final IRI MEMBER; }
@Test public void testExport() throws Exception { Model model = readConfig("/tests/rdf4jserver/config.ttl"); FedXRepositoryConfig config = new FedXRepositoryConfig(); config.parse(model, implNode(model)); Model export = new TreeModel(); Resource implNode = config.export(export); assertThat(export.filter(implNode, FedXRepositoryConfig.MEMBER, null).size()).isEqualTo(2); assertThat(export.filter(null, FEDX.REPOSITORY_NAME, null).objects().stream().map(Value::stringValue)) .containsExactly("endpoint1", "endpoint2"); }