Package com.groupon.jenkins.dynamic.build.repository

Examples of com.groupon.jenkins.dynamic.build.repository.DynamicProjectRepository


    protected void verifyBuildTrigger(StaplerRequest request) throws IOException, InterruptedException {
        Payload payload = mock(Payload.class);

        DynamicProject projectForRepo = mock(DynamicProject.class);
        DynamicProjectRepository projectRepo = mock(DynamicProjectRepository.class);

        when(payload.needsBuild()).thenReturn(true);
        when(payload.getProjectUrl()).thenReturn("git@repo");
        when(projectRepo.getJobsFor("git@repo")).thenReturn(newArrayList(projectForRepo));

        doReturn(payload).when(githubWebhook).makePayload("payload");
        doReturn(projectRepo).when(githubWebhook).makeDynamicProjectRepo();

        githubWebhook.doIndex(request, null);
View Full Code Here


        Whitebox.setInternalState(MongoRepository.class, "datastore", datastore);
    }

    @After
    public void clearFongo() {
        Datastore ds = new DynamicProjectRepository().getDatastore();

        ds.delete(ds.createQuery(DbBackedProject.class));
        ds.delete(ds.createQuery(DbBackedBuild.class));
        ds.getDB().getCollection(GithubAccessTokenRepository.COLLECTION_NAME).remove(new BasicDBObject());
    }
View Full Code Here

    }

    @Test
    @LocalData
    public void should_save_a_project() throws Exception {
        DynamicProjectRepository repo = new DynamicProjectRepository();

        GHRepository ghRepository = setupMockGHRepository();

        DynamicProject project = repo.createNewProject(ghRepository);

        assert(repo.getDatastore().getCount(DynamicProject.class) > 0);
        DynamicProject restoredProject = repo.getDatastore().createQuery(DynamicProject.class).get();

        assert("repo_name".equals(restoredProject.getName()));


    }
View Full Code Here

    @Ignore
    public void should_save_a_build() throws Exception {

        GHRepository ghRepository = setupMockGHRepository();

        DynamicProjectRepository repo = new DynamicProjectRepository();
        DynamicProject project = repo.createNewProject(ghRepository);

        project.scheduleBuild2(0).get();

        assert(repo.getDatastore().getCount(DbBackedBuild.class) > 0);

        for(DbBackedBuild build : new DynamicBuildRepository().getBuilds(project)) {
            assertNotNull(build.getParent());
            assertNotNull(build.getState());
            assertNotNull(build.getResult());
View Full Code Here

    private final DynamicProjectRepository dynamicProjectRepository;
    private final GithubAccessTokenRepository githubAccessTokenRepository;
    private final GithubRepositoryService githubRepositoryService;

    public ProjectConfigInfo(String ghRepoName, GHRepository ghRepository) {
        this(ghRepoName, ghRepository, new DynamicProjectRepository(), new GithubAccessTokenRepository(), new GithubRepositoryService(ghRepository));
    }
View Full Code Here

            }
        }
    }

    protected DynamicProjectRepository makeDynamicProjectRepo() {
        return new DynamicProjectRepository();
    }
View Full Code Here

        String currentOrg = (String) Stapler.getCurrentRequest().getSession().getAttribute("setupOrg" + getCurrentGithubLogin());
        return StringUtils.isEmpty(currentOrg) ? Iterables.get(getOrgs(), 0) : currentOrg;
    }

    public void doCreateProject(StaplerRequest request, StaplerResponse response) throws IOException {
        DynamicProject project = new DynamicProjectRepository().createNewProject(getGithubRepository(request));
        response.sendRedirect2(redirectAfterCreateItem(request, project));
    }
View Full Code Here

        super.onLoad(parent, name);
    }

    @PostLoad
    protected void initRepos() {
        this.dynamicProjectRepository = new DynamicProjectRepository();
        this.dynamicBuildRepository = new DynamicBuildRepository();
    }
View Full Code Here

        super(parent, name);
        init();
    }

    private void init() {
        Iterable<DynamicSubProject> projects = new DynamicProjectRepository().getChildren(this);
        items = new CopyOnWriteMap.Tree<String, DynamicSubProject>(CaseInsensitiveComparator.INSTANCE);
        for (DynamicSubProject dbBackedProject : projects) {
            items.put(dbBackedProject.getName(), dbBackedProject);
        }
    }
View Full Code Here

        items = new CopyOnWriteMap.Tree<String, DynamicProject>(CaseInsensitiveComparator.INSTANCE);
        items = getJobsForThisContainer();
    }

    private Tree<String, DynamicProject> getJobsForThisContainer() {
        Iterable<DynamicProject> projects = new DynamicProjectRepository().getProjectsForOrg(this);
        Tree<String, DynamicProject> itemMap = new CopyOnWriteMap.Tree<String, DynamicProject>(CaseInsensitiveComparator.INSTANCE);
        for (DynamicProject dbBackedProject : projects) {
            itemMap.put(dbBackedProject.getName(), dbBackedProject);
            try {
                dbBackedProject.onLoad(this, dbBackedProject.getName());
View Full Code Here

TOP

Related Classes of com.groupon.jenkins.dynamic.build.repository.DynamicProjectRepository

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.