Skip to content

Commit ebe9c6d

Browse files
JianpingChenJP Chen
andauthored
[Communication]: Remove unused code in pom and test files (Azure#21654)
* Remove unused code in pom and test files * Restore unintended change * Revert a test file change * Restore tests.yml * Remove unused env variable in tests.yml * Remove tests.yml * Keep skipping SMS tests in INT * Try to skip jacoco in INT * try different syntax * Try use string as much as we can * Try escape quotes * Try use a variable inside loop * Fix a typo * Move variable to a different place * Try Macro syntax * Remove variable, use stage name instead * Fix syntax * Try a different syntax * Try something simple * Move variables to the right place * Flip logic * Renamve variable * Give up on customizing jacoco.skip * Try to use variable to skp jacoco * Try different syntax * Move variable declaration * Try to set variable * Try PreSteps * Remove local variable * Remove unnecessary overwrite * Remove quotes Co-authored-by: JP Chen <[email protected]>
1 parent 8cc107c commit ebe9c6d

File tree

19 files changed

+5
-352
lines changed

19 files changed

+5
-352
lines changed

sdk/communication/azure-communication-chat/pom.xml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -170,47 +170,5 @@
170170
</plugins>
171171
</build>
172172
</profile>
173-
<profile>
174-
<id>disable-coverage-if-identity</id>
175-
<activation>
176-
<property>
177-
<name>env.TEST_PACKAGES_ENABLED</name>
178-
<value>identity</value>
179-
</property>
180-
</activation>
181-
<properties>
182-
<src.dir>src/main</src.dir>
183-
<test.dir>src/test</test.dir>
184-
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
185-
</properties>
186-
</profile>
187-
<profile>
188-
<id>disable-coverage-if-phonenumbers</id>
189-
<activation>
190-
<property>
191-
<name>env.TEST_PACKAGES_ENABLED</name>
192-
<value>phonenumbers</value>
193-
</property>
194-
</activation>
195-
<properties>
196-
<src.dir>src/main</src.dir>
197-
<test.dir>src/test</test.dir>
198-
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
199-
</properties>
200-
</profile>
201-
<profile>
202-
<id>disable-coverage-if-sms</id>
203-
<activation>
204-
<property>
205-
<name>env.TEST_PACKAGES_ENABLED</name>
206-
<value>sms</value>
207-
</property>
208-
</activation>
209-
<properties>
210-
<src.dir>src/main</src.dir>
211-
<test.dir>src/test</test.dir>
212-
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
213-
</properties>
214-
</profile>
215173
</profiles>
216174
</project>

sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatAsyncClientTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.UUID;
3131

3232
import static org.junit.jupiter.api.Assertions.*;
33-
import static org.junit.jupiter.api.Assumptions.assumeTrue;
3433

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

49-
@Override
50-
protected void beforeTest() {
51-
super.beforeTest();
52-
assumeTrue(shouldEnableChatTests());
53-
}
54-
5548
@Override
5649
protected void afterTest() {
5750
super.afterTest();

sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import static org.junit.jupiter.api.Assertions.assertEquals;
77
import static org.junit.jupiter.api.Assertions.assertNotNull;
88
import static org.junit.jupiter.api.Assertions.assertTrue;
9-
import static org.junit.jupiter.api.Assumptions.assumeTrue;
109

1110
import org.junit.jupiter.params.ParameterizedTest;
1211
import org.junit.jupiter.params.provider.MethodSource;
@@ -40,12 +39,6 @@ public class ChatClientTest extends ChatClientTestBase {
4039
private CommunicationUserIdentifier firstThreadMember;
4140
private CommunicationUserIdentifier secondThreadMember;
4241

43-
@Override
44-
protected void beforeTest() {
45-
super.beforeTest();
46-
assumeTrue(shouldEnableChatTests());
47-
}
48-
4942
@Override
5043
protected void afterTest() {
5144
super.afterTest();

sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTestBase.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ public class ChatClientTestBase extends TestBase {
4646
protected static final String ACCESS_KEY = Configuration.getGlobalConfiguration()
4747
.get("COMMUNICATION_SERVICE_ACCESS_KEY", "pw==");
4848

49-
private static final String TEST_PACKAGES_ENABLED = Configuration.getGlobalConfiguration()
50-
.get("TEST_PACKAGES_ENABLED", "all");
51-
5249
private static final StringJoiner JSON_PROPERTIES_TO_REDACT
5350
= new StringJoiner("\":\"|\"", "\"", "\":\"")
5451
.add("token");
@@ -215,10 +212,6 @@ protected ChatClientBuilder addLoggingPolicyForIdentityClientBuilder(ChatClientB
215212
return builder.addPolicy(new CommunicationLoggerPolicy(testName));
216213
}
217214

218-
protected boolean shouldEnableChatTests() {
219-
return TEST_PACKAGES_ENABLED.matches("(all|chat)");
220-
}
221-
222215
private String redact(String content, Matcher matcher, String replacement) {
223216
while (matcher.find()) {
224217
String captureGroup = matcher.group(1);

sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import static org.junit.jupiter.api.Assertions.assertEquals;
77
import static org.junit.jupiter.api.Assertions.assertNotNull;
88
import static org.junit.jupiter.api.Assertions.assertTrue;
9-
import static org.junit.jupiter.api.Assumptions.assumeTrue;
109

1110
import com.azure.communication.chat.implementation.models.CommunicationErrorResponseException;
1211
import com.azure.core.exception.HttpResponseException;
@@ -58,12 +57,6 @@ public class ChatThreadAsyncClientTest extends ChatClientTestBase {
5857
private CommunicationUserIdentifier firstAddedParticipant;
5958
private CommunicationUserIdentifier secondAddedParticipant;
6059

61-
@Override
62-
protected void beforeTest() {
63-
super.beforeTest();
64-
assumeTrue(shouldEnableChatTests());
65-
}
66-
6760
@Override
6861
protected void afterTest() {
6962
super.afterTest();

sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadClientTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import static org.junit.jupiter.api.Assertions.assertEquals;
77
import static org.junit.jupiter.api.Assertions.assertNotNull;
88
import static org.junit.jupiter.api.Assertions.assertTrue;
9-
import static org.junit.jupiter.api.Assumptions.assumeTrue;
109
import static org.junit.jupiter.api.Assertions.assertThrows;
1110

1211
import com.azure.core.exception.HttpResponseException;
@@ -54,12 +53,6 @@ public class ChatThreadClientTest extends ChatClientTestBase {
5453
private CommunicationUserIdentifier firstAddedParticipant;
5554
private CommunicationUserIdentifier secondAddedParticipant;
5655

57-
@Override
58-
protected void beforeTest() {
59-
super.beforeTest();
60-
assumeTrue(shouldEnableChatTests());
61-
}
62-
6356
@Override
6457
protected void afterTest() {
6558
super.afterTest();

sdk/communication/azure-communication-identity/pom.xml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -181,47 +181,5 @@
181181
</plugins>
182182
</build>
183183
</profile>
184-
<profile>
185-
<id>disable-coverage-if-phonenumbers</id>
186-
<activation>
187-
<property>
188-
<name>env.TEST_PACKAGES_ENABLED</name>
189-
<value>phonenumbers</value>
190-
</property>
191-
</activation>
192-
<properties>
193-
<src.dir>src/main</src.dir>
194-
<test.dir>src/test</test.dir>
195-
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
196-
</properties>
197-
</profile>
198-
<profile>
199-
<id>disable-coverage-if-sms</id>
200-
<activation>
201-
<property>
202-
<name>env.TEST_PACKAGES_ENABLED</name>
203-
<value>sms</value>
204-
</property>
205-
</activation>
206-
<properties>
207-
<src.dir>src/main</src.dir>
208-
<test.dir>src/test</test.dir>
209-
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
210-
</properties>
211-
</profile>
212-
<profile>
213-
<id>disable-coverage-if-chat</id>
214-
<activation>
215-
<property>
216-
<name>env.TEST_PACKAGES_ENABLED</name>
217-
<value>chat</value>
218-
</property>
219-
</activation>
220-
<properties>
221-
<src.dir>src/main</src.dir>
222-
<test.dir>src/test</test.dir>
223-
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
224-
</properties>
225-
</profile>
226184
</profiles>
227185
</project>

sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityAsyncTests.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import static org.junit.jupiter.api.Assertions.assertEquals;
66
import static org.junit.jupiter.api.Assertions.assertFalse;
77
import static org.junit.jupiter.api.Assertions.assertNotNull;
8-
import static org.junit.jupiter.api.Assumptions.assumeTrue;
98

109
import java.util.Arrays;
1110
import java.util.List;
@@ -26,12 +25,6 @@
2625
public class CommunicationIdentityAsyncTests extends CommunicationIdentityClientTestBase {
2726
private CommunicationIdentityAsyncClient asyncClient;
2827

29-
@Override
30-
protected void beforeTest() {
31-
super.beforeTest();
32-
assumeTrue(shouldEnableIdentityTests());
33-
}
34-
3528
@ParameterizedTest
3629
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
3730
public void createAsyncIdentityClientUsingManagedIdentity(HttpClient httpClient) {

sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityClientTestBase.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ public class CommunicationIdentityClientTestBase extends TestBase {
3434
protected static final String CONNECTION_STRING = Configuration.getGlobalConfiguration()
3535
.get("COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING", "endpoint=https://REDACTED.communication.azure.com/;accesskey=QWNjZXNzS2V5");
3636

37-
private static final String TEST_PACKAGES_ENABLED = Configuration.getGlobalConfiguration()
38-
.get("TEST_PACKAGES_ENABLED", "all");
39-
4037
private static final StringJoiner JSON_PROPERTIES_TO_REDACT
4138
= new StringJoiner("\":\"|\"", "\"", "\":\"")
4239
.add("token");
@@ -138,10 +135,6 @@ private Mono<HttpResponse> logHeaders(String testName, HttpPipelineNextPolicy ne
138135
});
139136
}
140137

141-
protected boolean shouldEnableIdentityTests() {
142-
return TEST_PACKAGES_ENABLED.matches("(all|identity)");
143-
}
144-
145138
static class FakeCredentials implements TokenCredential {
146139
@Override
147140
public Mono<AccessToken> getToken(TokenRequestContext tokenRequestContext) {

sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityTests.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import static org.junit.jupiter.api.Assertions.assertEquals;
66
import static org.junit.jupiter.api.Assertions.assertFalse;
77
import static org.junit.jupiter.api.Assertions.assertNotNull;
8-
import static org.junit.jupiter.api.Assumptions.assumeTrue;
98

109
import java.util.Arrays;
1110
import java.util.List;
@@ -24,12 +23,6 @@
2423
public class CommunicationIdentityTests extends CommunicationIdentityClientTestBase {
2524
private CommunicationIdentityClient client;
2625

27-
@Override
28-
protected void beforeTest() {
29-
super.beforeTest();
30-
assumeTrue(shouldEnableIdentityTests());
31-
}
32-
3326
@ParameterizedTest
3427
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
3528
public void createIdentityClientUsingManagedIdentity(HttpClient httpClient) {

0 commit comments

Comments
 (0)