Search in sources :

Example 1 with Agent

use of com.github.vase4kin.teamcityapp.agents.api.Agent in project TeamCityApp by vase4kin.

the class RunBuildActivityTest method testUserCanSeeChooseAgentIfAgentsAvailable.

@Test
public void testUserCanSeeChooseAgentIfAgentsAvailable() throws Exception {
    // Prepare mocks
    List<Agent> agents = new ArrayList<>();
    Agent agent = new Agent("agent 1");
    agents.add(agent);
    when(mTeamCityService.listAgents(false, null, null)).thenReturn(Observable.just(new Agents(1, agents)));
    // Prepare intent
    Intent intent = new Intent();
    intent.putExtra(RunBuildInteractor.EXTRA_BUILD_TYPE_ID, "href");
    // Starting the activity
    mActivityRule.launchActivity(intent);
    // Choose agent
    onView(withId(R.id.chooser_agent)).perform(click());
    onView(withText("agent 1")).perform(click());
    // Starting the build
    onView(withId(R.id.fab_queue_build)).perform(click());
    // Checking that build was triggered with agent
    verify(mTeamCityService).queueBuild(mBuildCaptor.capture());
    Build capturedBuild = mBuildCaptor.getValue();
    assertThat(capturedBuild.getAgent(), is(agent));
    // Checking activity is finishing
    assertThat(mActivityRule.getActivity().isFinishing(), is(true));
}
Also used : Agent(com.github.vase4kin.teamcityapp.agents.api.Agent) Build(com.github.vase4kin.teamcityapp.buildlist.api.Build) ArrayList(java.util.ArrayList) Agents(com.github.vase4kin.teamcityapp.agents.api.Agents) Intent(android.content.Intent) Test(org.junit.Test)

Example 2 with Agent

use of com.github.vase4kin.teamcityapp.agents.api.Agent in project TeamCityApp by vase4kin.

the class Mocks method createBuildMock.

/**
 * MOCK
 *
 * @return parametrized build
 */
public static Build createBuildMock(String href, String number, String buildTypeId, String status, String state, String statusText, String waitReason, String branchName, String startDate, String startEstimate, String queuedDate, String finishDate) {
    Build build = new Build(href, number, buildTypeId, status, state, statusText, waitReason, branchName, startDate, startEstimate, queuedDate, finishDate, "http://www.google.com");
    build.setChanges(new Changes("/guestAuth/app/rest/changes?locator=build:(id:826073)"));
    build.setArtifacts(new Artifacts("/guestAuth/app/rest/builds/id:92912/artifacts/children/"));
    build.setAgent(new Agent("agent-love"));
    build.setTriggered(new Triggered("user", "details", new User("code-lover", null)));
    List<Properties.Property> propertyList = new ArrayList<>();
    propertyList.add(new Properties.Property("sdk", "24"));
    propertyList.add(new Properties.Property("userName", "Murdock"));
    build.setProperties(new Properties(propertyList));
    build.setTestOccurrences(new TestOccurrences(10, 2, 4, "/guestAuth/app/rest/testOccurrences?locator=build:(id:835695)"));
    return build;
}
Also used : Changes(com.github.vase4kin.teamcityapp.changes.api.Changes) Artifacts(com.github.vase4kin.teamcityapp.artifact.api.Artifacts) Agent(com.github.vase4kin.teamcityapp.agents.api.Agent) Triggered(com.github.vase4kin.teamcityapp.buildlist.api.Triggered) User(com.github.vase4kin.teamcityapp.buildlist.api.User) Build(com.github.vase4kin.teamcityapp.buildlist.api.Build) TestOccurrences(com.github.vase4kin.teamcityapp.tests.api.TestOccurrences) ArrayList(java.util.ArrayList) Properties(com.github.vase4kin.teamcityapp.properties.api.Properties)

Example 3 with Agent

use of com.github.vase4kin.teamcityapp.agents.api.Agent in project TeamCityApp by vase4kin.

the class Mocks method connectedAgents.

/**
 * MOCK
 *
 * @return connected agents
 */
public static Agents connectedAgents() {
    List<Agent> agents = new ArrayList<>();
    agents.add(new Agent("agent 1"));
    agents.add(new Agent("agent 2"));
    agents.add(new Agent("agent 3"));
    return new Agents(3, agents);
}
Also used : Agent(com.github.vase4kin.teamcityapp.agents.api.Agent) ArrayList(java.util.ArrayList) Agents(com.github.vase4kin.teamcityapp.agents.api.Agents)

Example 4 with Agent

use of com.github.vase4kin.teamcityapp.agents.api.Agent in project TeamCityApp by vase4kin.

the class AgentPresenterImplTest method testCreateModel.

@Test
public void testCreateModel() throws Exception {
    when(mAgent.getName()).thenReturn("name");
    List<Agent> agents = new ArrayList<>();
    agents.add(mAgent);
    AgentDataModel dataModel = mPresenter.createModel(agents);
    assertThat(dataModel.getName(0), is("name"));
    assertThat(dataModel.getItemCount(), is(1));
    verifyNoMoreInteractions(mView, mDataManager, mTracker, mValueExtractor);
}
Also used : Agent(com.github.vase4kin.teamcityapp.agents.api.Agent) ArrayList(java.util.ArrayList) AgentDataModel(com.github.vase4kin.teamcityapp.agents.data.AgentDataModel) Test(org.junit.Test)

Example 5 with Agent

use of com.github.vase4kin.teamcityapp.agents.api.Agent in project TeamCityApp by vase4kin.

the class Mocks method disconnectedAgents.

/**
 * MOCK
 *
 * @return disconnected agents
 */
public static Agents disconnectedAgents() {
    List<Agent> agents = new ArrayList<>();
    agents.add(new Agent("Mac mini 3434"));
    return new Agents(1, agents);
}
Also used : Agent(com.github.vase4kin.teamcityapp.agents.api.Agent) ArrayList(java.util.ArrayList) Agents(com.github.vase4kin.teamcityapp.agents.api.Agents)

Aggregations

Agent (com.github.vase4kin.teamcityapp.agents.api.Agent)5 ArrayList (java.util.ArrayList)5 Agents (com.github.vase4kin.teamcityapp.agents.api.Agents)3 Build (com.github.vase4kin.teamcityapp.buildlist.api.Build)2 Test (org.junit.Test)2 Intent (android.content.Intent)1 AgentDataModel (com.github.vase4kin.teamcityapp.agents.data.AgentDataModel)1 Artifacts (com.github.vase4kin.teamcityapp.artifact.api.Artifacts)1 Triggered (com.github.vase4kin.teamcityapp.buildlist.api.Triggered)1 User (com.github.vase4kin.teamcityapp.buildlist.api.User)1 Changes (com.github.vase4kin.teamcityapp.changes.api.Changes)1 Properties (com.github.vase4kin.teamcityapp.properties.api.Properties)1 TestOccurrences (com.github.vase4kin.teamcityapp.tests.api.TestOccurrences)1