@Test public void integrationTest() { /* * First, the user creates a requisition in the UI, or RESTful * interface. */ Requisition pendingReq = new Requisition("test"); pendingReq.putNode(createNode("1")); m_pending.save(pendingReq); m_pending.flush(); /* * Then, the user makes a foreign source configuration to go along * with that requisition. */ ForeignSource pendingSource = m_repository.getForeignSource("test"); assertTrue(pendingSource.isDefault()); pendingSource.setDetectors(new ArrayList<PluginConfig>()); m_pending.save(pendingSource); m_pending.flush(); /* * Now we got an import event, so we import that requisition file, * and save it. The ForeignSource in the pending repository should * match the one in the active one, now. */ Requisition activeReq = m_repository.importResourceRequisition( new UrlResource(m_pending.getRequisitionURL("test"))); ForeignSource activeSource = m_active.getForeignSource("test"); // and the foreign source should be the same as the one we made earlier, only this time it's // active assertEquals(activeSource.getName(), pendingSource.getName()); assertEquals(activeSource.getDetectorNames(), pendingSource.getDetectorNames()); assertEquals(activeSource.getScanInterval(), pendingSource.getScanInterval()); assertRequisitionsMatch("active and pending requisitions should match", activeReq, pendingReq); /* * Since it's been officially deployed, the requisition and foreign * source should no longer be in the pending repo. */ assertNull( "the requisition should be null in the pending repo", m_pending.getRequisition("test")); assertTrue( "the foreign source should be default since there's no specific in the pending repo", m_pending.getForeignSource("test").isDefault()); }