Package org.apache.agila.services

Examples of org.apache.agila.services.InstanceServiceInfo


    public void testInstanceCount() {
        for( int i = 0; i < 10; i++ ) {
            instanceService.internalCreate( new BusinessProcessID( i ), new HashMap() );
        }

        InstanceServiceInfo instanceSvcInfo = instanceService.getInstanceServiceInfo();

        assertEquals( "Number of instances created and are running should be 10", 10, instanceSvcInfo.getNumRunningInstances() );
    }
View Full Code Here


        Instance instance = dao.newInstance( businessProcessID, appParams );
        assertNotNull( "Instance should not be null", instance );
    }

    public void testGetInstanceServiceInfo() {
        InstanceServiceInfo instanceServiceInfo = dao.getInstanceServiceInfo();

        assertNotNull( "InstanceServiceInfo should not be null", instanceServiceInfo );
    }
View Full Code Here

                case Instance.STATUS_COMPLETE:
                    completed++;
                    break;
            }
        }
        return new InstanceServiceInfo(running, suspended, stopped,
                completed);
    }
View Full Code Here

    /**
     * Retrieve the instance service info.
     */
    public InstanceServiceInfo getInstanceServiceInfo() {
        InstanceServiceInfo retVal = null;

        Connection connection = null;

        try {
            int stopped = 0;
            int suspended = 0;
            int running = 0;
            int completed = 0;

            String sql = "select * from bpm_instance";

            connection = getConnection();

            Statement statement = connection.createStatement();
            ResultSet result = statement.executeQuery( sql );

            while( result.next() ) {
                int status = result.getInt( "status" );

                switch( status ) {
                    case Instance.STATUS_STOPPED:
                        stopped++;
                        break;

                    case Instance.STATUS_SUSPENDED:
                        suspended++;
                        break;

                    case Instance.STATUS_RUNNING:
                        running++;
                        break;

                    case Instance.STATUS_COMPLETE:
                        completed++;
                        break;
                }
            }

            result.close();
            statement.close();

            retVal = new InstanceServiceInfo( running, suspended, stopped,
                completed );
        }
        catch( SQLException e ) {
            throw new RuntimeException( e );
        }
View Full Code Here

                    completed++;
                    break;
            }
        }

        return new InstanceServiceInfo( running, suspended, stopped, completed );
    }
View Full Code Here

TOP

Related Classes of org.apache.agila.services.InstanceServiceInfo

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.