Examples of Repo


Examples of com.jcabi.github.Repo

     * @throws Exception If fails
     */
    @Test
    public void fetchesLabelsFromGithub() throws Exception {
        final Github github = new RtGithub();
        final Repo repo = github.repos().get(
            new Coordinates.Simple("jcabi/jcabi-github")
        );
        MatcherAssert.assertThat(
            repo.labels().iterate().iterator().hasNext(),
            Matchers.equalTo(true)
        );
    }
View Full Code Here

Examples of com.jcabi.github.Repo

     * MkIssues can list issues.
     * @throws Exception If some problem inside
     */
    @Test
    public void iteratesIssues() throws Exception {
        final Repo repo = this.repo();
        repo.issues().create("hey, you", "body of issue");
        repo.issues().create("hey", "body of 2nd issue");
        repo.issues().create("hey again", "body of 3rd issue");
        MatcherAssert.assertThat(
            repo.issues().iterate(new ArrayMap<String, String>()),
            Matchers.<Issue>iterableWithSize(Tv.THREE)
        );
    }
View Full Code Here

Examples of com.jcabi.github.Repo

     * MkIssues can create a new issue with correct author.
     * @throws Exception If some problem inside
     */
    @Test
    public void createsNewIssueWithCorrectAuthor() throws Exception {
        final Repo repo = this.repo();
        final Issue.Smart issue = new Issue.Smart(
            repo.issues().create("hello", "the body")
        );
        MatcherAssert.assertThat(
            issue.author().login(),
            Matchers.equalTo(repo.github().users().self().login())
        );
    }
View Full Code Here

Examples of com.jcabi.github.Repo

     * @throws Exception If some problem inside
     */
    @Test
    public void createsMultipleIssues() throws Exception {
        final Github github = new MkGithub("jeff");
        final Repo repo = github.repos().create(
            Json.createObjectBuilder().add("name", "test-3").build()
        );
        for (int idx = 1; idx < Tv.TEN; ++idx) {
            repo.issues().create("title", "body");
        }
    }
View Full Code Here

Examples of com.jcabi.github.Repo

     * This tests that MkMilestones can return its owner repo.
     * @throws Exception - if something goes wrong.
     */
    @Test
    public void returnsRepo() throws Exception {
        final Repo repo = this.repo();
        final Repo owner = repo.milestones().repo();
        MatcherAssert.assertThat(repo, Matchers.is(owner));
    }
View Full Code Here

Examples of com.jcabi.github.Repo

     * MkAssignees can check if a collaborator is an assignee for this repo.
     * @throws Exception Exception If some problem inside
     */
    @Test
    public void checkCollaboratorIsAssigneeForRepo() throws Exception {
        final Repo repo = repo();
        repo.collaborators().add("Vladimir");
        MatcherAssert.assertThat(
            repo.assignees().check("Vladimir"),
            Matchers.is(true)
        );
    }
View Full Code Here

Examples of domain.Repo

    ArrayList<String> tickets = jira.getTickets(args[0], args[1]);
 
    // If we find any tickets, we can then start our merge
    if (tickets.size() > 0) {
      // Create a Repo object and merge the avail tickets.
      Repo repo = new Repo(args[1]);
      repo.connect();
      repo.mergeTickets(tickets);
      repo.disconnect();     
    } else {
      System.out.println("Error: No tickets found, aborting...");
      System.exit(1);
    }
  }
View Full Code Here

