Package org.springframework.richclient.security

Examples of org.springframework.richclient.security.SecurityControllerManager


    String objectName = "bogusSecurityControllable";
    String securityControllerId = "bogusSecurityControllerId";

    // create the required mock objects
    SecurityControllerManager controllerManager = (SecurityControllerManager) EasyMock
        .createMock(SecurityControllerManager.class);
    SecurityControllable controllable = (SecurityControllable) EasyMock.createMock(SecurityControllable.class);
    SecurityController controller = (SecurityController) EasyMock.createMock(SecurityController.class);

    // Create the configurer with the mock security controller manager
    DefaultApplicationObjectConfigurer configurer = new DefaultApplicationObjectConfigurer(null, null, null,
        controllerManager);

    // Set the expectations for this run. The security controller manager
    // has not been provided
    // with the controller for the given controller id yet so we don't
    // expect the controllable
    // to be added to the controllerManager as a controlled object
    EasyMock.expect(controllable.getSecurityControllerId()).andReturn(securityControllerId);
    EasyMock.expect(controllerManager.getSecurityController(securityControllerId)).andReturn(null);

    // switch to replay mode...
    EasyMock.replay(controllable);
    EasyMock.replay(controllerManager);
    EasyMock.replay(controller);

    // run the test...
    configurer.configure(controllable, objectName);

    // and verify the results...
    EasyMock.verify(controllable);
    EasyMock.verify(controllerManager);
    EasyMock.verify(controller);

    // reset the mocks for the next part of the test
    EasyMock.reset(controllable);
    EasyMock.reset(controllerManager);
    EasyMock.reset(controller);

    // Set the expectations for the next test. This time we want the
    // controller manager to find
    // the controller for the given id and we expect the controllable to be
    // added to the
    // controller manager as a controlled object
    EasyMock.expect(controllable.getSecurityControllerId()).andReturn(securityControllerId);
    EasyMock.expect(controllerManager.getSecurityController(securityControllerId)).andReturn(controller);
    controller.addControlledObject(controllable);

    // switch to replay mode...
    EasyMock.replay(controllable);
    EasyMock.replay(controllerManager);
View Full Code Here

TOP

Related Classes of org.springframework.richclient.security.SecurityControllerManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.