@Test
public void testRedirect() throws Exception {
Config config = ConfigFactory.empty();
SharedResourcesBrokerImpl<GobblinScopeTypes> topBroker = SharedResourcesBrokerFactory.createDefaultTopLevelBroker(config,
GobblinScopeTypes.GLOBAL.defaultScopeInstance());
SharedResourcesBrokerImpl<GobblinScopeTypes> jobBroker =
topBroker.newSubscopedBuilder(new JobScopeInstance("myJob", "job123")).build();
TestFactory.SharedResource resource =
jobBroker.getSharedResourceAtScope(new TestFactoryWithRedirect<GobblinScopeTypes>(), new TestResourceKey("myKey"), GobblinScopeTypes.JOB);
Assert.assertEquals(resource.getKey(), "myKey");
Assert.assertEquals(topBroker.getSharedResourceAtScope(new TestFactoryWithRedirect<GobblinScopeTypes>(), new TestResourceKey("myKey"), GobblinScopeTypes.GLOBAL),
resource);
Assert.assertEquals(topBroker.getSharedResourceAtScope(new TestFactory<GobblinScopeTypes>(), new TestResourceKey("myKey"), GobblinScopeTypes.GLOBAL),
resource);
}