Package org.drools.guvnor.client.rpc

Examples of org.drools.guvnor.client.rpc.AssetPageRequest


    @Test
    public void testGetAssetCountFormatInList() throws SerializationException {
        RulesRepository rulesRepository = mock( RulesRepository.class );
        RepositoryAssetOperations repositoryAssetOperations = new RepositoryAssetOperations();
        repositoryAssetOperations.setRulesRepository( rulesRepository );
        AssetPageRequest assetPageRequest = new AssetPageRequest( "uuid",
                                                                  Arrays.asList( "formatInList" ),
                                                                  null );
        PackageItem packageItem = mock( PackageItem.class );
        when( rulesRepository.loadPackageByUUID( Mockito.anyString() ) ).thenReturn( packageItem );

        AssetItemIterator assetItemIterator = mock( AssetItemIterator.class );
        when( packageItem.listAssetsByFormat( assetPageRequest.getFormatInList() ) ).thenReturn( assetItemIterator );
        when( assetItemIterator.getSize() ).thenReturn( 0l );
       
        long count = repositoryAssetOperations.getAssetCount( assetPageRequest );

        assertEquals( 0,
                      count );
        verify( packageItem ).listAssetsByFormat( assetPageRequest.getFormatInList() );
    }
View Full Code Here


    @Test
    public void testGetAssetCountFormatInList2() throws SerializationException {
        RulesRepository rulesRepository = mock( RulesRepository.class );
        RepositoryAssetOperations repositoryAssetOperations = new RepositoryAssetOperations();
        repositoryAssetOperations.setRulesRepository( rulesRepository );
        AssetPageRequest assetPageRequest = new AssetPageRequest( "uuid",
                                                                  Arrays.asList( "formatInList" ),
                                                                  null );
        PackageItem packageItem = mock( PackageItem.class );
        when( rulesRepository.loadPackageByUUID( Mockito.anyString() ) ).thenReturn( packageItem );

        AssetItem a1 = mock( AssetItem.class );
        when( a1.getFormat() ).thenReturn( "formatInList" );
        when( a1.getCreatedDate() ).thenReturn( Calendar.getInstance() );
        when( a1.getLastModified() ).thenReturn( Calendar.getInstance() );

        AssetItemIterator assetItemIterator = mock( AssetItemIterator.class );
        when( packageItem.listAssetsByFormat( assetPageRequest.getFormatInList() ) ).thenReturn( assetItemIterator );
        when( assetItemIterator.getSize() ).thenReturn( 1l );

        long count = repositoryAssetOperations.getAssetCount( assetPageRequest );

        assertEquals( 1,
                      count );

        verify( packageItem ).listAssetsByFormat( assetPageRequest.getFormatInList() );
    }
View Full Code Here

    @Test
    public void testGetAssetCountFormatInList3() throws SerializationException {
        RulesRepository rulesRepository = mock( RulesRepository.class );
        RepositoryAssetOperations repositoryAssetOperations = new RepositoryAssetOperations();
        repositoryAssetOperations.setRulesRepository( rulesRepository );
        AssetPageRequest assetPageRequest = new AssetPageRequest( "uuid",
                                                                  null,
                                                                  false );
        PackageItem packageItem = mock( PackageItem.class );
        when( rulesRepository.loadPackageByUUID( Mockito.anyString() ) ).thenReturn( packageItem );
View Full Code Here

           
            //Load drools.package first if it exists           
            try {
                List<String> formats = new ArrayList<String>();
                formats.add("package");
                AssetPageRequest request = new AssetPageRequest(jcrModule.getUuid(),
                        formats,
                        null,
                        0,
                        10);
                PageResponse<AssetPageRow> response = jcrRepositoryAssetService.findAssetPage(request);
                if (response.getTotalRowSize() >0) {
                    AssetPageRow row = response.getPageRowList().get(0);
                    AssetItem assetItemJCR = rulesRepository.loadAssetByUUID(row.getUuid());
                    header = assetItemJCR.getContent();
                }

            } catch (SerializationException e) {
              Jcr2VfsMigrationApp.hasErrors = true;
                throw new IllegalStateException(e);
            }
           
           
            boolean hasMorePages = true;
            int startRowIndex = 0;
            final int pageSize = 100;
            PageResponse<AssetPageRow> response;
            while (hasMorePages) {
                AssetPageRequest request = new AssetPageRequest(jcrModule.getUuid(),
                        null, // get all formats
                        null,
                        startRowIndex,
                        pageSize);
               
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.rpc.AssetPageRequest

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.