Package org.drools.grid.service.directory.impl

Examples of org.drools.grid.service.directory.impl.JpaWhitePages


public class SpringDroolsGridTest {

    @Test
    public void test1() {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.drools.grid" );
        WhitePages wp = new JpaWhitePages( emf );

        wp.create( "s1" );
        wp.create( "s2" );
        wp.create( "s3" );
    }
View Full Code Here


        server.stop();
       
    }
   
    private GridServiceDescription createRemoteNode(){
        wps = new JpaWhitePages( Persistence.createEntityManagerFactory("org.drools.grid") );

        grid1 = new GridImpl("peer1", new HashMap<String, Object>() );
        configureGrid1( grid1,
                        8000,
                        wps );
View Full Code Here

                                                                                                                          l,
                                                                                                                          grid1 ) );
        conf.addConfiguration( socketConf );

        WhitePagesLocalConfiguration wplConf = new WhitePagesLocalConfiguration();
        wplConf.setWhitePages( new JpaWhitePages( Persistence.createEntityManagerFactory( "org.drools.grid" ) ) );
        conf.addConfiguration( wplConf );

        socketConf.addService( WhitePages.class.getName(), wplConf.getWhitePages(), 8000 );

        conf.configure( grid1 );
View Full Code Here

       
    }
    @Test
    public void test1() {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.drools.grid" );
        WhitePages wp = new JpaWhitePages( emf );

        wp.create( "s1", "grid0" );
        wp.create( "s2", "grid0" );
        wp.create( "s3", "grid0" );

        GridServiceDescription<String> gs1 = wp.lookup( "s1" );

        gs1.addAddress( "p1" ).setObject( "v1" );
        gs1.addAddress( "p2" ).setObject( "v2" );

        gs1 = wp.lookup( "s1" );
        assertEquals( 2,
                      gs1.getAddresses().size() );
        assertEquals( "v1",
                      gs1.getAddresses().get( "p1" ).getObject() );
        assertEquals( "v2",
                      gs1.getAddresses().get( "p2" ).getObject() );

        gs1.removeAddress( "p2" );

        gs1 = wp.lookup( "s1" );
        assertEquals( 1,
                      gs1.getAddresses().size() );
        assertEquals( "v1",
                      gs1.getAddresses().get( "p1" ).getObject() );

        wp.remove( "s1" );

        assertNull( wp.lookup( "s1" ) );

        GridServiceDescription gs2 = wp.lookup( "s2" );
        assertNotNull( gs2 );

    }
View Full Code Here


        //Configuring the a local WhitePages service that is being shared with all the grid peers
        WhitePagesLocalConfiguration wplConf = new WhitePagesLocalConfiguration();

        wplConf.setWhitePages( new JpaWhitePages( emf ) );
        conf.addConfiguration(wplConf);

        conf.configure(gridHelper);

View Full Code Here

    public static void reset() {
        if ( emf != null && emf.isOpen() ) {
            emf.close();
        }
        emf = Persistence.createEntityManagerFactory( "org.drools.grid" );
        whitePages = new JpaWhitePages( emf );
    }
View Full Code Here

   
    private GridServiceDescription createRemoteNode(){
        grid1 = new GridImpl("peer1", new HashMap<String, Object>() );
        configureGrid1( grid1,
                        8000,
                        new JpaWhitePages(Persistence.createEntityManagerFactory("org.drools.grid")) );

        Grid grid2 = new GridImpl("peer2", new HashMap<String, Object>() );
        configureGrid1( grid2,
                        -1,
                        grid1.get( WhitePages.class ) );
View Full Code Here

                                                                                                                          l,
                                                                                                                          grid1 ) );
        conf.addConfiguration( socketConf );

        WhitePagesLocalConfiguration wplConf = new WhitePagesLocalConfiguration();
        wplConf.setWhitePages( new JpaWhitePages( Persistence.createEntityManagerFactory( "org.drools.grid" ) ) );
        conf.addConfiguration( wplConf );

        socketConf.addService( WhitePages.class.getName(), wplConf.getWhitePages(), 8000 );

        conf.configure( grid1 );
View Full Code Here

       
    }
    @Test
    public void test1() {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.drools.grid" );
        WhitePages wp = new JpaWhitePages( emf );

        wp.create( "s1" );
        wp.create( "s2" );
        wp.create( "s3" );

        GridServiceDescription<String> gs1 = wp.lookup( "s1" );

        gs1.addAddress( "p1" ).setObject( "v1" );
        gs1.addAddress( "p2" ).setObject( "v2" );

        gs1 = wp.lookup( "s1" );
        assertEquals( 2,
                      gs1.getAddresses().size() );
        assertEquals( "v1",
                      gs1.getAddresses().get( "p1" ).getObject() );
        assertEquals( "v2",
                      gs1.getAddresses().get( "p2" ).getObject() );

        gs1.removeAddress( "p2" );

        gs1 = wp.lookup( "s1" );
        assertEquals( 1,
                      gs1.getAddresses().size() );
        assertEquals( "v1",
                      gs1.getAddresses().get( "p1" ).getObject() );

        wp.remove( "s1" );

        assertNull( wp.lookup( "s1" ) );

        GridServiceDescription gs2 = wp.lookup( "s2" );
        assertNotNull( gs2 );

    }
View Full Code Here

   
    private GridServiceDescription createRemoteNode(){
        grid1 = new GridImpl("peer1", new HashMap<String, Object>() );
        configureGrid1( grid1,
                        8000,
                        new JpaWhitePages(Persistence.createEntityManagerFactory("org.drools.grid")) );

        Grid grid2 = new GridImpl("peer2", new HashMap<String, Object>() );
        configureGrid1( grid2,
                        -1,
                        grid1.get( WhitePages.class ) );
View Full Code Here

TOP

Related Classes of org.drools.grid.service.directory.impl.JpaWhitePages

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.