NdsBeisEsb/src/test/java/com/northgateps/nds/beis/esb/beisregistration/BeisRegistrationCamelSpringTestSupport.java
/**
     * Call the retrieve camel route to get the details out    
     */
Call the retrieve camel route to get the details out
Call the retrieve camel route to get the details out
public RetrieveRegisteredDetailsNdsResponse retrieveRegistrationDetails(String tenant, String username,MockNdsDirectoryKernel mockNdsDirectoryKernel)
            throws Exception {
        assumeTrue(connection);
        context.getRouteDefinition(retrieveRouteName).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                replaceFromWith(restrieveStartName);
                weaveAddLast().to(MOCK_RETRIEVE_FL_RESPONSE_CHECK);
                replaceFromWith(restrieveStartName);
                context.getRouteDefinition(RETRIEVE_SUB_ROUTE_NAME_UNDER_TEST).adviceWith(context,
                        new AdviceWithRouteBuilder() {
                    @Override
                    public void configure() throws Exception {
                        interceptSendToEndpoint("cxf:bean:beisGetPartyDetailsService").skipSendToOriginalEndpoint().to(
                                MOCK_RETRIEVE_FL_REQUEST_CHECK).process(new Processor() {
                            @Override
                            public void process(Exchange exchange) throws Exception {
                                exchange.getIn().setBody(createGetPartyDetailsResponse());
                            }
                        });                        
                    }
                });
                DirectoryManager directoryManager = new DirectoryManager();
                directoryManager.setKernel(mockNdsDirectoryKernel);
                UserManager userManager = new UserManager();
                userManager.setDirectoryManager(directoryManager);
                RetrieveRegisteredDetailsRetrieveAccountIdLdapComponent retrieveLdapComponent = new RetrieveRegisteredDetailsRetrieveAccountIdLdapComponent();
                retrieveLdapComponent.setDirectoryManager(directoryManager);
                retrieveLdapComponent.setUserManager(userManager);
                weaveById("retrieveRegisteredDetailsRetrieveAccountIdLdapComponent.process").replace().bean(retrieveLdapComponent, "process");
            }
        });
        context.start();
        RetrieveRegisteredDetailsNdsRequest request = new RetrieveRegisteredDetailsNdsRequest();
        request.setTenant(tenant);
        request.setUsername(username);
        RetrieveRegisteredDetailsNdsResponse response = (RetrieveRegisteredDetailsNdsResponse) apiRetrieveEndpoint.requestBody(
                request);
        return response;
    }
public RetrieveRegisteredDetailsNdsResponse retrieveRegistrationDetails ( String tenant , String username , MockNdsDirectoryKernel mockNdsDirectoryKernel ) throws Exception { assumeTrue ( connection ) ; context . getRouteDefinition ( retrieveRouteName ) . adviceWith ( context , new AdviceWithRouteBuilder ( ) { @ Override public void configure ( ) throws Exception { replaceFromWith ( restrieveStartName ) ; weaveAddLast ( ) . to ( MOCK_RETRIEVE_FL_RESPONSE_CHECK ) ; replaceFromWith ( restrieveStartName ) ; context . getRouteDefinition ( RETRIEVE_SUB_ROUTE_NAME_UNDER_TEST ) . adviceWith ( context , new AdviceWithRouteBuilder ( ) { @ Override public void configure ( ) throws Exception { interceptSendToEndpoint ( "cxf:bean:beisGetPartyDetailsService" ) . skipSendToOriginalEndpoint ( ) . to ( MOCK_RETRIEVE_FL_REQUEST_CHECK ) . process ( new Processor ( ) { @ Override public void process ( Exchange exchange ) throws Exception { exchange . getIn ( ) . setBody ( createGetPartyDetailsResponse ( ) ) ; } } ) ; } } ) ; DirectoryManager directoryManager = new DirectoryManager ( ) ; directoryManager . setKernel ( mockNdsDirectoryKernel ) ; UserManager userManager = new UserManager ( ) ; userManager . setDirectoryManager ( directoryManager ) ; RetrieveRegisteredDetailsRetrieveAccountIdLdapComponent retrieveLdapComponent = new RetrieveRegisteredDetailsRetrieveAccountIdLdapComponent ( ) ; retrieveLdapComponent . setDirectoryManager ( directoryManager ) ; retrieveLdapComponent . setUserManager ( userManager ) ; weaveById ( "retrieveRegisteredDetailsRetrieveAccountIdLdapComponent.process" ) . replace ( ) . bean ( retrieveLdapComponent , "process" ) ; } } ) ; context . start ( ) ; RetrieveRegisteredDetailsNdsRequest request = new RetrieveRegisteredDetailsNdsRequest ( ) ; request . setTenant ( tenant ) ; request . setUsername ( username ) ; RetrieveRegisteredDetailsNdsResponse response = ( RetrieveRegisteredDetailsNdsResponse ) apiRetrieveEndpoint . requestBody ( request ) ; return response ; }
Call the retrieve camel route to get the details out
Call the retrieve camel route to get the details out
// Mock out the call to foundation layer from the sub route // This sub route is invoked by registration and requires mocking // Mock out a response // create and make the request