Examples of MetadataQueryRestriction


Examples of org.sonatype.nexus.component.services.query.MetadataQueryRestriction

  @Test
  public void queryComponentsWithSimpleComponentRestriction() {
    addTwoTestComponentsWithTwoAssetsEach();

    // SELECT FROM testcomponent WHERE id = 'component1'
    MetadataQueryRestriction restriction = componentPropertyEquals(P_ID, TEST_COMPONENT_ID_1);

    // count should be 1
    assertThat(componentStore.countComponents(TestComponent.class, restriction), is(1L));

    MetadataQuery query = new MetadataQuery().restriction(restriction);
View Full Code Here

Examples of org.sonatype.nexus.component.services.query.MetadataQueryRestriction

  @Test
  public void queryComponentsWithCompoundComponentRestriction() {
    addTwoTestComponentsWithTwoAssetsEach();

    // SELECT FROM testcomponent WHERE (id = 'component1' OR id = 'component2')
    MetadataQueryRestriction restriction = or(
        componentPropertyEquals(P_ID, TEST_COMPONENT_ID_1),
        componentPropertyEquals(P_ID, TEST_COMPONENT_ID_2));

    // count should be 2
    assertThat(componentStore.countComponents(TestComponent.class, restriction), is(2L));
View Full Code Here

Examples of org.sonatype.nexus.component.services.query.MetadataQueryRestriction

  @Test
  public void queryComponentsWithSimpleAssetRestriction() {
    addTwoTestComponentsWithTwoAssetsEach();

    // SELECT FROM testcomponent WHERE assets contains ( downloadCount = 1 )
    MetadataQueryRestriction restriction = assetPropertyEquals(P_DOWNLOAD_COUNT, 1);

    // count should be 1
    assertThat(componentStore.countComponents(TestComponent.class, restriction), is(1L));

    MetadataQuery query = new MetadataQuery().restriction(restriction);
View Full Code Here

Examples of org.sonatype.nexus.component.services.query.MetadataQueryRestriction

  @Test
  public void queryComponentsWithCompoundAssetRestriction() {
    addTwoTestComponentsWithTwoAssetsEach();

    // SELECT FROM testcomponent WHERE (assets contains ( downloadCount = 1 ) OR assets contains ( contentType = 'text/plain' ))
    MetadataQueryRestriction restriction = or(
        assetPropertyEquals(P_DOWNLOAD_COUNT, 1),
        assetPropertyEquals(P_CONTENT_TYPE, "text/plain"));

    // count should be 2
    assertThat(componentStore.countComponents(TestComponent.class, restriction), is(2L));
View Full Code Here

Examples of org.sonatype.nexus.component.services.query.MetadataQueryRestriction

  @Test
  public void queryAssetsWithSimpleAssetRestriction() throws IOException {
    addTwoTestComponentsWithTwoAssetsEach();

    // SELECT FROM testasset WHERE downloadCount = 1
    MetadataQueryRestriction restriction = assetPropertyEquals(P_DOWNLOAD_COUNT, 1);

    // count should be 1
    assertThat(componentStore.countAssets(TestAsset.class, restriction), is(1L));

    MetadataQuery query = new MetadataQuery().restriction(restriction);
View Full Code Here

Examples of org.sonatype.nexus.component.services.query.MetadataQueryRestriction

  @Test
  public void queryAssetsWithCompoundAssetRestriction() throws IOException {
    addTwoTestComponentsWithTwoAssetsEach();

    // SELECT FROM testasset WHERE (downloadCount = 1 OR contentType = 'text/plain')
    MetadataQueryRestriction restriction = or(
        assetPropertyEquals(P_DOWNLOAD_COUNT, 1),
        assetPropertyEquals(P_CONTENT_TYPE, "text/plain"));

    // count should be 2
    assertThat(componentStore.countAssets(TestAsset.class, restriction), is(4L));
View Full Code Here

Examples of org.sonatype.nexus.component.services.query.MetadataQueryRestriction

  @Test
  public void queryAssetsWithSimpleComponentRestriction() throws IOException {
    addTwoTestComponentsWithTwoAssetsEach();

    // SELECT FROM testasset WHERE component.id = 'component1'
    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);
View Full Code Here

Examples of org.sonatype.nexus.component.services.query.MetadataQueryRestriction

  @Test
  public void queryAssetsWithCompoundComponentAndAssetRestrictionUsingLike() throws IOException {
    addTwoTestComponentsWithTwoAssetsEach();

    // SELECT FROM testasset WHERE (component.id = 'component1' AND contentType LIKE '%plain' AND path = "1")
    MetadataQueryRestriction restriction = and(
        componentPropertyEquals(P_ID, TEST_COMPONENT_ID_1),
        assetPropertyLike(P_CONTENT_TYPE, "%plain"),
        assetPropertyEquals(P_PATH, "1"));

    // count should be 1
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.