Search in sources :

Example 1 with TeamscaleServer

use of com.teamscale.client.TeamscaleServer in project teamscale-jacoco-agent by cqse.

the class AgentHttpServerTest method testOverridingPartition.

/**
 * Test overwriting the partition
 */
@Test
public void testOverridingPartition() throws Exception {
    String newPartition = "New Partition";
    putText("/partition", newPartition);
    TeamscaleServer teamscaleServer = agent.options.getTeamscaleServerOptions();
    assertThat(teamscaleServer.partition).isEqualTo(newPartition);
}
Also used : TeamscaleServer(com.teamscale.client.TeamscaleServer) Test(org.junit.jupiter.api.Test)

Example 2 with TeamscaleServer

use of com.teamscale.client.TeamscaleServer in project teamscale-jacoco-agent by cqse.

the class AgentHttpServerTest method testOverridingMessage.

/**
 * Test overwriting the commit message
 */
@Test
public void testOverridingMessage() throws Exception {
    String newMessage = "New Message";
    putText("/message", newMessage);
    TeamscaleServer teamscaleServer = agent.options.getTeamscaleServerOptions();
    assertThat(teamscaleServer.getMessage()).isEqualTo(newMessage);
}
Also used : TeamscaleServer(com.teamscale.client.TeamscaleServer) Test(org.junit.jupiter.api.Test)

Example 3 with TeamscaleServer

use of com.teamscale.client.TeamscaleServer in project teamscale-jacoco-agent by cqse.

the class AgentOptionsTest method testTeamscaleUploadOptions.

/**
 * Tests the options for uploading coverage to teamscale.
 */
@Test
public void testTeamscaleUploadOptions() throws AgentOptionParseException {
    AgentOptions agentOptions = getAgentOptionsParserWithDummyLogger().parse("" + "teamscale-server-url=127.0.0.1," + "teamscale-project=test," + "teamscale-user=build," + "teamscale-access-token=token," + "teamscale-partition=\"Unit Tests\"," + "teamscale-commit=default:HEAD," + "teamscale-message=\"This is my message\"");
    TeamscaleServer teamscaleServer = agentOptions.getTeamscaleServerOptions();
    assertThat(teamscaleServer.url.toString()).isEqualTo("http://127.0.0.1/");
    assertThat(teamscaleServer.project).isEqualTo("test");
    assertThat(teamscaleServer.userName).isEqualTo("build");
    assertThat(teamscaleServer.userAccessToken).isEqualTo("token");
    assertThat(teamscaleServer.partition).isEqualTo("Unit Tests");
    assertThat(teamscaleServer.commit.toString()).isEqualTo("default:HEAD");
    assertThat(teamscaleServer.getMessage()).isEqualTo("This is my message");
}
Also used : TeamscaleServer(com.teamscale.client.TeamscaleServer) Test(org.junit.jupiter.api.Test)

Example 4 with TeamscaleServer

use of com.teamscale.client.TeamscaleServer in project teamscale-jacoco-agent by cqse.

the class CoverageToTeamscaleStrategyTest method mockOptions.

private AgentOptions mockOptions() throws IOException {
    AgentOptions options = mock(AgentOptions.class);
    when(options.createTeamscaleClient()).thenReturn(client);
    when(options.createTempFile(any(), any())).thenReturn(new File(tempDir, "test"));
    TeamscaleServer server = new TeamscaleServer();
    server.commit = new CommitDescriptor("branch", "12345");
    server.url = HttpUrl.get("http://doesnt-exist.io");
    server.userName = "build";
    server.userAccessToken = "token";
    server.partition = "partition";
    when(options.getTeamscaleServerOptions()).thenReturn(server);
    when(options.createTeamscaleClient()).thenReturn(client);
    return options;
}
Also used : TeamscaleServer(com.teamscale.client.TeamscaleServer) CommitDescriptor(com.teamscale.client.CommitDescriptor) File(java.io.File) AgentOptions(com.teamscale.jacoco.agent.options.AgentOptions)

Example 5 with TeamscaleServer

use of com.teamscale.client.TeamscaleServer in project teamscale-jacoco-agent by cqse.

the class TestwiseCoverageAgentTest method mockOptions.

private AgentOptions mockOptions(int port) {
    AgentOptions options = mock(AgentOptions.class);
    when(options.createTeamscaleClient()).thenReturn(client);
    TeamscaleServer server = new TeamscaleServer();
    server.commit = new CommitDescriptor("branch", "12345");
    server.url = HttpUrl.get("http://doesnt-exist.io");
    server.userName = "build";
    server.userAccessToken = "token";
    server.partition = "partition";
    when(options.getTeamscaleServerOptions()).thenReturn(server);
    when(options.getHttpServerPort()).thenReturn(port);
    when(options.getTestwiseCoverageMode()).thenReturn(ETestwiseCoverageMode.TEAMSCALE_UPLOAD);
    when(options.createTeamscaleClient()).thenReturn(client);
    return options;
}
Also used : TeamscaleServer(com.teamscale.client.TeamscaleServer) CommitDescriptor(com.teamscale.client.CommitDescriptor) AgentOptions(com.teamscale.jacoco.agent.options.AgentOptions)

Aggregations

TeamscaleServer (com.teamscale.client.TeamscaleServer)5 Test (org.junit.jupiter.api.Test)3 CommitDescriptor (com.teamscale.client.CommitDescriptor)2 AgentOptions (com.teamscale.jacoco.agent.options.AgentOptions)2 File (java.io.File)1