Skip to content

Commit f2e3c56

Browse files
authored
Merge pull request #2631 from RestComm/testCategories
Test categories - only test code changed to include categories
2 parents ff63f55 + f29929c commit f2e3c56

30 files changed

Lines changed: 477 additions & 360 deletions

restcomm/restcomm.testsuite/pom.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,9 @@
480480
<include>**/connect/testsuite/*Test.java</include>
481481
</includes>
482482
<redirectTestOutputToFile>true</redirectTestOutputToFile>
483+
<!-- let rerun attempts bedefined form env
483484
<rerunFailingTestsCount>2</rerunFailingTestsCount>
485+
-->
484486
<!-- let ci script set forkcount.Dont increase over 65
485487
since that will make ports over the maximum allowed by OS.
486488
on local env set depending on available mem
@@ -500,6 +502,7 @@
500502
<arquillian_http_port>${surefire.forkNumber}509</arquillian_http_port>
501503
<arquillian_sip_port>${surefire.forkNumber}508</arquillian_sip_port>
502504
</systemPropertyVariables>
505+
<excludedGroups>org.restcomm.connect.testsuite.UnstableTests</excludedGroups>
503506
</configuration>
504507
<executions>
505508
<execution>
@@ -517,8 +520,8 @@
517520
<artifactId>maven-surefire-plugin</artifactId>
518521
<version>2.19.1</version>
519522
<configuration>
520-
<argLine>-Xms1024m -Xmx2048m -XX:MaxPermSize=1024m</argLine>
521-
<!-- <excludes> <exclude>**/SmsSessionTest.java</exclude> </excludes> -->
523+
<argLine>-Xms256m -Xmx2048m -XX:MaxPermSize=1024m</argLine>
524+
<!-- let surefire run sequentially by setting 1-->
522525
<forkCount>1</forkCount>
523526
<reuseForks>false</reuseForks>
524527
<skipTests>${skipUTs}</skipTests>
@@ -549,6 +552,7 @@
549552
<exclude>**/sms/*Test.java</exclude>
550553
<exclude>**/connect/testsuite/*Test.java</exclude>
551554
</excludes>
555+
<excludedGroups>org.restcomm.connect.testsuite.UnstableTests</excludedGroups>
552556
</configuration>
553557
</plugin>
554558
</plugins>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.restcomm.connect.testsuite;
2+
3+
public interface BrokenTests {
4+
5+
}

restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/RvdProjectsMigratorWorkspaceMigratedTest.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import java.util.List;
5353
import java.util.Map;
5454
import org.junit.BeforeClass;
55+
import org.junit.experimental.categories.Category;
5556
import org.restcomm.connect.commons.Version;
5657

5758
/**
@@ -67,28 +68,28 @@ public class RvdProjectsMigratorWorkspaceMigratedTest {
6768
private Deployer deployer;
6869
@ArquillianResource
6970
URL deploymentUrl;
70-
71+
7172
private static int mediaPort = NetworkPortAssigner.retrieveNextPortByFile();
72-
private static int smtpPort = NetworkPortAssigner.retrieveNextPortByFile();
73+
private static int smtpPort = NetworkPortAssigner.retrieveNextPortByFile();
7374

7475
private String adminUsername = "administrator@company.com";
7576
private String adminAccountSid = "ACae6e420f425248d6a26948c17a9e2acf";
7677
private String adminAuthToken = "77f8c12cc7b8f8423e5c38b035249166";
7778
private static GreenMail mailServer;
78-
79+
7980
private static int restcommPort = 5080;
8081
private static int restcommHTTPPort = 8080;
81-
private static String restcommContact = "127.0.0.1:" + restcommPort;
82-
82+
private static String restcommContact = "127.0.0.1:" + restcommPort;
83+
8384
public static void reconfigurePorts() throws Exception {
8485
if (System.getProperty("arquillian_sip_port") != null) {
8586
restcommPort = Integer.valueOf(System.getProperty("arquillian_sip_port"));
8687
restcommContact = "127.0.0.1:" + restcommPort;
8788
}
8889
if (System.getProperty("arquillian_http_port") != null) {
8990
restcommHTTPPort = Integer.valueOf(System.getProperty("arquillian_http_port"));
90-
}
91-
}
91+
}
92+
}
9293

9394
@AfterClass
9495
public static void stopMailServer() {
@@ -110,6 +111,7 @@ public void checkApplications() {
110111
}
111112

112113
@Test
114+
@Category(UnstableTests.class)
113115
public void checkIncomingPhoneNumbers() {
114116
JsonArray incomingPhoneNumbersListJson = RestcommRvdProjectsMigratorTool.getInstance().getEntitiesList(
115117
deploymentUrl.toString(), adminUsername, adminAuthToken, adminAccountSid,
@@ -151,6 +153,7 @@ public void checkNotifications() {
151153
}
152154

153155
@Test
156+
@Category(UnstableTests.class)
154157
public void checkEmail() throws IOException, MessagingException, InterruptedException {
155158
mailServer.waitForIncomingEmail(60000, 1);
156159
MimeMessage[] messages = mailServer.getReceivedMessages();
@@ -173,7 +176,7 @@ public static WebArchive createWebArchiveRestcomm() throws Exception {
173176

174177
Map<String, String> replacements = new HashMap();
175178
replacements.put("3025", String.valueOf(smtpPort));
176-
//replace mediaport 2727
179+
//replace mediaport 2727
177180
replacements.put("2727", String.valueOf(mediaPort));
178181
replacements.put("8080", String.valueOf(restcommHTTPPort));
179182
replacements.put("5080", String.valueOf(restcommPort));
@@ -182,15 +185,15 @@ public static WebArchive createWebArchiveRestcomm() throws Exception {
182185
));
183186

184187
WebArchive archive = WebArchiveUtil.createWebArchiveNoGw("restcomm_workspaceMigration.xml",
185-
"restcomm.script_projectMigratorWorkspaceMigratedTest",
188+
"restcomm.script_projectMigratorWorkspaceMigratedTest",
186189
resources, replacements);
187-
190+
188191
String source = "src/test/resources/workspace-migration-scenarios/migrated";
189192
String target = "workspace-migration";
190193
File f = new File(source);
191-
addFiles(archive, f, source, target);
194+
addFiles(archive, f, source, target);
192195
return archive;
193-
}
196+
}
194197

195198
private static void addFiles(WebArchive war, File dir, String source, String target) throws Exception {
196199
if (!dir.isDirectory()) {
@@ -206,7 +209,7 @@ private static void addFiles(WebArchive war, File dir, String source, String tar
206209
}
207210
}
208211

209-
@BeforeClass
212+
@BeforeClass
210213
public static void startEmailServer() {
211214
ServerSetup setup = new ServerSetup(smtpPort, "127.0.0.1", "smtp");
212215
mailServer = new GreenMail(setup);

restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/RvdProjectsMigratorWorkspaceMixedTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import java.util.HashMap;
5353
import java.util.List;
5454
import java.util.Map;
55+
import org.junit.experimental.categories.Category;
5556
import org.restcomm.connect.commons.Version;
5657
import static org.restcomm.connect.testsuite.RvdProjectsMigratorWorkspaceMigratedTest.reconfigurePorts;
5758

@@ -147,6 +148,7 @@ public void checkApplications() {
147148
}
148149

149150
@Test
151+
@Category(UnstableTests.class)
150152
public void checkIncomingPhoneNumbers() {
151153
// Check those who should be migrated
152154
JsonArray incomingPhoneNumbersListJson = RestcommRvdProjectsMigratorTool.getInstance().getEntitiesList(
@@ -189,6 +191,7 @@ public void checkIncomingPhoneNumbers() {
189191
}
190192

191193
@Test
194+
@Category(UnstableTests.class)
192195
public void checkClients() {
193196
// Check those who should be migrated
194197
JsonArray clientsListJson = RestcommRvdProjectsMigratorTool.getInstance().getEntitiesList(deploymentUrl.toString(),

restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/RvdProjectsMigratorWorkspaceOriginalTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import java.util.HashMap;
5353
import java.util.List;
5454
import java.util.Map;
55+
import org.junit.experimental.categories.Category;
5556
import org.restcomm.connect.commons.Version;
5657
import static org.restcomm.connect.testsuite.RvdProjectsMigratorWorkspaceMigratedTest.reconfigurePorts;
5758

@@ -130,6 +131,7 @@ public void checkApplications() {
130131
}
131132

132133
@Test
134+
@Category(UnstableTests.class)
133135
public void checkIncomingPhoneNumbers() {
134136
JsonArray incomingPhoneNumbersListJson = RestcommRvdProjectsMigratorTool.getInstance().getEntitiesList(
135137
deploymentUrl.toString(), adminUsername, adminAuthToken, adminAccountSid,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.restcomm.connect.testsuite;
2+
3+
public interface UnstableTests {
4+
5+
}

restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/http/AccountsEndpointClosingTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
5252
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
5353
import static com.github.tomakehurst.wiremock.client.WireMock.verify;
54+
import org.junit.experimental.categories.Category;
55+
import org.restcomm.connect.testsuite.UnstableTests;
5456

5557
/**
5658
* @author otsakir@gmail.com - Orestis Tsakiridis
@@ -96,6 +98,7 @@ public void removeAccountAndSendNotifications() throws InterruptedException {
9698

9799
// verify that DID provider (nexmo) was contacted to cancel the numbers when the account is removed
98100
@Test
101+
@Category(UnstableTests.class)
99102
public void removeAccountAndReleaseProvidedNumbers() {
100103
stubFor(post(urlMatching("/nexmo/number/cancel/.*/.*/US/12223334444"))
101104
.willReturn(aResponse()

restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/http/AccountsEndpointTest.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
import com.sun.jersey.api.client.UniformInterfaceException;
4040
import com.sun.jersey.api.client.WebResource;
4141
import com.sun.jersey.core.util.MultivaluedMapImpl;
42+
import org.junit.experimental.categories.Category;
43+
import org.restcomm.connect.testsuite.UnstableTests;
4244

4345
/**
4446
* @author <a href="mailto:gvagenas@gmail.com">gvagenas</a>
@@ -98,15 +100,15 @@ public class AccountsEndpointTest extends EndpointTest {
98100
private String nonSubAccountSid = "AC44444444444444444444444444444444";
99101

100102
private String commonAuthToken = "77f8c12cc7b8f8423e5c38b035249166";
101-
103+
102104
private String organizationSid1 = "ORafbe225ad37541eba518a74248f0ac4c";
103105
private String organizationSid2 = "ORafbe225ad37541eba518a74248f0ac4d";
104106
private String organizationSid3 = "ORafbe225ad37541eba518a74248f0ac4e";
105-
107+
106108
private String organization1DomainName = "127.0.0.1";
107109
private String organization2DomainName = "org1.restcomm.com";
108110
private String organization3DomainName = "org2.restcomm.com";
109-
111+
110112

111113
static SipStackTool tool1;
112114

@@ -181,6 +183,7 @@ public void testCreateAccount() {
181183
}
182184

183185
@Test
186+
@Category(UnstableTests.class)
184187
public void testCreateAccountWithJapaneseChars() {
185188
String friendlyName = "NTTアドバンステクノロジ";
186189
JsonObject createAccountResponse = RestcommAccountsTool.getInstance().createAccount(deploymentUrl.toString(),
@@ -589,7 +592,7 @@ public void createAccountInSpecificOrganizationPermissionTest() {
589592
ClientResponse clientResponse = RestcommAccountsTool.getInstance().createAccountResponse(deploymentUrl.toString(),
590593
childUsername, childAuthToken, createdUsernanme, createdPassword, null, organizationSid2);
591594
assertEquals(403, clientResponse.getStatus());
592-
595+
593596
}
594597

595598
@Test
@@ -603,7 +606,7 @@ public void createAccountInSpecificOrganizationRoleTest() {
603606
clientResponse = RestcommAccountsTool.getInstance().createAccountResponse(deploymentUrl.toString(),
604607
adminUsername, adminAuthToken, createdUsernanme3, createdPassword, null, organizationSid2);
605608
assertEquals(200, clientResponse.getStatus());
606-
609+
607610
}
608611

609612
@Test
@@ -621,6 +624,7 @@ public void createAccountInSpecificOrganizationInvalidRequestTest() {
621624
}
622625

623626
@Test
627+
@Category(UnstableTests.class)
624628
public void testGetAccountsOfASpecificOrganization() {
625629
//getAccounts without any parameters
626630
ClientResponse response = RestcommAccountsTool.getInstance().getAccountsResponse(deploymentUrl.toString(), adminUsername, adminAuthToken);

restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/http/ApplicationsEndpointTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
import com.google.gson.JsonArray;
5151
import com.google.gson.JsonObject;
5252
import com.sun.jersey.core.util.MultivaluedMapImpl;
53+
import org.junit.experimental.categories.Category;
54+
import org.restcomm.connect.testsuite.UnstableTests;
5355

5456
/**
5557
* @author guilherme.jansen@telestax.com
@@ -75,6 +77,7 @@ public void after() throws InterruptedException {
7577
}
7678

7779
@Test
80+
@Category(UnstableTests.class)
7881
public void testCreateAndGetApplication() throws ParseException, IllegalArgumentException, ClientProtocolException,
7982
IOException {
8083
// Define application attributes

restcomm/restcomm.testsuite/src/test/java/org/restcomm/connect/testsuite/http/MultitenancyAllowAccessApiTest.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
1919
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
2020
*/
21-
21+
2222
package org.restcomm.connect.testsuite.http;
2323

2424
import static org.junit.Assert.assertTrue;
@@ -38,15 +38,17 @@
3838
import org.jboss.shrinkwrap.api.spec.WebArchive;
3939
import org.jboss.shrinkwrap.resolver.api.maven.archive.ShrinkWrapMaven;
4040
import org.junit.Test;
41+
import org.junit.experimental.categories.Category;
4142
import org.junit.runner.RunWith;
4243

4344
import org.restcomm.connect.commons.Version;
45+
import org.restcomm.connect.testsuite.UnstableTests;
4446
import wiremock.org.apache.http.client.ClientProtocolException;
4547

4648
/**
4749
* The aim of this scenario is to ensure that an account can manage its own information and the information from its sub
4850
* accounts. Accounts and Applications endpoints are tested separately due its particularities.
49-
*
51+
*
5052
* @author guilherme.jansen@telestax.com
5153
*/
5254
@RunWith(Arquillian.class)
@@ -75,16 +77,16 @@ public class MultitenancyAllowAccessApiTest {
7577
private final static String jsonExtension = ".json";
7678

7779
private enum Endpoint {
78-
80+
7981
INCOMING_PHONE_NUMBERS("IncomingPhoneNumbers", true, false, true, true, new HashMap<String,String>(){{ put("PhoneNumber","1111"); put("AreaCode","100"); }}, "PNff22dc8d1cdf4d449d666ac09f0bb110", "PN9f9cf955aeb94ebb9d2e09cead5683a4"),
80-
CALLS("Calls", true, false, false, false, null, "CA9aa1b61e9b864477a820d5c1c9d9bb7d", "CAc6a057e16aa74cb0923c538725ffcf01"),
81-
SMS_MESSAGES("SMS/Messages", true, false, false, false, null, "SMa272937700b3461bb5d68a3569c61bf1", "SMa272937700b3461bb5d68a3569c61bf2"),
82+
CALLS("Calls", true, false, false, false, null, "CA9aa1b61e9b864477a820d5c1c9d9bb7d", "CAc6a057e16aa74cb0923c538725ffcf01"),
83+
SMS_MESSAGES("SMS/Messages", true, false, false, false, null, "SMa272937700b3461bb5d68a3569c61bf1", "SMa272937700b3461bb5d68a3569c61bf2"),
8284
CLIENTS("Clients", true, true, true, true, new HashMap<String,String>(){{ put("Login","test"); put("Password","Restcomm12"); }}, "CLe95ba029114147c9a9aa42becd0518c0", "CL9bfcb54ead2b44e6bae03f337967a249"),
8385
OUTGOING_CALLER_IDS("OutgoingCallerIds", true, true, false, true, new HashMap<String,String>(){{ put("PhoneNumber","1111"); }}, "PNfa413fdbf3944932b37bef4bd661c7f7", "PN5a33fa8232d84578af023b1e81e30f67"),
8486
RECORDINGS("Recordings", true, false, false, false, null, "REacaffdf107da4dc3926e37bddfff44ed", "REacaffdf107da4dc3926e37bddfff44ee"),
8587
TRANSCRIPTIONS("Transcriptions", true, false, false, true, null, "TRacaffdf107da4dc3926e37bddfff44ee", "TRacaffdf107da4dc3926e37bddfff44ed"),
8688
NOTIFICATIONS("Notifications", true, false, false, false, null, "NO8927433ce9514b70ac0a76cd36601b9e", "NO8927433ce9514b70ac0a76cd36601b9d");
87-
89+
8890
String name;
8991
boolean get;
9092
boolean postList;
@@ -93,7 +95,7 @@ private enum Endpoint {
9395
HashMap<String, String> postParams;
9496
String elementSameAccount;
9597
String elementSubaccount;
96-
98+
9799
Endpoint(String name, boolean get, boolean postList, boolean postElement, boolean delete, HashMap<String,String> postParams, String elementSameAccount, String elementSubaccount){
98100
this.name = name;
99101
this.get = get;
@@ -104,7 +106,7 @@ private enum Endpoint {
104106
this.elementSameAccount = elementSameAccount;
105107
this.elementSubaccount = elementSubaccount;
106108
}
107-
109+
108110
}
109111

110112
@Test
@@ -163,6 +165,7 @@ public void postListSubaccount() throws ClientProtocolException, IOException {
163165
}
164166

165167
@Test
168+
@Category(UnstableTests.class)
166169
public void getElementSameAccount() throws ClientProtocolException, IOException {
167170
String baseUrl = deploymentUrl.toString() + apiPath + primaryAccountSid + "/";
168171
for (Endpoint endpoint : Endpoint.values()) {
@@ -176,6 +179,7 @@ public void getElementSameAccount() throws ClientProtocolException, IOException
176179
}
177180

178181
@Test
182+
@Category(UnstableTests.class)
179183
public void getElementSubaccount() throws ClientProtocolException, IOException {
180184
String baseUrl = deploymentUrl.toString() + apiPath + subaccountaAccountSid + "/";
181185
for (Endpoint endpoint : Endpoint.values()) {
@@ -252,7 +256,7 @@ public void accountsApi() throws ClientProtocolException, IOException {
252256
assertTrue(statusCode == httpOk);
253257
statusCode = RestcommMultitenancyTool.getInstance().post(baseUrl + jsonExtension, primaryUsername, accountsPassword, new HashMap<String,String>(){{ put("EmailAddress","test@test.com"); put("Password","RestComm12");}});
254258
Assert.assertEquals(httpOk, statusCode);
255-
259+
256260
// Sub account
257261
baseUrl = deploymentUrl.toString() + apiPath.substring(0, apiPath.length()-1);
258262
statusCode = RestcommMultitenancyTool.getInstance().get(baseUrl + jsonExtension + "/" + subaccountbAccountSid, primaryUsername, accountsPassword);

0 commit comments

Comments
 (0)