MetadataQueryRestriction restriction = componentPropertyEquals(P_ID, TEST_COMPONENT_ID_1);
// count should be 2
assertThat(componentStore.countAssets(TestAsset.class, restriction), is(2L));
MetadataQuery query = new MetadataQuery().restriction(restriction).orderBy(P_DOWNLOAD_COUNT, true);
List<TestAsset> results = componentStore.findAssets(TestAsset.class, query);
// query should return component1's assets in ascending order of path
assertThat(results.size(), is(2));
checkAsset(results.get(0), TEST_COMPONENT_1.getId(), 1);