Package org.netmelody.cieye.core.domain

Examples of org.netmelody.cieye.core.domain.TargetDetail


    returnsInstantlyForAGreenJobThatIsNotBuilding() {
        context.checking(new Expectations() {{
            allowing(contact).makeJsonRestCall("jobUrl/api/json", JobDetail.class); will(returnValue(new JobDetail()));
        }});
       
        TargetDetail target = jobLab.analyseJob(job);
       
        assertThat(target.status(), Matchers.is(Status.GREEN));
    }
View Full Code Here


        context.checking(new Expectations() {{
            allowing(contact).makeJsonRestCall("jobUrl/api/json", JobDetail.class); will(returnValue(jobDetail));
            allowing(contact).makeJsonRestCall("buildUrl/api/json", BuildDetail.class); will(returnValue(buildDetail));
        }});
       
        TargetDetail target = jobLab.analyseJob(job);
       
        assertThat(target.lastStartTime(), is(100L));
    }
View Full Code Here

       
        context.checking(new Expectations() {{
            allowing(contact).makeJsonRestCall("jobUrl/api/json", JobDetail.class); will(returnValue(jobDetail));
        }});
       
        TargetDetail target = jobLab.analyseJob(job);
       
        assertThat(target.status(), Matchers.is(Status.BROKEN));
    }
View Full Code Here

                                 buildData.green ? Status.GREEN : data.note.isEmpty() ? Status.BROKEN : Status.UNDER_INVESTIGATION));
            commentry.append(buildData.checkinComments);
        }
       
        Status status = data.green ? Status.GREEN : (data.note.isEmpty() ? Status.BROKEN : Status.UNDER_INVESTIGATION);
        return new TargetDetail(featureName+targetName, data.url, targetName, status, 0L, builds, detective.search(commentry.toString()));
    }
View Full Code Here

        }
       
        final JobDetail job = communicator.jobDetailFor(jobEndpoint);
        if (!job.building() && Status.BROKEN != job.status()) {
            sponsorCache.clear();
            return new TargetDetail(job.url, job.url, job.name, job.status(), startTimeOf(job));
        }
       
        return new TargetDetail(job.url, job.url, job.name, statusOf(job), startTimeOf(job), buildsFor(job), sponsorsOf(job));
    }
View Full Code Here

    @Override
    public TargetDetail statusOf(TargetId targetId) {
        if (emptyFeatureTargets.containsKey(targetId)) {
            final TargetDigest noTarget = emptyFeatureTargets.get(targetId);
            return new TargetDetail(targetId.id(), noTarget.webUrl(), noTarget.name(), noTarget.status(), 0L);
        }
        final TargetDetail untrustedResult = untrustedSpy.statusOf(targetId);
        return (untrustedResult == null) ? new TargetDetail(targetId.id(), "", "", Status.UNKNOWN, 0L) : untrustedResult;
    }
View Full Code Here

                statuses.putIfAbsent(feature, intermediateStatus);
            }
           
            final List<TargetDetail> newStatus = newArrayList();
            for (TargetDigest digest : targets) {
                final TargetDetail target = trustedSpy.statusOf(digest.id());
                newStatus.add(target);
                intermediateStatus = intermediateStatus.updatedWith(target);
                statuses.put(feature, intermediateStatus);
            }
           
View Full Code Here

        assertThat(new JsonTranslator().toJson(observation), is("{\"targets\":[]}"));
    }
   
    @Test public void
    translatesToAppropriateJsonRepresentationWithSimpleTargets() {
        final LandscapeObservation observation = new LandscapeObservation(TargetDetailGroup.of(newArrayList(new TargetDetail("T1ID", "T1URL", "T1", Status.GREEN, 0L),
                                                                                                            new TargetDetail("T2ID", "T2URL", "T2", Status.BROKEN, 0L))));
       
        assertThat(new JsonTranslator().toJson(observation), is("{\"targets\":[" +
                                                                    "{\"lastStartTime\":0," +
                                                                     "\"sponsors\":[]," +
                                                                     "\"builds\":[]," +
View Full Code Here

    }
   
    @Test public void
    translatesToAppropriateJsonRepresentationWithComplexTarget() {
        final LandscapeObservation observation = new LandscapeObservation(TargetDetailGroup.of(newArrayList(
                new TargetDetail("T1ID", "T1URL", "T1", Status.GREEN, 123,
                           newArrayList(new RunningBuild(percentageOf(1), Status.GREEN),
                                        new RunningBuild(percentageOf(60), Status.BROKEN)),
                           newHashSet(new Sponsor("S1", "P1"))))));
       
        assertThat(new JsonTranslator().toJson(observation), is("{\"targets\":[" +
View Full Code Here

   
    public TargetDetail targetFrom(BuildType buildType) {
        final BuildTypeDetail buildTypeDetail = communicator.detailsFor(buildType);
       
        if (buildTypeDetail.paused) {
            return new TargetDetail(communicator.endpoint() + buildType.href, buildType.webUrl(), buildType.name, Status.DISABLED, 0L);
        }
       
        final Set<Sponsor> sponsors = new HashSet<Sponsor>();
        final List<RunningBuild> runningBuilds = new ArrayList<RunningBuild>();
        long startTime = 0L;
           
        for(Build build : communicator.runningBuildsFor(buildType)) {
            final BuildDetail buildDetail = communicator.detailsOf(build);
            startTime = Math.max(buildDetail.startDateTime(), startTime);
            sponsors.addAll(sponsorsOf(buildDetail));
            runningBuilds.add(new RunningBuild(percentageOf(build.percentageComplete), buildDetail.status()));
        }
       
        Status currentStatus = Status.UNKNOWN;
        final Build lastCompletedBuild = communicator.lastCompletedBuildFor(buildTypeDetail);
        if (null != lastCompletedBuild) {
            currentStatus = lastCompletedBuild.status();
            if (runningBuilds.isEmpty() || Status.BROKEN.equals(currentStatus)) {
                final BuildDetail buildDetail = communicator.detailsOf(lastCompletedBuild);
                startTime = Math.max(buildDetail.startDateTime(), startTime);
                sponsors.addAll(sponsorsOf(buildDetail));
                currentStatus = buildDetail.status();
            }
        }
       
        if (Status.BROKEN.equals(currentStatus)) {
            final List<Investigation> investigations = communicator.investigationsOf(buildType);
            if (!investigations.isEmpty() && (investigations.get(0).startDateTime() > startTime) && investigations.get(0).underInvestigation()) {
                currentStatus = Status.UNDER_INVESTIGATION;
            }
        }
       
        return new TargetDetail(communicator.endpoint() + buildType.href, buildType.webUrl(), buildType.name, currentStatus, startTime, runningBuilds, sponsors);
    }
View Full Code Here

TOP

Related Classes of org.netmelody.cieye.core.domain.TargetDetail

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.