Package org.sonatype.nexus.rest.indextreeview

Examples of org.sonatype.nexus.rest.indextreeview.IndexBrowserTreeNodeDTO


    XStreamRepresentation re = new XStreamRepresentation(xstream, responseText, MediaType.APPLICATION_XML);
    IndexBrowserTreeViewResponseDTO resourceResponse =
        (IndexBrowserTreeViewResponseDTO) re.getPayload(new IndexBrowserTreeViewResponseDTO());

    IndexBrowserTreeNodeDTO content = resourceResponse.getData();

    for (IndexBrowserTreeNodeDTO child : content.getChildren()) {
      Assert.assertEquals(child.getNodeName(), "nexus1961");
    }
  }
View Full Code Here


        getSearchMessageUtil().indexBrowserTreeView(REPO_TEST_HARNESS_REPO, "/");

    Assert.assertEquals("There is one \"nexus3670\" group!", response.getData().getChildren().size(), 1);

    // this is the G node of the "nexus3670" groupId (note: on G nodes, only the path is filled, but not the GAV!)
    IndexBrowserTreeNodeDTO node = (IndexBrowserTreeNodeDTO) response.getData().getChildren().get(0);

    // check path (note leading and trailing slashes!)
    Assert.assertEquals("The path does not correspond to group!", node.getPath(), "/nexus3670/");

    // get one level deeper
    // but this path is also Group ID, hence response will contain whole tree!
    response = getSearchMessageUtil().indexBrowserTreeView(REPO_TEST_HARNESS_REPO, node.getPath());

    Assert.assertEquals("There are four \"nexus3670\" artifacts in a group!", response.getData().getChildren().size(),
        4);

    // this is group node
    node = getNode(response, "known-artifact-a");

    Assert
        .assertEquals("There is three versions of \"nexus3670:known-artifact-a\" artifact!", node.getChildren().size(),
            3);

    // get one child (V)
    node = node.getChildren().get(0);

    // check path (note leading and trailing slashes!)
    Assert.assertEquals("The path should be V node", TreeNode.Type.V.name(), node.getType());
  }
View Full Code Here

  public void validateGroupIndexTreeOnDelete()
      throws Exception
  {
    prepare("nexus3567deletememberrepo", "nexus3567deletemembergroup");

    IndexBrowserTreeNodeDTO node = getIndexContent("nexus3567deletemembergroup");

    List<IndexBrowserTreeNodeDTO> children = node.getChildren();

    Assert.assertEquals(1, children.size());
    Assert.assertEquals(children.get(0).getNodeName(), "nexus3567");

    // now delete the child repo and validate that there is no root node
    Response response = repoUtil.sendMessage(Method.DELETE, repoResource);
    Assert.assertTrue(response.getStatus().isSuccess());
    TaskScheduleUtil.waitForAllTasksToStop();

    // now reindex the repo
    searchUtil.reindexGroup("nexus3567_deleteandreindex", "nexus3567deletemembergroup", true);
    TaskScheduleUtil.waitForAllTasksToStop();

    node = getIndexContent("nexus3567deletemembergroup");

    assertThat("member removed, root does not have children", node.getChildren(), is(nullValue()));
  }
View Full Code Here

  public void validateGroupIndexTreeOnMemberRemove()
      throws Exception
  {
    prepare("nexus3567removememberrepo", "nexus3567removemembergroup");

    IndexBrowserTreeNodeDTO node = getIndexContent("nexus3567removemembergroup");

    List<IndexBrowserTreeNodeDTO> children = node.getChildren();

    Assert.assertEquals(1, children.size());
    Assert.assertEquals(children.get(0).getNodeName(), "nexus3567");

    // now remove the child repo and validate that there is no root node
    RepositoryGroupResource group = groupUtil.getGroup("nexus3567removemembergroup");
    group.getRepositories().clear();
    groupUtil.updateGroup(group);
    TaskScheduleUtil.waitForAllTasksToStop();

    // now reindex the repo
    searchUtil.reindexGroup("nexus3567_removeandreindex", "nexus3567removemembergroup", true);
    TaskScheduleUtil.waitForAllTasksToStop();

    node = getIndexContent("nexus3567removemembergroup");

    assertThat("member removed, root does not have children", node.getChildren(), is(nullValue()));
  }
View Full Code Here

        if (childNode instanceof IndexBrowserTreeNode) {
          dtoChildren.add(((IndexBrowserTreeNode) childNode).toDTO());
        }
      }
    }
    return new IndexBrowserTreeNodeDTO(getType().name(), isLeaf(), getNodeName(), getPath(), dtoChildren,
        getGroupId(), getArtifactId(), getVersion(), getRepositoryId(), isLocallyAvailable(),
        getArtifactTimestamp(), getArtifactSha1Checksum(), getArtifactMd5Checksum(), getInitiatorUserId(),
        getInitiatorIpAddress(), getArtifactOriginReason(), getArtifactOriginUrl(), classifier, extension,
        packaging, artifactUri, pomUri);
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.rest.indextreeview.IndexBrowserTreeNodeDTO

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.