List of usage examples for junit.framework Assert assertNull
static public void assertNull(Object object)
From source file:org.bgp4j.netty.fsm.InternalFSMTest.java
/** * check if the machine is in connect state and that the timer are in the following states: * <ul>//ww w . j av a2 s.c o m * <li><b>Connect retry timer:</b> Running if the delay open timer must be not running, not running if the open dealy timer must be running * <li><b>Delay open timer:</b> Conditionally checked * <li><b>Idle hold timer:</b>Not running * <li><b>hold timer:</b>Not running * <li><b>Keepalive timer:</b>Not running * </ul> * This method does not check the connect retry counter because it is irrelevant for the machine to transition to the idle state. * @throws Exception */ private void assertMachineInConnectState(boolean mustHaveOpenDelayTimer) throws Exception { Assert.assertEquals(FSMState.Connect, fsm.getState()); if (mustHaveOpenDelayTimer) { Assert.assertFalse(fsm.isConnectRetryTimerRunning()); Assert.assertNull(fsm.getConnectRetryTimerDueWhen()); Assert.assertTrue(fsm.isDelayOpenTimerRunning()); Assert.assertNotNull(fsm.getDelayOpenTimerDueWhen()); } else { Assert.assertTrue(fsm.isConnectRetryTimerRunning()); Assert.assertNotNull(fsm.getConnectRetryTimerDueWhen()); Assert.assertFalse(fsm.isDelayOpenTimerRunning()); Assert.assertNull(fsm.getDelayOpenTimerDueWhen()); } Assert.assertFalse(fsm.isHoldTimerRunning()); Assert.assertNull(fsm.getIdleHoldTimerDueWhen()); Assert.assertFalse(fsm.isHoldTimerRunning()); Assert.assertNull(fsm.getHoldTimerDueWhen()); Assert.assertFalse(fsm.isKeepaliveTimerRunning()); Assert.assertNull(fsm.getKeepaliveTimerDueWhen()); }
From source file:org.bgp4j.netty.fsm.InternalFSMTest.java
/** * check if the machine is in active state and that the timer are in the following states: * <ul>/* w w w. j a va2s . c o m*/ * <li><b>Connect retry timer:</b> Running * <li><b>Delay open timer:</b> Conditionally checked * <li><b>Idle hold timer:</b>Not running * <li><b>Hold timer:</b>Not running * <li><b>Keepalive timer:</b>Not running * </ul> * This method does not check the connect retry counter because it is irrelevant for the machine to transition to the active state. * @throws Exception */ private void assertMachineInActiveState(boolean mustHaveConnectRetryTimer, boolean mustHaveOpenDelayTimer) throws Exception { Assert.assertEquals(FSMState.Active, fsm.getState()); if (mustHaveConnectRetryTimer) { Assert.assertTrue(fsm.isConnectRetryTimerRunning()); Assert.assertNotNull(fsm.getConnectRetryTimerDueWhen()); } else { Assert.assertFalse(fsm.isConnectRetryTimerRunning()); Assert.assertNull(fsm.getConnectRetryTimerDueWhen()); } if (mustHaveOpenDelayTimer) { Assert.assertTrue(fsm.isDelayOpenTimerRunning()); Assert.assertNotNull(fsm.getDelayOpenTimerDueWhen()); } else { Assert.assertFalse(fsm.isDelayOpenTimerRunning()); Assert.assertNull(fsm.getDelayOpenTimerDueWhen()); } Assert.assertFalse(fsm.isHoldTimerRunning()); Assert.assertNull(fsm.getIdleHoldTimerDueWhen()); Assert.assertFalse(fsm.isHoldTimerRunning()); Assert.assertNull(fsm.getHoldTimerDueWhen()); Assert.assertFalse(fsm.isKeepaliveTimerRunning()); Assert.assertNull(fsm.getKeepaliveTimerDueWhen()); }
From source file:org.bgp4j.netty.fsm.InternalFSMTest.java
/** * check if the machine is in active state and that the timer are in the following states: * <ul>/*from w w w .j av a 2 s .c o m*/ * <li><b>Connect retry timer:</b> Not running * <li><b>Delay open timer:</b> Not running * <li><b>Idle hold timer:</b>Not running * <li><b>Hold timer:</b>Running * <li><b>Keepalive timer:</b>Not running * </ul> * This method does not check the connect retry counter because it is irrelevant for the machine to transition to the active state. * @throws Exception */ private void assertMachineInOpenSentState(InternalFSMTestBundle testBundle) throws Exception { Assert.assertEquals(FSMState.OpenSent, fsm.getState()); Assert.assertFalse(fsm.isConnectRetryTimerRunning()); Assert.assertNull(fsm.getConnectRetryTimerDueWhen()); Assert.assertFalse(fsm.isDelayOpenTimerRunning()); Assert.assertNull(fsm.getDelayOpenTimerDueWhen()); Assert.assertTrue(fsm.isHoldTimerRunning()); Assert.assertNotNull(fsm.getHoldTimerDueWhen()); Assert.assertFalse(fsm.isIdleHoldTimerRunning()); Assert.assertNull(fsm.getIdleHoldTimerDueWhen()); Assert.assertFalse(fsm.isKeepaliveTimerRunning()); Assert.assertNull(fsm.getKeepaliveTimerDueWhen()); verify(callbacks, atLeastOnce()).fireSendOpenMessage(testBundle.getMatcherArg()); verify(callbacks, atLeastOnce()).fireCompleteBGPLocalInitialization(); }
From source file:org.bgp4j.netty.fsm.InternalFSMTest.java
/** * check if the machine is in active state and that the timer are in the following states: * <ul>/*from ww w.j a va2 s . c o m*/ * <li><b>Connect retry timer:</b> Not running * <li><b>Delay open timer:</b> Not running * <li><b>Idle hold timer:</b>Not running * <li><b>Hold timer:</b>Conditionally checked * <li><b>Keepalive timer:</b>Conditonally checked * </ul> * This method does not check the connect retry counter because it is irrelevant for the machine to transition to the active state. * @throws Exception */ private void assertMachineInOpenConfirm(InternalFSMTestBundle testBundle, boolean mustHaveHoldAndKeepaliveTimer, int numberOfKeepalivesSent, boolean mustHaveSentOpen) throws Exception { Assert.assertEquals(FSMState.OpenConfirm, fsm.getState()); Assert.assertFalse(fsm.isConnectRetryTimerRunning()); Assert.assertNull(fsm.getConnectRetryTimerDueWhen()); Assert.assertFalse(fsm.isDelayOpenTimerRunning()); Assert.assertNull(fsm.getDelayOpenTimerDueWhen()); Assert.assertFalse(fsm.isIdleHoldTimerRunning()); Assert.assertNull(fsm.getIdleHoldTimerDueWhen()); if (mustHaveHoldAndKeepaliveTimer) { Assert.assertTrue(fsm.isHoldTimerRunning()); Assert.assertNotNull(fsm.getHoldTimerDueWhen()); Assert.assertTrue(fsm.isKeepaliveTimerRunning()); Assert.assertNotNull(fsm.getKeepaliveTimerDueWhen()); } else { Assert.assertFalse(fsm.isHoldTimerRunning()); Assert.assertNull(fsm.getHoldTimerDueWhen()); Assert.assertFalse(fsm.isKeepaliveTimerRunning()); Assert.assertNull(fsm.getKeepaliveTimerDueWhen()); } if (mustHaveSentOpen) verify(callbacks).fireSendOpenMessage(testBundle.getMatcherArg()); if (numberOfKeepalivesSent > 0) verify(callbacks, times(numberOfKeepalivesSent)).fireSendKeepaliveMessage(testBundle.getMatcherArg()); else verify(callbacks, never()).fireSendKeepaliveMessage(testBundle.getMatcherArg()); verify(callbacks).fireCompleteBGPLocalInitialization(); verify(callbacks).fireCompleteBGPPeerInitialization(); }
From source file:org.bgp4j.netty.fsm.InternalFSMTest.java
/** * check if the machine is in active state and that the timer are in the following states: * <ul>/*from w w w . j a v a2 s . c om*/ * <li><b>Connect retry timer:</b> Not running * <li><b>Delay open timer:</b> Not running * <li><b>Idle hold timer:</b>Not running * <li><b>Hold timer:</b>Conditionally checked * <li><b>Keepalive timer:</b>Conditonally checked * </ul> * This method does not check the connect retry counter because it is irrelevant for the machine to transition to the active state. * @throws Exception */ private void assertMachineInEstablishedState(InternalFSMTestBundle testBundle, boolean mustHaveHoldAndKeepaliveTimer, int numberOfKeepalivesSent) throws Exception { Assert.assertEquals(FSMState.Established, fsm.getState()); Assert.assertFalse(fsm.isConnectRetryTimerRunning()); Assert.assertNull(fsm.getConnectRetryTimerDueWhen()); Assert.assertFalse(fsm.isDelayOpenTimerRunning()); Assert.assertNull(fsm.getDelayOpenTimerDueWhen()); Assert.assertFalse(fsm.isIdleHoldTimerRunning()); Assert.assertNull(fsm.getIdleHoldTimerDueWhen()); if (mustHaveHoldAndKeepaliveTimer) { Assert.assertTrue(fsm.isHoldTimerRunning()); Assert.assertNotNull(fsm.getHoldTimerDueWhen()); Assert.assertTrue(fsm.isKeepaliveTimerRunning()); Assert.assertNotNull(fsm.getKeepaliveTimerDueWhen()); } else { Assert.assertFalse(fsm.isHoldTimerRunning()); Assert.assertNull(fsm.getHoldTimerDueWhen()); Assert.assertFalse(fsm.isKeepaliveTimerRunning()); Assert.assertNull(fsm.getKeepaliveTimerDueWhen()); } verify(callbacks, times(numberOfKeepalivesSent)).fireSendKeepaliveMessage(testBundle.getMatcherArg()); verify(callbacks).fireEstablished(); }
From source file:org.bgp4j.netty.fsm.InternalFSMTest.java
/** * check if the machine is in idle state and that the timers are in the following state * <ul>/* ww w. ja va 2 s . c om*/ * <li><b>Connect retry timer:</b> Not running * <li><b>Delay open timer:</b> Not running * <li><b>Idle hold timer:</b>Condintially checked * <li><b>Hold timer:</b>Not running * <li><b>Keepalive timer:</b>Not running * </ul> * This method does not check the connect retry counter because it is irrelevant for the machine to transition to the active state. * @throws Exception */ private void assertMachineInIdleState(InternalFSMTestBundle testBundle, boolean musthaveIdleHoldTimer) throws Exception { Assert.assertEquals(FSMState.Idle, fsm.getState()); Assert.assertFalse(fsm.isConnectRetryTimerRunning()); Assert.assertNull(fsm.getConnectRetryTimerDueWhen()); Assert.assertFalse(fsm.isHoldTimerRunning()); Assert.assertNull(fsm.getHoldTimerDueWhen()); Assert.assertFalse(fsm.isDelayOpenTimerRunning()); Assert.assertNull(fsm.getDelayOpenTimerDueWhen()); Assert.assertFalse(fsm.isKeepaliveTimerRunning()); Assert.assertNull(fsm.getKeepaliveTimerDueWhen()); if (musthaveIdleHoldTimer) { Assert.assertTrue(fsm.isIdleHoldTimerRunning()); Assert.assertNotNull(fsm.getIdleHoldTimerDueWhen()); } else { Assert.assertFalse(fsm.isIdleHoldTimerRunning()); Assert.assertNull(fsm.getIdleHoldTimerDueWhen()); } if (testBundle != null) verify(callbacks, atLeastOnce()).fireDisconnectRemotePeer(testBundle.getMatcherArg()); else verify(callbacks, never()).fireDisconnectRemotePeer(argThat(anyChannelMatcher)); verify(callbacks, atLeastOnce()).fireReleaseBGPResources(); }
From source file:org.bgp4j.netty.fsm.InternalFSMTest.java
private void assertMachineInIdleStateWithoutDisconnect(InternalFSMTestBundle testBundle, boolean musthaveIdleHoldTimer) throws Exception { Assert.assertEquals(FSMState.Idle, fsm.getState()); Assert.assertFalse(fsm.isConnectRetryTimerRunning()); Assert.assertNull(fsm.getConnectRetryTimerDueWhen()); Assert.assertFalse(fsm.isHoldTimerRunning()); Assert.assertNull(fsm.getHoldTimerDueWhen()); Assert.assertFalse(fsm.isDelayOpenTimerRunning()); Assert.assertNull(fsm.getDelayOpenTimerDueWhen()); Assert.assertFalse(fsm.isKeepaliveTimerRunning()); Assert.assertNull(fsm.getKeepaliveTimerDueWhen()); if (musthaveIdleHoldTimer) { Assert.assertTrue(fsm.isIdleHoldTimerRunning()); Assert.assertNotNull(fsm.getIdleHoldTimerDueWhen()); } else {// w w w .j a v a 2 s. co m Assert.assertFalse(fsm.isIdleHoldTimerRunning()); Assert.assertNull(fsm.getIdleHoldTimerDueWhen()); } verify(callbacks, never()).fireDisconnectRemotePeer(testBundle.getMatcherArg()); verify(callbacks, atLeastOnce()).fireReleaseBGPResources(); }
From source file:org.cloudifysource.esc.driver.provisioning.softlayer.SoftlayerProvisioningDriverTest.java
/** * Test that the correct module was setup for softlayer. * This module is a one that does not return location, image, and hardware in node meta data. * * Since this is a live test, we don't run it in travis. * * @throws Exception/* w w w . j ava2 s . c o m*/ */ @Ignore @Test public void testSetupModules() throws Exception { SoftlayerProvisioningDriver driver = new SoftlayerProvisioningDriver(); Cloud cloud = createCloud(); driver.setCloudTemplateName("dummy"); driver.initDeployer(cloud); ComputeService compute = ((ComputeServiceContext) driver.getComputeContext()).getComputeService(); Set<? extends ComputeMetadata> computeMetadatas = compute.listNodes(); if (computeMetadatas.isEmpty()) { throw new IllegalStateException("There are no nodes in the account"); } for (ComputeMetadata computeMetadata : computeMetadatas) { NodeMetadata node = (NodeMetadata) computeMetadata; Assert.assertNull(node.getLocation()); Assert.assertNull(node.getHardware()); Assert.assertNull(node.getImageId()); } }
From source file:org.dataconservancy.dcs.ingest.file.impl.FileSystemContentStagerTest.java
@Test public void finishBehaviourTest() throws Exception { StagedFile staged = fsStager.add(IOUtils.toInputStream(CONTENT), null); File file = new File(staged.getAccessURI().replace("file://", "")); Assert.assertNotNull(sipStager.getSIP(staged.getSipRef())); assertTrue(file.exists());/*from ww w.java 2 s . c om*/ fsStager.retire(staged.getReferenceURI()); Assert.assertNull(sipStager.getSIP(staged.getSipRef())); assertTrue(file.exists()); }
From source file:org.ebayopensource.turmeric.eclipse.errorlibrary.DeleteDomain.java
@Test public void deleteDomainTest() throws Exception { final ISOAErrDomain domain = TurmericErrorRegistry.getErrorDomainByName(ERRORLIB_DOMAIN); final IProject project = WorkspaceUtil.getProject(domain.getLibrary().getName()); IFolder domainFolder = TurmericErrorLibraryUtils.getErrorDomainFolder(project, domain.getName()); FileUtils.deleteDirectory(domainFolder.getLocation().toFile()); WorkspaceUtil.refresh(domainFolder.getParent()); TurmericErrorRegistry.removeErrorDomain(domain); //update library property file TurmericErrorLibraryUtils.removeDomainFromProps(project, domain.getName()); IStatus status = EclipseMessageUtils.createErrorStatus( StringUtil.formatString(SOAMessages.ERROR_NO_ERRORDOMAIN_FOLDER, domainFolder.getLocation())); Properties srcProp = new Properties(); InputStream ins = null;/*from w w w . java 2s. c om*/ try { ins = new FileInputStream(new File(ERROR_PROPS)); srcProp.load(ins); } catch (Exception e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(ins); } Assert.assertNull(srcProp.get("listOfDomains")); System.out.println(status.getMessage()); Assert.assertFalse(status.isOK()); }