Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Communication]: Remove unused code in pom and test files #21654

Merged
merged 31 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions sdk/communication/azure-communication-chat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,47 +170,5 @@
</plugins>
</build>
</profile>
<profile>
<id>disable-coverage-if-identity</id>
<activation>
<property>
<name>env.TEST_PACKAGES_ENABLED</name>
<value>identity</value>
</property>
</activation>
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>
</profile>
<profile>
<id>disable-coverage-if-phonenumbers</id>
<activation>
<property>
<name>env.TEST_PACKAGES_ENABLED</name>
<value>phonenumbers</value>
</property>
</activation>
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>
</profile>
<profile>
<id>disable-coverage-if-sms</id>
<activation>
<property>
<name>env.TEST_PACKAGES_ENABLED</name>
<value>sms</value>
</property>
</activation>
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.UUID;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

/**
* Set the AZURE_TEST_MODE environment variable to either PLAYBACK or RECORD to determine if tests are playback or
Expand All @@ -46,12 +45,6 @@ public class ChatAsyncClientTest extends ChatClientTestBase {
private CommunicationUserIdentifier firstThreadMember;
private CommunicationUserIdentifier secondThreadMember;

@Override
protected void beforeTest() {
super.beforeTest();
assumeTrue(shouldEnableChatTests());
}

@Override
protected void afterTest() {
super.afterTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -40,12 +39,6 @@ public class ChatClientTest extends ChatClientTestBase {
private CommunicationUserIdentifier firstThreadMember;
private CommunicationUserIdentifier secondThreadMember;

@Override
protected void beforeTest() {
super.beforeTest();
assumeTrue(shouldEnableChatTests());
}

@Override
protected void afterTest() {
super.afterTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ public class ChatClientTestBase extends TestBase {
protected static final String ACCESS_KEY = Configuration.getGlobalConfiguration()
.get("COMMUNICATION_SERVICE_ACCESS_KEY", "pw==");

private static final String TEST_PACKAGES_ENABLED = Configuration.getGlobalConfiguration()
.get("TEST_PACKAGES_ENABLED", "all");

private static final StringJoiner JSON_PROPERTIES_TO_REDACT
= new StringJoiner("\":\"|\"", "\"", "\":\"")
.add("token");
Expand Down Expand Up @@ -215,10 +212,6 @@ protected ChatClientBuilder addLoggingPolicyForIdentityClientBuilder(ChatClientB
return builder.addPolicy(new CommunicationLoggerPolicy(testName));
}

protected boolean shouldEnableChatTests() {
return TEST_PACKAGES_ENABLED.matches("(all|chat)");
}

private String redact(String content, Matcher matcher, String replacement) {
while (matcher.find()) {
String captureGroup = matcher.group(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import com.azure.communication.chat.implementation.models.CommunicationErrorResponseException;
import com.azure.core.exception.HttpResponseException;
Expand Down Expand Up @@ -58,12 +57,6 @@ public class ChatThreadAsyncClientTest extends ChatClientTestBase {
private CommunicationUserIdentifier firstAddedParticipant;
private CommunicationUserIdentifier secondAddedParticipant;

@Override
protected void beforeTest() {
super.beforeTest();
assumeTrue(shouldEnableChatTests());
}

@Override
protected void afterTest() {
super.afterTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;

import com.azure.core.exception.HttpResponseException;
Expand Down Expand Up @@ -54,12 +53,6 @@ public class ChatThreadClientTest extends ChatClientTestBase {
private CommunicationUserIdentifier firstAddedParticipant;
private CommunicationUserIdentifier secondAddedParticipant;

@Override
protected void beforeTest() {
super.beforeTest();
assumeTrue(shouldEnableChatTests());
}

@Override
protected void afterTest() {
super.afterTest();
Expand Down
42 changes: 0 additions & 42 deletions sdk/communication/azure-communication-identity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,47 +181,5 @@
</plugins>
</build>
</profile>
<profile>
<id>disable-coverage-if-phonenumbers</id>
<activation>
<property>
<name>env.TEST_PACKAGES_ENABLED</name>
<value>phonenumbers</value>
</property>
</activation>
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>
</profile>
<profile>
<id>disable-coverage-if-sms</id>
<activation>
<property>
<name>env.TEST_PACKAGES_ENABLED</name>
<value>sms</value>
</property>
</activation>
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>
</profile>
<profile>
<id>disable-coverage-if-chat</id>
<activation>
<property>
<name>env.TEST_PACKAGES_ENABLED</name>
<value>chat</value>
</property>
</activation>
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import java.util.Arrays;
import java.util.List;
Expand All @@ -26,12 +25,6 @@
public class CommunicationIdentityAsyncTests extends CommunicationIdentityClientTestBase {
private CommunicationIdentityAsyncClient asyncClient;

@Override
protected void beforeTest() {
super.beforeTest();
assumeTrue(shouldEnableIdentityTests());
}

@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void createAsyncIdentityClientUsingManagedIdentity(HttpClient httpClient) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ public class CommunicationIdentityClientTestBase extends TestBase {
protected static final String CONNECTION_STRING = Configuration.getGlobalConfiguration()
.get("COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING", "endpoint=https://REDACTED.communication.azure.com/;accesskey=QWNjZXNzS2V5");

private static final String TEST_PACKAGES_ENABLED = Configuration.getGlobalConfiguration()
.get("TEST_PACKAGES_ENABLED", "all");

private static final StringJoiner JSON_PROPERTIES_TO_REDACT
= new StringJoiner("\":\"|\"", "\"", "\":\"")
.add("token");
Expand Down Expand Up @@ -138,10 +135,6 @@ private Mono<HttpResponse> logHeaders(String testName, HttpPipelineNextPolicy ne
});
}

protected boolean shouldEnableIdentityTests() {
return TEST_PACKAGES_ENABLED.matches("(all|identity)");
}

static class FakeCredentials implements TokenCredential {
@Override
public Mono<AccessToken> getToken(TokenRequestContext tokenRequestContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import java.util.Arrays;
import java.util.List;
Expand All @@ -24,12 +23,6 @@
public class CommunicationIdentityTests extends CommunicationIdentityClientTestBase {
private CommunicationIdentityClient client;

@Override
protected void beforeTest() {
super.beforeTest();
assumeTrue(shouldEnableIdentityTests());
}

@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void createIdentityClientUsingManagedIdentity(HttpClient httpClient) {
Expand Down
56 changes: 0 additions & 56 deletions sdk/communication/azure-communication-phonenumbers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,61 +180,5 @@
</plugins>
</build>
</profile>
<profile>
<id>disable-coverage-if-identity</id>
<activation>
<property>
<name>env.TEST_PACKAGES_ENABLED</name>
<value>identity</value>
</property>
</activation>
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>
</profile>
<profile>
<id>disable-coverage-if-sms</id>
<activation>
<property>
<name>env.TEST_PACKAGES_ENABLED</name>
<value>sms</value>
</property>
</activation>
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>
</profile>
<profile>
<id>disable-coverage-if-chat</id>
<activation>
<property>
<name>env.TEST_PACKAGES_ENABLED</name>
<value>chat</value>
</property>
</activation>
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>
</profile>
<profile>
<id>disable-coverage-if-phonenumbers</id>
<activation>
<property>
<name>env.COMMUNICATION_SKIP_INT_PHONENUMBERS_TEST</name>
<value>true</value>
</property>
</activation>
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,9 @@
import java.time.Duration;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

public class PhoneNumbersAsyncClientIntegrationTest extends PhoneNumbersIntegrationTestBase {

@Override
protected void beforeTest() {
super.beforeTest();
assumeTrue(shouldEnablePhoneNumbersTests());
}

@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getPurchasedPhoneNumber(HttpClient httpClient) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@


import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.mockito.Mockito.*;

@Execution(value = ExecutionMode.SAME_THREAD)
Expand All @@ -45,7 +44,6 @@ public class PhoneNumbersClientBuilderTest {
void setUp() {
this.httpClient = mock(HttpClient.class);
this.clientBuilder = Mockito.spy(new PhoneNumbersClientBuilder());
assumeTrue(Configuration.getGlobalConfiguration().get("TEST_PACKAGES_ENABLED", "all").matches("all|phonenumbers"));
}

@AfterEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,9 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

public class PhoneNumbersClientIntegrationTest extends PhoneNumbersIntegrationTestBase {

@Override
protected void beforeTest() {
super.beforeTest();
assumeTrue(shouldEnablePhoneNumbersTests());
}

@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getPurchasedPhoneNumber(HttpClient httpClient) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ public class PhoneNumbersIntegrationTestBase extends TestBase {
protected static final String PHONE_NUMBER =
Configuration.getGlobalConfiguration().get("AZURE_PHONE_NUMBER", "+11234567891");

private static final String TEST_PACKAGES_ENABLED = Configuration.getGlobalConfiguration()
.get("TEST_PACKAGES_ENABLED", "all");

private static final StringJoiner JSON_PROPERTIES_TO_REDACT =
new StringJoiner("\":\"|\"", "\"", "\":\"")
.add("id")
Expand Down Expand Up @@ -146,7 +143,4 @@ private String redact(String content, Matcher matcher, String replacement) {
return content;
}

protected boolean shouldEnablePhoneNumbersTests() {
return TEST_PACKAGES_ENABLED.matches("(all|phonenumbers)");
}
}
Loading