@Test public void testUpdateResource() throws Exception { String resourcePath = "update"; Name<?> resourceName = name(resourcePath); Date date = new Date(); final DataSet initial = getInitialData(newReference().toManagedIndividual(PersonHandler.ID).named(resourcePath), date); final DataSet updatedDate = getUpdatedData(newReference().toManagedIndividual(PersonHandler.ID).named(resourcePath), date); System.out.println(initial); final Resource resource = publishResource(Resource.class,PersonHandler.ID, resourceName, resourcePath); PersonHandler handler = getHandler(PersonHandler.class); handler.add(resourceName, initial); transactional( new Callable<Void>() { @Override public Void call() throws Exception { DataSet data = sut.getResource(resource,getSessionConfiguration(resource)); assertThat(data,sameInstance(initial)); return null; } } ); transactional( new Callable<Void>() { @Override public Void call() throws Exception { try { sut.updateResource(resource,updatedDate,getSessionConfiguration(resource)); } catch (FeatureException e) { e.printStackTrace(); fail("Should not fail update"); } return null; } } ); transactional( new Callable<Void>() { @Override public Void call() throws Exception { DataSet data = sut.getResource(resource,getSessionConfiguration(resource)); assertThat(data,sameInstance(updatedDate)); return null; } } ); }
public void updateResource(Resource resource, DataSet dataSet, WriteSessionConfiguration configuration) throws FeatureException { adapter(resource, configuration).update(dataSet); }
ResourceControllerService implements Service { public void updateResource(Resource resource, DataSet dataSet, WriteSessionConfiguration configuration) throws FeatureException { adapter(resource, configuration).update(dataSet); } }
ResourceControllerService implements Service { public void updateResource(Resource resource, DataSet dataSet, WriteSessionConfiguration configuration) throws FeatureException { adapter(resource, configuration).update(dataSet); } private  ResourceControllerService(WriteSessionService writeSessionService, TemplateManagementService templateManagementService); }
ResourceControllerService implements Service { public void updateResource(Resource resource, DataSet dataSet, WriteSessionConfiguration configuration) throws FeatureException { adapter(resource, configuration).update(dataSet); } private  ResourceControllerService(WriteSessionService writeSessionService, TemplateManagementService templateManagementService); DataSet getResource(Resource resource, WriteSessionConfiguration configuration); DataSet queryResource(Resource resource, Query query, WriteSessionConfiguration configuration); void updateResource(Resource resource, DataSet dataSet, WriteSessionConfiguration configuration); void deleteResource(Resource resource, WriteSessionConfiguration configuration); Resource createResource(Container container, DataSet dataSet, WriteSessionConfiguration configuration); static ServiceBuilder<ResourceControllerService> serviceBuilder(); static ResourceControllerService defaultService(); }
ResourceControllerService implements Service { public void updateResource(Resource resource, DataSet dataSet, WriteSessionConfiguration configuration) throws FeatureException { adapter(resource, configuration).update(dataSet); } private  ResourceControllerService(WriteSessionService writeSessionService, TemplateManagementService templateManagementService); DataSet getResource(Resource resource, WriteSessionConfiguration configuration); DataSet queryResource(Resource resource, Query query, WriteSessionConfiguration configuration); void updateResource(Resource resource, DataSet dataSet, WriteSessionConfiguration configuration); void deleteResource(Resource resource, WriteSessionConfiguration configuration); Resource createResource(Container container, DataSet dataSet, WriteSessionConfiguration configuration); static ServiceBuilder<ResourceControllerService> serviceBuilder(); static ResourceControllerService defaultService();  }