@BeforeMethod(alwaysRun = true) @Override public void setUp() throws Exception { super.setUp(); added = Lists.newCopyOnWriteArrayList(); removed = Lists.newCopyOnWriteArrayList(); app.subscribe( app, AbstractEntity.CHILD_ADDED, new SensorEventListener<Entity>() { @Override public void onEvent(SensorEvent<Entity> event) { added.add(event.getValue()); } }); app.subscribe( app, AbstractEntity.CHILD_REMOVED, new SensorEventListener<Entity>() { @Override public void onEvent(SensorEvent<Entity> event) { removed.add(event.getValue()); } }); }
@BeforeMethod(alwaysRun = true) @Override public void setUp() throws Exception { mementoDir = Files.createTempDir(); mgmt = RebindTestUtils.newPersistingManagementContext(mementoDir, classLoader); super.setUp(); }
@BeforeMethod(alwaysRun = true) @Override public void setUp() throws Exception { super.setUp(); loc = new SimulatedLocation(); entity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); driver = new MyEntityDriver(entity, loc); }
@BeforeMethod(alwaysRun = true) @Override public void setUp() throws Exception { super.setUp(); loc1 = mgmt.getLocationManager().createLocation(LocationSpec.create(SimulatedLocation.class)); loc2 = mgmt.getLocationManager().createLocation(LocationSpec.create(SimulatedLocation.class)); entity1 = app.createAndManageChild(EntitySpec.create(TestEntity.class)); }
@AfterMethod(alwaysRun = true) @Override public void tearDown() throws Exception { super.tearDown(); if (newApp != null) Entities.destroyAll(newApp.getManagementContext()); if (newManagementContext != null) Entities.destroyAll(newManagementContext); if (mementoDir != null) RebindTestUtils.deleteMementoDir(mementoDir); }
@BeforeMethod(alwaysRun = true) @Override public void setUp() throws Exception { super.setUp(); loc = app.newSimulatedLocation(); entity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); otherEntity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); listener = new RecordingSensorEventListener(); policy = new AbstractPolicy() {}; entity.addPolicy(policy); app.start(ImmutableList.of(loc)); }