Skip to content

Commit 7089b8f

Browse files
elavarasidcshirleyqin-msftypradhan-msft
authored
ACS Rooms public preview changes for Java SDK (Azure#30248)
* Rooms Public preview Java SDK changes * fix roleType converter and add tests * 1. Addding delete room method. 2. Rename to getParticipants. 3. Update Tests * Add test to deleteRoom synchronously. * Fix Preview to be in capital letters * Fix tests to apply capitalize changes * RoomModel is renamed to Communication room. Removing RoomModel. * Remove unnecessary comments * Dependencies updated as raised by CI pipeline. * Build pipeline ci added * Remove dependency that is not required * Updated releas and fixed release date. * Removed jacoco-maven-plugin * Moved links to the bottom of README.md * Addressed board review comments * Fix formatting of pom.xml * Fix release date * Remove todo * fix idendation. * Update Readme.md * Updated README.md to remove embeds and use plugin for code generation. * Adding rooms to version_client.txt to fix analyzer build failure. * Updated dependency version as suggested by analyzer build * Adding trouble shooting tag to readme * Remove preview from version to align with the service version name * Remove Preview from version * Remove preview * Comments out the cleanup fucntions * Trying to fix build error by adding opens to. * Trying options to fix build faiure. * Trying options to fix build faliure * Todo: Remove this commit. Rooms recording is not working. Testing on chat recording to see if it solves build issue. * Add Rooms recording. * Update dependency version to latest * Addressed review comments. * Fixes a type and adds a missing assert * Updates pom.xml Co-authored-by: Shirley Qin <[email protected]> Co-authored-by: Yamini Pradhan <[email protected]>
1 parent 447a25f commit 7089b8f

File tree

102 files changed

+12665
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+12665
-0
lines changed

eng/versioning/version_client.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ com.azure:azure-communication-sms;1.1.4;1.2.0-beta.1
6565
com.azure:azure-communication-identity;1.2.0;1.3.0-beta.1
6666
com.azure:azure-communication-phonenumbers;1.0.13;1.1.0-beta.9
6767
com.azure:azure-communication-networktraversal;1.1.0-beta.2;1.1.0-beta.3
68+
com.azure:azure-communication-rooms;1.0.0-beta.1;1.0.0-beta.1
6869
com.azure:azure-containers-containerregistry;1.0.6;1.1.0-beta.2
6970
com.azure:azure-containers-containerregistry-perf;1.0.0-beta.1;1.0.0-beta.1
7071
com.azure:azure-core;1.31.0;1.32.0-beta.1

sdk/communication/azure-communication-common/src/main/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
com.azure.communication.identity,
1818
com.azure.communication.phonenumbers,
1919
com.azure.communication.chat,
20+
com.azure.communication.rooms,
2021
com.azure.communication.callingserver,
2122
com.azure.communication.networktraversal;
2223
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Release History
2+
3+
## 1.0.0-beta.1 (2022-02-01)
4+
This is the initial release of Azure Communication Services for rooms. For more information, please see the [README][read_me] and [documentation][documentation].
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
## Azure Communications Rooms Service client library for Java
2+
3+
Azure Communication Rooms is used to operate on rooms.
4+
5+
[Source code][source] | [Package (Maven)][package] | [API reference documentation][api_documentation]
6+
| [Product documentation][product_docs]
7+
8+
## Getting started
9+
10+
### Prerequisites
11+
12+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
13+
- [Java Development Kit (JDK)](https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable) version 8 or above.
14+
- [Apache Maven](https://maven.apache.org/download.cgi).
15+
- A deployed Communication Services resource. You can use the [Azure Portal](https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp) or the [Azure PowerShell](https://docs.microsoft.com/powershell/module/az.communication/new-azcommunicationservice) to set it up.
16+
17+
### Include the package
18+
19+
#### Include direct dependency
20+
If you want to take dependency on a particular version of the library that is not present in the BOM,
21+
add the direct dependency to your project as follows.
22+
23+
[//]: # ({x-version-update-start;com.azure:azure-communication-rooms;current})
24+
```xml
25+
<dependency>
26+
<groupId>com.azure</groupId>
27+
<artifactId>azure-communication-rooms</artifactId>
28+
<version>1.0.0-beta.1</version>
29+
</dependency>
30+
```
31+
32+
## Authenticate the client
33+
34+
### Azure Active Directory Token Authentication
35+
A `DefaultAzureCredential` object must be passed to the `RoomsClientBuilder` via the credential() function. Endpoint and httpClient must also be set via the endpoint() and httpClient() functions respectively.
36+
37+
`AZURE_CLIENT_SECRET`, `AZURE_CLIENT_ID` and `AZURE_TENANT_ID` environment variables
38+
are needed to create a DefaultAzureCredential object.
39+
40+
Alternatively, you can provide the entire connection string using the connectionString() function instead of providing the endpoint and access key.
41+
42+
```java readme-sample-createRoomsClientWithConnectionString
43+
44+
public RoomsClient createRoomsClientWithConnectionString() {
45+
// You can find your connection string from your resource in the Azure Portal
46+
String connectionString = "https://<resource-name>.communication.azure.com/;<access-key>";
47+
48+
RoomsClient roomsClient = new RoomsClientBuilder().connectionString(connectionString).buildClient();
49+
50+
return roomsClient;
51+
}
52+
```
53+
54+
## Key concepts
55+
56+
There are four operations to interact with the Azure Communication Rooms Service.
57+
58+
## Examples
59+
60+
### Create a new room
61+
Use the `createRoom` function to create a new Room on Azure Communciation Service.
62+
63+
```java readme-sample-createRoomWithValidInput
64+
public void createRoomWithValidInput() {
65+
OffsetDateTime validFrom = OffsetDateTime.of(2021, 8, 1, 5, 30, 20, 10, ZoneOffset.UTC);
66+
OffsetDateTime validUntil = OffsetDateTime.of(2021, 9, 1, 5, 30, 20, 10, ZoneOffset.UTC);
67+
List<RoomParticipant> participants = new ArrayList<>();
68+
// Add two participants
69+
participants.add(new RoomParticipant().setCommunicationIdentifier(new CommunicationUserIdentifier("<ACS User MRI identity 1>")).setRole(RoleType.ATTENDEE));
70+
participants.add(new RoomParticipant().setCommunicationIdentifier(new CommunicationUserIdentifier("<ACS User MRI identity 2>")).setRole(RoleType.CONSUMER));
71+
72+
RoomsClient roomsClient = createRoomsClientWithConnectionString();
73+
CommunicationRoom roomResult = roomsClient.createRoom(validFrom, validUntil, RoomJoinPolicy.INVITE_ONLY, participants);
74+
System.out.println("Room Id: " + roomResult.getRoomId());
75+
}
76+
```
77+
78+
### Create a new open room
79+
Use the `createRoom` function to create a new Open Room on Azure Communciation Service.
80+
81+
```java readme-sample-createOpenRoomWithValidInput
82+
public void createOpenRoomWithValidInput() {
83+
OffsetDateTime validFrom = OffsetDateTime.of(2021, 8, 1, 5, 30, 20, 10, ZoneOffset.UTC);
84+
OffsetDateTime validUntil = OffsetDateTime.of(2021, 9, 1, 5, 30, 20, 10, ZoneOffset.UTC);
85+
86+
RoomsClient roomsClient = createRoomsClientWithConnectionString();
87+
CommunicationRoom roomResult = roomsClient.createRoom(validFrom, validUntil, RoomJoinPolicy.INVITE_ONLY, null);
88+
System.out.println("Room Id: " + roomResult.getRoomId());
89+
}
90+
```
91+
92+
### Update an existing room
93+
Use the `updateRoom` function to create a new Room on Azure Communciation Service.
94+
95+
```java readme-sample-updateRoomWithRoomId
96+
public void updateRoomWithRoomId() {
97+
OffsetDateTime validFrom = OffsetDateTime.of(2021, 8, 1, 5, 30, 20, 10, ZoneOffset.UTC);
98+
OffsetDateTime validUntil = OffsetDateTime.of(2021, 9, 1, 5, 30, 20, 10, ZoneOffset.UTC);
99+
List<RoomParticipant> participants = new ArrayList<>();
100+
participants.add(new RoomParticipant().setCommunicationIdentifier(new CommunicationUserIdentifier("<ACS User MRI identity 1>")).setRole(RoleType.ATTENDEE));
101+
participants.add(new RoomParticipant().setCommunicationIdentifier(new CommunicationUserIdentifier("<ACS User MRI identity 2>")).setRole(RoleType.CONSUMER));
102+
103+
RoomsClient roomsClient = createRoomsClientWithConnectionString();
104+
105+
try {
106+
CommunicationRoom roomResult = roomsClient.updateRoom("<Room Id in String>", validFrom, validUntil, null, participants);
107+
System.out.println("Room Id: " + roomResult.getRoomId());
108+
109+
} catch (RuntimeException ex) {
110+
System.out.println(ex);
111+
}
112+
}
113+
```
114+
115+
### Get an existing room
116+
Use the `getRoom` function to get an existing Room on Azure Communciation Service.
117+
118+
```java readme-sample-getRoomWithRoomId
119+
public void getRoomWithRoomId() {
120+
RoomsClient roomsClient = createRoomsClientWithConnectionString();
121+
try {
122+
CommunicationRoom roomResult = roomsClient.getRoom("<Room Id in String>");
123+
System.out.println("Room Id: " + roomResult.getRoomId());
124+
} catch (RuntimeException ex) {
125+
System.out.println(ex);
126+
}
127+
}
128+
```
129+
130+
### Delete an existing room
131+
Use the `deleteRoomWithResponse` function to delete an existing Room on Azure Communciation Service.
132+
133+
```java readme-sample-deleteRoomWithRoomId
134+
public void deleteRoomWithRoomId() {
135+
RoomsClient roomsClient = createRoomsClientWithConnectionString();
136+
try {
137+
roomsClient.deleteRoomWithResponse("<Room Id in String>", Context.NONE);
138+
} catch (RuntimeException ex) {
139+
System.out.println(ex);
140+
}
141+
}
142+
```
143+
144+
### Add participants an existing room
145+
Use the `addParticipants` function to add participants to an existing Room on Azure Communciation Service.
146+
147+
```java readme-sample-addRoomParticipantsWithRoomId
148+
public void addRoomParticipantsWithRoomId() {
149+
RoomParticipant user1 = new RoomParticipant().setCommunicationIdentifier(new CommunicationUserIdentifier("8:acs:b6372803-0c35-4ec0-833b-c19b798cef2d_0000000e-3240-55cf-9806-113a0d001dd9")).setRole(RoleType.ATTENDEE);
150+
RoomParticipant user2 = new RoomParticipant().setCommunicationIdentifier(new CommunicationUserIdentifier("8:acs:b6372803-0c35-4ec0-833b-c19b798cef2d_0000000e-3240-55cf-9806-113a0d001dd7")).setRole(RoleType.PRESENTER);
151+
RoomParticipant user3 = new RoomParticipant().setCommunicationIdentifier(new CommunicationUserIdentifier("8:acs:b6372803-0c35-4ec0-833b-c19b798cef2d_0000000e-3240-55cf-9806-113a0d001dd5")).setRole(RoleType.CONSUMER);
152+
153+
List<RoomParticipant> participants = new ArrayList<RoomParticipant>(Arrays.asList(user1, user2, user3));
154+
RoomsClient roomsClient = createRoomsClientWithConnectionString();
155+
156+
try {
157+
ParticipantsCollection roomParticipants = roomsClient.addParticipants("<Room Id>", participants);
158+
System.out.println("No. of Participants in Room: " + roomParticipants.getParticipants().size());
159+
160+
} catch (RuntimeException ex) {
161+
System.out.println(ex);
162+
}
163+
}
164+
```
165+
166+
### Remove participants an existing room
167+
Use the `removeParticipants` function to remove participants from an existing Room on Azure Communciation Service.
168+
169+
```java readme-sample-removeRoomParticipantsWithRoomId
170+
public void removeRoomParticipantsWithRoomId() {
171+
RoomParticipant user1 = new RoomParticipant().setCommunicationIdentifier(new CommunicationUserIdentifier("8:acs:b6372803-0c35-4ec0-833b-c19b798cef2d_0000000e-3240-55cf-9806-113a0d001dd9")).setRole(RoleType.ATTENDEE);
172+
RoomParticipant user2 = new RoomParticipant().setCommunicationIdentifier(new CommunicationUserIdentifier("8:acs:b6372803-0c35-4ec0-833b-c19b798cef2d_0000000e-3240-55cf-9806-113a0d001dd7")).setRole(RoleType.PRESENTER);
173+
174+
List<RoomParticipant> participants = new ArrayList<RoomParticipant>(Arrays.asList(user1, user2));
175+
RoomsClient roomsClient = createRoomsClientWithConnectionString();
176+
177+
try {
178+
ParticipantsCollection roomParticipants = roomsClient.removeParticipants("<Room Id>", participants);
179+
System.out.println("Room Id: " + roomParticipants.getParticipants().size());
180+
181+
} catch (RuntimeException ex) {
182+
System.out.println(ex);
183+
}
184+
}
185+
```
186+
187+
## Troubleshooting
188+
189+
1. If creating a client fails, verify if you have the right connection string.
190+
2. For room creation failures the communication error should in most case give a brief description of the issue.
191+
3. For participants update failures, make sure the participants are present in the room using the get participants.
192+
193+
## Next steps
194+
195+
- [Read more about Rooms in Azure Communication Services][next_steps]
196+
197+
## Contributing
198+
199+
This project welcomes contributions and suggestions. Most contributions require you to agree to a [Contributor License Agreement (CLA)][cla] declaring that you have the right to, and actually do, grant us the rights to use your contribution.
200+
201+
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
202+
203+
This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [[email protected]][coc_contact] with any additional questions or comments.
204+
205+
<!-- LINKS -->
206+
[cla]: https://cla.microsoft.com
207+
[coc]: https://opensource.microsoft.com/codeofconduct/
208+
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
209+
[coc_contact]: mailto:[email protected]
210+
[product_docs]: https://docs.microsoft.com/azure/communication-services/
211+
[api_documentation]: https://aka.ms/java-docs
212+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fappconfiguration%2Fazure-data-appconfiguration%2FREADME.png)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
2+
3+
trigger:
4+
branches:
5+
include:
6+
- main
7+
- hotfix/*
8+
- release/*
9+
paths:
10+
include:
11+
- sdk/communication/azure-communication-rooms/
12+
exclude:
13+
- sdk/communication/azure-communication-rooms/pom.xml
14+
15+
pr:
16+
branches:
17+
include:
18+
- main
19+
- feature/*
20+
- hotfix/*
21+
- release/*
22+
paths:
23+
include:
24+
- sdk/communication/azure-communication-rooms/
25+
exclude:
26+
- sdk/communication/azure-communication-rooms/pom.xml
27+
28+
extends:
29+
template: /eng/pipelines/templates/stages/archetype-sdk-client.yml
30+
parameters:
31+
ServiceDirectory: communication
32+
EnableBatchRelease: true
33+
Artifacts:
34+
- name: azure-communication-rooms
35+
groupId: com.azure
36+
safeName: azurecommunicationrooms
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
2+
the MIT License. -->
3+
<project xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<parent>
9+
<groupId>com.azure</groupId>
10+
<artifactId>azure-client-sdk-parent</artifactId>
11+
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
12+
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
13+
</parent>
14+
15+
<groupId>com.azure</groupId>
16+
<artifactId>azure-communication-rooms</artifactId>
17+
<packaging>jar</packaging>
18+
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-communication-rooms;current} -->
19+
<name>Microsoft Azure library for ACS Room Service</name>
20+
<description>
21+
This package contains clients and data structures used to create, update, get, delete the Azure Communication Room Service.
22+
For this release, see notes
23+
Microsoft Azure Communication Rooms quickstart
24+
</description>
25+
<url>https://github.com/Azure/azure-sdk-for-java</url>
26+
27+
<distributionManagement>
28+
<site>
29+
<id>azure-java-build-docs</id>
30+
<url>${site.url}/site/${project.artifactId}</url>
31+
</site>
32+
</distributionManagement>
33+
34+
<scm>
35+
<url>https://github.com/Azure/azure-sdk-for-java</url>
36+
<connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection>
37+
<tag>HEAD</tag>
38+
</scm>
39+
40+
<properties>
41+
<src.dir>src/main</src.dir>
42+
<test.dir>src/test</test.dir>
43+
<jacoco.min.linecoverage>0.60</jacoco.min.linecoverage>
44+
<jacoco.min.branchcoverage>0.60</jacoco.min.branchcoverage>
45+
<jacoco.skip>true</jacoco.skip>
46+
<!-- Configures the Java 9+ run to perform the required module exports,
47+
opens, and reads that are necessary for testing but shouldn't be part of
48+
the module-info. -->
49+
<javaModulesSurefireArgLine>
50+
--add-opens
51+
com.azure.communication.common/com.azure.communication.common.implementation=ALL-UNNAMED
52+
</javaModulesSurefireArgLine>
53+
<codesnippet.skip>false</codesnippet.skip>
54+
<javadocDoclet></javadocDoclet>
55+
<javadocDocletOptions></javadocDocletOptions>
56+
</properties>
57+
58+
<dependencies>
59+
<dependency>
60+
<groupId>com.azure</groupId>
61+
<artifactId>azure-core</artifactId>
62+
<version>1.31.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
63+
</dependency>
64+
<dependency>
65+
<groupId>com.azure</groupId>
66+
<artifactId>azure-communication-common</artifactId>
67+
<version>1.3.0-beta.1</version> <!-- {x-version-update;com.azure:azure-communication-common;current} -->
68+
</dependency>
69+
<dependency>
70+
<groupId>com.azure</groupId>
71+
<artifactId>azure-communication-identity</artifactId>
72+
<version>1.2.0</version> <!-- {x-version-update;com.azure:azure-communication-identity;dependency} -->
73+
<scope>test</scope>
74+
</dependency>
75+
<dependency>
76+
<groupId>com.azure</groupId>
77+
<artifactId>azure-core-test</artifactId>
78+
<version>1.11.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
79+
<scope>test</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>org.junit.jupiter</groupId>
83+
<artifactId>junit-jupiter-api</artifactId>
84+
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-api;external_dependency} -->
85+
<scope>test</scope>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.junit.jupiter</groupId>
89+
<artifactId>junit-jupiter-engine</artifactId>
90+
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
91+
<scope>test</scope>
92+
</dependency>
93+
<dependency>
94+
<groupId>org.junit.jupiter</groupId>
95+
<artifactId>junit-jupiter-params</artifactId>
96+
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-params;external_dependency} -->
97+
<scope>test</scope>
98+
</dependency>
99+
<dependency>
100+
<groupId>io.projectreactor</groupId>
101+
<artifactId>reactor-test</artifactId>
102+
<version>3.4.21</version> <!-- {x-version-update;io.projectreactor:reactor-test;external_dependency} -->
103+
<scope>test</scope>
104+
</dependency>
105+
<dependency>
106+
<groupId>com.azure</groupId>
107+
<artifactId>azure-core-http-okhttp</artifactId>
108+
<version>1.11.1</version> <!-- {x-version-update;com.azure:azure-core-http-okhttp;dependency} -->
109+
<scope>test</scope>
110+
</dependency>
111+
<dependency>
112+
<groupId>com.azure</groupId>
113+
<artifactId>azure-identity</artifactId>
114+
<version>1.5.4</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
115+
<scope>test</scope>
116+
</dependency>
117+
</dependencies>
118+
</project>

0 commit comments

Comments
 (0)