@Test public void testLoadEntityMetadataAsync() throws InterruptedException, IOException { requests(); handler.async(); metadataService.loadEntityMetadataAsync("defect", new MetadataService.MetadataCallback() { @Override public void metadataLoaded(final Metadata metadata) { handler.done(new Runnable() { @Override public void run() { Assert.assertFalse("Callback inside dispatch thread", SwingUtilities.isEventDispatchThread()); Assert.assertEquals("defect", metadata.getEntityType()); Assert.assertEquals(Integer.class, metadata.getField("id").getClazz()); Assert.assertEquals(metadata, metadataService.getEntityMetadata("defect")); final Thread t = Thread.currentThread(); metadataService.loadEntityMetadataAsync("defect", new MetadataService.MetadataCallback() { @Override public void metadataLoaded(Metadata metadata) { Assert.assertEquals("Callback outside current thread although data should be cached", t, Thread.currentThread()); } @Override public void metadataFailed() { Assert.fail("Should have succeeded"); } }); } }); } @Override public void metadataFailed() { handler.fail("Should have succeeded"); } }); }
public void loadEntityMetadataAsync(String entityName, MetadataCallback callback) { getValueAsync(entityName, Proxy.create(callback)); }
MetadataService extends AbstractCachingService<String, Metadata, AbstractCachingService.Callback<Metadata>> { public void loadEntityMetadataAsync(String entityName, MetadataCallback callback) { getValueAsync(entityName, Proxy.create(callback)); } }
MetadataService extends AbstractCachingService<String, Metadata, AbstractCachingService.Callback<Metadata>> { public void loadEntityMetadataAsync(String entityName, MetadataCallback callback) { getValueAsync(entityName, Proxy.create(callback)); } MetadataService(Project project, MetadataSimpleService metadataService, RestService restService); }
MetadataService extends AbstractCachingService<String, Metadata, AbstractCachingService.Callback<Metadata>> { public void loadEntityMetadataAsync(String entityName, MetadataCallback callback) { getValueAsync(entityName, Proxy.create(callback)); } MetadataService(Project project, MetadataSimpleService metadataService, RestService restService); Metadata getEntityMetadata(String entityName); void loadEntityMetadataAsync(String entityName, MetadataCallback callback); Metadata getCachedEntityMetadata(String entityType); Exception getCachedFailure(String entityType); }
MetadataService extends AbstractCachingService<String, Metadata, AbstractCachingService.Callback<Metadata>> { public void loadEntityMetadataAsync(String entityName, MetadataCallback callback) { getValueAsync(entityName, Proxy.create(callback)); } MetadataService(Project project, MetadataSimpleService metadataService, RestService restService); Metadata getEntityMetadata(String entityName); void loadEntityMetadataAsync(String entityName, MetadataCallback callback); Metadata getCachedEntityMetadata(String entityType); Exception getCachedFailure(String entityType);  }