private WellBeanBeed createWellBeanBeed(Long cq) { try { WellBeanBeed wellBeanBeed = new WellBeanBeed(); LongEdit edit = new LongEdit(wellBeanBeed.cq); edit.setGoal(cq); edit.perform(); assertEquals(wellBeanBeed.cq.get(), cq); return wellBeanBeed; } catch (EditStateException e) { assertTrue(false); return null; } catch (IllegalEditException e) { assertTrue(false); return null; } }
@Before public void setUp() throws Exception { $owner = new StubBeanBeed(); $unionBeed = new MyUnionBeed(); $run = new RunBeanBeed(); $wellNull = new WellBeanBeed(); $well0 = new WellBeanBeed(); $well1 = new WellBeanBeed(); $well2 = new WellBeanBeed(); $well3 = new WellBeanBeed(); $cqNull = null; $cq0 = new Long(0); $cq1 = new Long(1); $cq2 = new Long(2); $cq3 = new Long(3); $listener3 = new StubListener<SetEvent<WellBeanBeed>>(); $listener5 = new StubListener<ActualLongEvent>(); // add the wells to the run BidirToOneEdit<RunBeanBeed, WellBeanBeed> edit = new BidirToOneEdit<RunBeanBeed, WellBeanBeed>($wellNull.run); edit.setGoal($run.wells); edit.perform(); edit = new BidirToOneEdit<RunBeanBeed, WellBeanBeed>($well0.run); edit.setGoal($run.wells); edit.perform(); edit = new BidirToOneEdit<RunBeanBeed, WellBeanBeed>($well1.run); edit.setGoal($run.wells); edit.perform(); edit = new BidirToOneEdit<RunBeanBeed, WellBeanBeed>($well2.run); edit.setGoal($run.wells); edit.perform(); edit = new BidirToOneEdit<RunBeanBeed, WellBeanBeed>($well3.run); edit.setGoal($run.wells); edit.perform(); // initialise the cq values LongEdit longEdit = new LongEdit($wellNull.cq); longEdit.setGoal($cqNull); longEdit.perform(); longEdit = new LongEdit($well0.cq); longEdit.setGoal($cq0); longEdit.perform(); longEdit = new LongEdit($well1.cq); longEdit.setGoal($cq1); longEdit.perform(); longEdit = new LongEdit($well2.cq); longEdit.setGoal($cq2); longEdit.perform(); longEdit = new LongEdit($well3.cq); longEdit.setGoal($cq3); longEdit.perform(); // initialise the set beeds $setBeed1 = createSetBeed($well1, $well2); $setBeed2 = createSetBeed($well3); $setBeed3 = createSetBeed($well0, $well1, $well3); // initialise the source $source = new EditableSetBeed<SetBeed<WellBeanBeed, SetEvent<WellBeanBeed>>>($owner); addElement($source, $setBeed1); addElement($source, $setBeed2); addElement($source, $setBeed3); }