public boolean readyToSend() { if (!initialized) { //can't send to a non-initialized endpoint. This is a program fault throw new IllegalStateException("not initialized, " + "endpoint must be in initialized state"); } return context != null && context.readyToSend(); }
public boolean readyToSend() { if (!initialized) { //can't send to a non-initialized endpoint. This is a program fault throw new IllegalStateException("not initialized, " + "endpoint must be in initialized state"); } return context != null && context.readyToSend(); }
/** * Return the number of ready children for this endpoint * @return the number of ready children for this endpoint * @throws Exception */ public int getReadyChildren() throws Exception { if (endpoint.getChildren() == null) { return 0; } else { int readyCount = 0; for (Endpoint e : endpoint.getChildren()) { if (e.getContext().readyToSend()) { readyCount++; } } return readyCount; } }
/** * Return the number of ready children for this endpoint * @return the number of ready children for this endpoint * @throws Exception */ public int getReadyChildren() throws Exception { if (endpoint.getChildren() == null) { return 0; } else { int readyCount = 0; for (Endpoint e : endpoint.getChildren()) { if (e.getContext().readyToSend()) { readyCount++; } } return readyCount; } }
/** * Asserts if the the endpoint view correctly returns the number of child endpoints in the ready state. * * @throws Exception if an error occurs while accessing child endpoints */ public void testGetReadyChildren() throws Exception { AbstractEndpoint endpoint = createMockEndPoint(3); EndpointView endpointView = new EndpointView("endpoint", endpoint); Mockito.when(endpoint.getChildren().get(0).getContext().readyToSend()).thenReturn(true); Assert.assertEquals("Incorrect ready children count", 1, endpointView.getReadyChildren()); endpointView = createMockEndPointView(0); Assert.assertEquals("Ready children count should be empty", 0, endpointView.getReadyChildren()); }
if(!ep.getContext().readyToSend()) { return;