@Test public void testUpdateWifi() { try { Tenant t1 = entityFactory.buildTenant(); t1.setName(user1.getEntityIDAsString()); t1.setId(new Long(2)); RawContextNotification notification = createNotification(t1,user1,wifi); rawContextUpdater.contextChanged(notification); Connectivity conn = liveContextService.get(Connectivity.class); assertTrue(conn.getAllConnection().hasNext()); } catch (Exception e) { fail(e.getMessage()); } }
@Override public void contextChanged(RawContextNotification notification) throws Exception { String name = notification.getName(); logger.debug("Raw WiFi Context notification received: " + name); StringTokenizer tok = new StringTokenizer(name,","); IEntity entity = Factory.createEntity(tok.nextToken()); IScope scope = Factory.createScope(tok.nextToken()); Tenant t = new Tenant(); t.setId(notification.getTenant()); IContextDataset dataset; try { dataset = this.contextProcessor.getContext(t,entity, scope); if (!dataset.equals(IContextDataset.EMPTY_CONTEXT_DATASET)) { IContextElement[] ces = dataset.getContextElements(scope); if (ces != null && ces.length == 1) { this.rawContextQueue.add(ces[0]); update(); } } } catch (ContextException e) { logger.error(e.toString()); } }
WiFiContextUpdater implements LiveContextUpdater, IContextListener { @Override public void contextChanged(RawContextNotification notification) throws Exception { String name = notification.getName(); logger.debug("Raw WiFi Context notification received: " + name); StringTokenizer tok = new StringTokenizer(name,","); IEntity entity = Factory.createEntity(tok.nextToken()); IScope scope = Factory.createScope(tok.nextToken()); Tenant t = new Tenant(); t.setId(notification.getTenant()); IContextDataset dataset; try { dataset = this.contextProcessor.getContext(t,entity, scope); if (!dataset.equals(IContextDataset.EMPTY_CONTEXT_DATASET)) { IContextElement[] ces = dataset.getContextElements(scope); if (ces != null && ces.length == 1) { this.rawContextQueue.add(ces[0]); update(); } } } catch (ContextException e) { logger.error(e.toString()); } } }
WiFiContextUpdater implements LiveContextUpdater, IContextListener { @Override public void contextChanged(RawContextNotification notification) throws Exception { String name = notification.getName(); logger.debug("Raw WiFi Context notification received: " + name); StringTokenizer tok = new StringTokenizer(name,","); IEntity entity = Factory.createEntity(tok.nextToken()); IScope scope = Factory.createScope(tok.nextToken()); Tenant t = new Tenant(); t.setId(notification.getTenant()); IContextDataset dataset; try { dataset = this.contextProcessor.getContext(t,entity, scope); if (!dataset.equals(IContextDataset.EMPTY_CONTEXT_DATASET)) { IContextElement[] ces = dataset.getContextElements(scope); if (ces != null && ces.length == 1) { this.rawContextQueue.add(ces[0]); update(); } } } catch (ContextException e) { logger.error(e.toString()); } }  }
WiFiContextUpdater implements LiveContextUpdater, IContextListener { @Override public void contextChanged(RawContextNotification notification) throws Exception { String name = notification.getName(); logger.debug("Raw WiFi Context notification received: " + name); StringTokenizer tok = new StringTokenizer(name,","); IEntity entity = Factory.createEntity(tok.nextToken()); IScope scope = Factory.createScope(tok.nextToken()); Tenant t = new Tenant(); t.setId(notification.getTenant()); IContextDataset dataset; try { dataset = this.contextProcessor.getContext(t,entity, scope); if (!dataset.equals(IContextDataset.EMPTY_CONTEXT_DATASET)) { IContextElement[] ces = dataset.getContextElements(scope); if (ces != null && ces.length == 1) { this.rawContextQueue.add(ces[0]); update(); } } } catch (ContextException e) { logger.error(e.toString()); } }  void setContextProcessor(IContextProcessor contextProcessor); void setConnectionProvider(ConnectionProvider connectionProvider); void setTenantManager(TenantManager tenantManager); void init(); @Override void contextChanged(RawContextNotification notification); @Override void update(); }
WiFiContextUpdater implements LiveContextUpdater, IContextListener { @Override public void contextChanged(RawContextNotification notification) throws Exception { String name = notification.getName(); logger.debug("Raw WiFi Context notification received: " + name); StringTokenizer tok = new StringTokenizer(name,","); IEntity entity = Factory.createEntity(tok.nextToken()); IScope scope = Factory.createScope(tok.nextToken()); Tenant t = new Tenant(); t.setId(notification.getTenant()); IContextDataset dataset; try { dataset = this.contextProcessor.getContext(t,entity, scope); if (!dataset.equals(IContextDataset.EMPTY_CONTEXT_DATASET)) { IContextElement[] ces = dataset.getContextElements(scope); if (ces != null && ces.length == 1) { this.rawContextQueue.add(ces[0]); update(); } } } catch (ContextException e) { logger.error(e.toString()); } }  void setContextProcessor(IContextProcessor contextProcessor); void setConnectionProvider(ConnectionProvider connectionProvider); void setTenantManager(TenantManager tenantManager); void init(); @Override void contextChanged(RawContextNotification notification); @Override void update();  }