Search in sources :

Example 1 with SecurityPolicy

use of org.cometd.bayeux.server.SecurityPolicy in project ddf by codice.

the class CometdEndpointTest method testCanHandshakeRegistersUserWithNotificationController.

/**
     * Test method that verifies the {@link org.cometd.bayeux.server.SecurityPolicy#canHandshake(BayeuxServer, ServerSession, ServerMessage)}
     * method of the custom {@link org.cometd.bayeux.server.SecurityPolicy}
     * associated with the {@link org.cometd.bayeux.server.BayeuxServer} created
     * by the {@link CometdEndpoint} registers users with the
     * {@link org.codice.ddf.ui.searchui.query.controller.NotificationController}.
     *
     * @throws ServletException
     */
@Test
@Ignore
public void testCanHandshakeRegistersUserWithNotificationController() throws ServletException {
    cometdEndpoint.init(servletConfig);
    SecurityPolicy securityPolicy = bayeuxServer.getSecurityPolicy();
    assertNotNull("BayeuxServer's SecurityPolicy is null", securityPolicy);
    // Verify that the mock ServerSession is not already being managed by
    // the org.codice.ddf.ui.searchui.query.controller.NotificationController
    assertNull(cometdEndpoint.notificationController.getSessionByUserId(MOCK_SESSION_ID));
    // Invoke the canHandshake method of the SecurityPolicy
    securityPolicy.canHandshake(bayeuxServer, mockServerSession, mockServerMessage);
    // Verify that the user userId/ServerSession pair are now being managed
    // by the org.codice.ddf.ui.searchui.query.controller.NotificationController
    assertEquals("NotificationController did not return the expected ServerSession", mockServerSession, cometdEndpoint.notificationController.getSessionByUserId(MOCK_SESSION_ID));
}
Also used : SecurityPolicy(org.cometd.bayeux.server.SecurityPolicy) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

SecurityPolicy (org.cometd.bayeux.server.SecurityPolicy)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1