@Test public void testGet() throws NotConfiguredException, IOException, NoSuchScopeException { SharedResourcesBrokerImpl<SimpleScopeType> broker = SharedResourcesBrokerFactory.<SimpleScopeType>createDefaultTopLevelBroker( ConfigFactory.empty(), SimpleScopeType.GLOBAL.defaultScopeInstance()); EventBus eventBus1 = EventBusFactory.get(getClass().getSimpleName(), broker); EventBus eventBus2 = EventBusFactory.get(getClass().getSimpleName(), broker); Assert.assertEquals(eventBus1, eventBus2); SharedResourcesBroker<SimpleScopeType> subBroker = broker.newSubscopedBuilder(new SimpleScope<>(SimpleScopeType.LOCAL, "local")).build(); EventBus eventBus3 = EventBusFactory.get(getClass().getSimpleName(), subBroker); Assert.assertEquals(eventBus1, eventBus3); EventBus eventBus4 = subBroker.getSharedResourceAtScope(new EventBusFactory<>(), new EventBusKey(getClass().getSimpleName()), SimpleScopeType.LOCAL); Assert.assertNotEquals(eventBus3, eventBus4); EventBus eventBus5 = EventBusFactory.get("", broker); Assert.assertNotEquals(eventBus1, eventBus5); }
public static <S extends ScopeType<S>> EventBus get(String eventBusName, SharedResourcesBroker<S> broker) throws IOException { try { return broker.getSharedResource(new EventBusFactory<S>(), new EventBusKey(eventBusName)); } catch (NotConfiguredException e) { throw new IOException(e); } }
EventBusFactory implements SharedResourceFactory<EventBus, EventBusKey, S> { public static <S extends ScopeType<S>> EventBus get(String eventBusName, SharedResourcesBroker<S> broker) throws IOException { try { return broker.getSharedResource(new EventBusFactory<S>(), new EventBusKey(eventBusName)); } catch (NotConfiguredException e) { throw new IOException(e); } } }
EventBusFactory implements SharedResourceFactory<EventBus, EventBusKey, S> { public static <S extends ScopeType<S>> EventBus get(String eventBusName, SharedResourcesBroker<S> broker) throws IOException { try { return broker.getSharedResource(new EventBusFactory<S>(), new EventBusKey(eventBusName)); } catch (NotConfiguredException e) { throw new IOException(e); } }  }
EventBusFactory implements SharedResourceFactory<EventBus, EventBusKey, S> { public static <S extends ScopeType<S>> EventBus get(String eventBusName, SharedResourcesBroker<S> broker) throws IOException { try { return broker.getSharedResource(new EventBusFactory<S>(), new EventBusKey(eventBusName)); } catch (NotConfiguredException e) { throw new IOException(e); } }  @Override String getName(); static EventBus get(String eventBusName, SharedResourcesBroker<S> broker); @Override SharedResourceFactoryResponse<EventBus> createResource(SharedResourcesBroker<S> broker,
      ScopedConfigView<S, EventBusKey> config); @Override S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, EventBusKey> config); }
EventBusFactory implements SharedResourceFactory<EventBus, EventBusKey, S> { public static <S extends ScopeType<S>> EventBus get(String eventBusName, SharedResourcesBroker<S> broker) throws IOException { try { return broker.getSharedResource(new EventBusFactory<S>(), new EventBusKey(eventBusName)); } catch (NotConfiguredException e) { throw new IOException(e); } }  @Override String getName(); static EventBus get(String eventBusName, SharedResourcesBroker<S> broker); @Override SharedResourceFactoryResponse<EventBus> createResource(SharedResourcesBroker<S> broker,
      ScopedConfigView<S, EventBusKey> config); @Override S getAutoScope(SharedResourcesBroker<S> broker, ConfigView<S, EventBusKey> config); static final String FACTORY_NAME; }