Package org.netmelody.cieye.spies.jenkins

Examples of org.netmelody.cieye.spies.jenkins.JenkinsSpy


    private final KnownOffendersDirectory detective = context.mock(KnownOffendersDirectory.class);
    private final Contact contact = context.mock(Contact.class);
   
    @Test public void
    lazilyRetrievesJobDetails() {
        final JenkinsSpy spy = new JenkinsSpy("myEndpoint", detective, contact);
       
        context.checking(new Expectations() {{
            allowing(contact).makeJsonRestCall(with(any(String.class)), with(Server.class));
                will(returnValue(serverWithViewsNamed("myFeatureName")));
            allowing(contact).makeJsonRestCall(with(any(String.class)), with(ViewDetail.class));
                will(returnValue(viewWithJobsNamed("myJob")));
           
            never(contact).makeJsonRestCall(with(any(String.class)), with(JobDetail.class));
        }});
       
        final Feature feature = new Feature("myFeatureName", "myEndpoint", new CiServerType("JENKINS"));
        final TargetDigestGroup targets = spy.targetsConstituting(feature);
        context.assertIsSatisfied();
       
        context.checking(new Expectations() {{
            oneOf(contact).makeJsonRestCall(with(any(String.class)), with(JobDetail.class));
                will(returnValue(new JobDetail()));
        }});
        spy.statusOf(targets.iterator().next().id());
        context.assertIsSatisfied();
    }
View Full Code Here


    @Test public void
    canPullFromTheJenkinsLiveInstance() {
        final GsonBuilder builder = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
        final Contact realContact = new JsonRestRequester(builder.create());
        final JenkinsSpy witness = new JenkinsSpy("http://ci.jenkins-ci.org", new RecordedKnownOffenders(new SettingsFile(new File(""))), realContact);
       
        final TargetDigestGroup digests = witness.targetsConstituting(new Feature("Jenkins core", "http://ci.jenkins-ci.org", new CiServerType("JENKINS")));
       
        assertThat(witness.statusOf(digests.iterator().next().id()), is(notNullValue(TargetDetail.class)));
    }
View Full Code Here

    @Test public void
    canPullFromSecureJenkinsLiveInstance() {
        final GsonBuilder builder = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
        final Contact realContact = new JsonRestRequester(builder.create());
        final JenkinsSpy witness = new JenkinsSpy("https://jenkins.puppetlabs.com", new RecordedKnownOffenders(new SettingsFile(new File(""))), realContact);
       
        final TargetDigestGroup digests = witness.targetsConstituting(new Feature("MCO Core", "https://jenkins.puppetlabs.com", new CiServerType("JENKINS")));
       
        assertThat(witness.statusOf(digests.iterator().next().id()), is(notNullValue(TargetDetail.class)));
    }
View Full Code Here

TOP

Related Classes of org.netmelody.cieye.spies.jenkins.JenkinsSpy

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.