}
@Test
@Deprecated
public void testListByFormat() throws Exception {
RepositoryService impl = getServiceImplementation();
RepositoryCategoryService repositoryCategoryService = getRepositoryCategoryService();
RepositoryPackageService repositoryPackageService = getRepositoryPackageService();
String cat = "testListByFormat";
repositoryCategoryService.createCategory( "/",
cat,
"ya" );
String pkgUUID = repositoryPackageService.createPackage( "testListByFormat",
"used for listing by format." );
String uuid = impl.createNewRule( "testListByFormat",
"x",
cat,
"testListByFormat",
"testListByFormat" );
@SuppressWarnings("unused")
String uuid2 = impl.createNewRule( "testListByFormat2",
"x",
cat,
"testListByFormat",
"testListByFormat" );
String uuid3 = impl.createNewRule( "testListByFormat3",
"x",
cat,
"testListByFormat",
"testListByFormat" );
@SuppressWarnings("unused")
String uuid4 = impl.createNewRule( "testListByFormat4",
"x",
cat,
"testListByFormat",
"testListByFormat" );
RepositoryAssetService repositoryAssetService = getRepositoryAssetService();
TableDataResult res = repositoryAssetService.listAssets( pkgUUID,
arr( "testListByFormat" ),
0,
-1,
ExplorerNodeConfig.RULE_LIST_TABLE_ID );
assertEquals( 4,
res.data.length );
assertEquals( uuid,
res.data[0].id );
assertEquals( "testListByFormat",
res.data[0].values[0] );
res = repositoryAssetService.listAssets( pkgUUID,
arr( "testListByFormat" ),
0,
4,
ExplorerNodeConfig.RULE_LIST_TABLE_ID );
assertEquals( 4,
res.data.length );
res = repositoryAssetService.listAssets( pkgUUID,
arr( "testListByFormat" ),
0,
2,
ExplorerNodeConfig.RULE_LIST_TABLE_ID );
assertEquals( 2,
res.data.length );
assertEquals( uuid,
res.data[0].id );
assertEquals( 4,
res.total );
assertTrue( res.hasNext );
res = repositoryAssetService.listAssets( pkgUUID,
arr( "testListByFormat" ),
2,
2,
ExplorerNodeConfig.RULE_LIST_TABLE_ID );
assertEquals( 2,
res.data.length );
assertEquals( uuid3,
res.data[0].id );
assertEquals( 4,
res.total );
assertFalse( res.hasNext );
uuid = impl.createNewRule( "testListByFormat5",
"x",
cat,
"testListByFormat",
"otherFormat" );