Examples of org.rhq.core.domain.content.Repo

                    Field f = RepoCriteria.class.getDeclaredField("filterName");
                    f.setAccessible(true);
                    String name = (String) f.get(crit);

                    if (CORRECT_REPO_NAME.equals(name)) {
                        Repo repo = new Repo(CORRECT_REPO_NAME);
                        repo.setId(CORRECT_REPO_ID);

                        PageList<Repo> ret = new PageList<Repo>(PageControl.getUnlimitedInstance());
                        ret.add(repo);
                        return ret;
                    } else {
View Full Code Here

Examples of org.rhq.core.domain.content.Repo

            assert contentSource != null;
            contentSourceId = contentSource.getId();
            assert contentSourceId > 0;

            // create a repo
            Repo repo = new Repo("testRepo");
            repo = repoManager.createRepo(overlord, repo);
            repoId = repo.getId();

            // this report will add a mapping to PV->CS
            // we didn't set up any mappings like that yet - this will be the first one
            PackageSyncReport report = new PackageSyncReport();
            ContentProviderPackageDetailsKey key = new ContentProviderPackageDetailsKey("testCreateContentSourceFoo",
                "testCreateContentSourceVer", packageType1.getName(), architecture1.getName(), resourceType1.getName(),
                resourceType1.getPlugin());
            ContentProviderPackageDetails details = new ContentProviderPackageDetails(key);
            details.setLocation("dummy-location");
            details.setMetadata("dummy-metadata".getBytes());
            details.addResourceVersion("1.0.0");
            details.addResourceVersion("2.0.0");
            report.addNewPackage(details);
            Map<ContentProviderPackageDetailsKey, PackageVersionContentSource> previous;
            previous = new HashMap<ContentProviderPackageDetailsKey, PackageVersionContentSource>();

            // merge the report!
            RepoSyncResults results = new RepoSyncResults(repo);
            results = repoManager.persistRepoSyncResults(results);
            assert results != null;

            results = contentSourceManager.mergePackageSyncReport(contentSource, repo, report, previous, results);
            assert results != null;

            // Verify the product version was created
            getTransactionManager().begin();

            try {
                resourceType1 = em.find(ResourceType.class, resourceType1.getId());

                Query productVersionQuery = em.createNamedQuery(ProductVersion.QUERY_FIND_BY_RESOURCE_TYPE_AND_VERSION);
                productVersionQuery.setParameter("resourceType", resourceType1);
                productVersionQuery.setParameter("version", "1.0.0");

                List productVersionList = productVersionQuery.getResultList();
                assert productVersionList.size() > 0 : "Could not find product version for 1.0.0";

                productVersionQuery = em.createNamedQuery(ProductVersion.QUERY_FIND_BY_RESOURCE_TYPE_AND_VERSION);
                productVersionQuery.setParameter("resourceType", resourceType1);
                productVersionQuery.setParameter("version", "2.0.0");

                productVersionList = productVersionQuery.getResultList();
                assert productVersionList.size() > 0 : "Could not find product version for 2.0.0";
            } finally {
                getTransactionManager().rollback();
            }

            // see that the resource sees no metadata yet - not subscribed yet
            pc = PageControl.getUnlimitedInstance();
            PageList<PackageVersionMetadataComposite> metadataList;
            metadataList = contentSourceManager.getPackageVersionMetadata(resource1.getId(), pc);
            assert metadataList != null;
            assert metadataList.size() == 0 : "-->" + metadataList;
            String metadataMd5 = contentSourceManager.getResourceSubscriptionMD5(resource1.getId());
            assert metadataMd5 != null;
            assert metadataMd5.length() == 32 : "-->" + metadataMd5;
            assert metadataMd5.equals("d41d8cd98f00b204e9800998ecf8427e") : "-->" + metadataMd5;

            // just to make sure the MD5 for empty data is what we think it is...
            metadataMd5 = contentSourceManager.getResourceSubscriptionMD5(Integer.MIN_VALUE); // should find no metadata at all
            assert metadataMd5 != null;
            assert metadataMd5.length() == 32 : "-->" + metadataMd5;
            assert metadataMd5.equals("d41d8cd98f00b204e9800998ecf8427e") : "-->" + metadataMd5;

            // add the content source's packages to the repo
            repoManager.addContentSourcesToRepo(overlord, repoId, new int[] { contentSourceId });

            // see the package versions have been assigned to the repo and content source
            List<PackageVersion> inRepo;
            List<PackageVersionContentSource> inContentSources;
            List<PackageVersionContentSource> inContentSource;

            pc = PageControl.getUnlimitedInstance();
            inRepo = repoManager.findPackageVersionsInRepo(overlord, repoId, pc);
            pc = PageControl.getUnlimitedInstance();
            inContentSources = contentSourceManager.getPackageVersionsFromContentSources(overlord,
                new int[] { contentSourceId }, pc);
            inContentSource = contentSourceManager.getPackageVersionsFromContentSource(overlord, contentSourceId, pc);
            assert inRepo != null;
            assert inContentSources != null;
            assert inContentSource != null;
            assert inRepo.size() == 1 : inRepo;
            assert inContentSources.size() == 1 : inContentSources;
            assert inContentSource.size() == 1 : inContentSource;

            // confirm that we didn't load the bits yet
            pc = PageControl.getUnlimitedInstance();
            List<PackageVersionContentSource> unloaded;
            unloaded = contentSourceManager.getUnloadedPackageVersionsFromContentSourceInRepo(overlord,
                contentSourceId, repoId, pc);
            assert unloaded != null;
            assert unloaded.size() == 1;

            // check the counts
            long pvccount = repoManager.getPackageVersionCountFromRepo(overlord, repo.getId());
            assert (pvccount == 1) : "-->" + pvccount;
            long pvcscount = contentSourceManager.getPackageVersionCountFromContentSource(overlord, contentSourceId);
            assert (pvcscount == 1) : "-->" + pvcscount;

            // subscribe the resource
            repoManager.subscribeResourceToRepos(overlord, resource1.getId(), new int[] { repoId });

            // confirm the resource is subscribed
            pc = PageControl.getUnlimitedInstance();
            metadataList = contentSourceManager.getPackageVersionMetadata(resource1.getId(), pc);
            assert metadataList != null;
            assert metadataList.size() == 1 : "-->" + metadataList;
            metadataMd5 = contentSourceManager.getResourceSubscriptionMD5(resource1.getId());
            assert metadataMd5 != null;
            assert metadataMd5.length() == 32 : "-->" + metadataMd5;

            // MD5 is based on the hash code of last modified time
            repo = repoManager.getRepo(overlord, repoId);
            long modifiedTimestamp = repo.getLastModifiedDate();
            Date modifiedDate = new Date(modifiedTimestamp);
            String datehash = Integer.toString(modifiedDate.hashCode());
            assert metadataMd5.equals(MessageDigestGenerator.getDigestString(datehash)) : "-->" + metadataMd5;

            repoManager.unsubscribeResourceFromRepos(overlord, resource1.getId(), new int[] { repoId });
View Full Code Here

Examples of org.rhq.core.domain.content.Repo

            contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
            contentSourceId = contentSource.getId();
            assert contentSourceId > 0;

            // create repo
            Repo repo = new Repo("testRepo");
            repo = repoManager.createRepo(overlord, repo);
            repoId = repo.getId();

            // just make sure there are no package versions yet
            inCS = contentSourceManager.getPackageVersionsFromContentSource(overlord, contentSourceId, pc);
            assert inCS != null;
            assert inCS.size() == 0 : inCS;
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.