Skip to content

Commit edcbe34

Browse files
committed
rolled in comments
1 parent 4ee17b4 commit edcbe34

File tree

2 files changed

+4
-94
lines changed

2 files changed

+4
-94
lines changed

javav2/example_code/iotsitewise/src/main/java/com/example/iotsitewise/scenario/SitewiseActions.java

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -344,67 +344,6 @@ public CompletableFuture<DeleteAssetModelResponse> deleteAssetModelAsync(String
344344
}
345345
// snippet-end:[sitewise.java2.delete.asset.model.main]
346346

347-
// snippet-start:[sitewise.java2.create.portal.main]
348-
/**
349-
* Creates a new IoT SiteWise portal.
350-
*
351-
* @param portalName the name of the portal to create.
352-
* @param iamRole the IAM role ARN to use for the portal.
353-
* @param contactEmail the email address of the portal contact.
354-
* @return a {@link CompletableFuture} that represents a {@link String} result of the portal ID. The calling code
355-
* can attach callbacks, then handle the result or exception by calling {@link CompletableFuture#join()} or
356-
* {@link CompletableFuture#get()}.
357-
* <p>
358-
* If any completion stage in this method throws an exception, the method logs the exception cause and keeps
359-
* it available to the calling code as a {@link CompletionException}. By calling
360-
* {@link CompletionException#getCause()}, the calling code can access the original exception.
361-
*/
362-
public CompletableFuture<String> createPortalAsync(String portalName, String iamRole, String contactEmail) {
363-
CreatePortalRequest createPortalRequest = CreatePortalRequest.builder()
364-
.portalName(portalName)
365-
.portalDescription("This is my custom IoT SiteWise portal.")
366-
.portalContactEmail(contactEmail)
367-
.roleArn(iamRole)
368-
.build();
369-
370-
return getAsyncClient().createPortal(createPortalRequest)
371-
.handle((response, exception) -> {
372-
if (exception != null) {
373-
logger.error("Failed to create portal: {} ", exception.getCause().getMessage());
374-
throw (CompletionException) exception;
375-
}
376-
return response.portalId();
377-
});
378-
}
379-
// snippet-end:[sitewise.java2.create.portal.main]
380-
381-
// snippet-start:[sitewise.java2.delete.portal.main]
382-
/**
383-
* Deletes a portal.
384-
*
385-
* @param portalId the ID of the portal to be deleted.
386-
* @return a {@link CompletableFuture} that represents a {@link DeletePortalResponse}. The calling code can attach
387-
* callbacks, then handle the result or exception by calling {@link CompletableFuture#join()} or
388-
* {@link CompletableFuture#get()}.
389-
* <p>
390-
* If any completion stage in this method throws an exception, the method logs the exception cause and keeps
391-
* it available to the calling code as a {@link CompletionException}. By calling
392-
* {@link CompletionException#getCause()}, the calling code can access the original exception.
393-
*/
394-
public CompletableFuture<DeletePortalResponse> deletePortalAsync(String portalId) {
395-
DeletePortalRequest deletePortalRequest = DeletePortalRequest.builder()
396-
.portalId(portalId)
397-
.build();
398-
399-
return getAsyncClient().deletePortal(deletePortalRequest)
400-
.whenComplete((response, exception) -> {
401-
if (exception != null) {
402-
logger.error("Failed to delete portal with ID: {}. Error: {}", portalId, exception.getCause().getMessage());
403-
}
404-
});
405-
}
406-
// snippet-end:[sitewise.java2.delete.portal.main]
407-
408347
// snippet-start:[sitewise.java2.list.asset.model.main]
409348
/**
410349
* Retrieves the asset model ID for the given asset model name.
@@ -436,35 +375,6 @@ public CompletableFuture<String> getAssetModelIdAsync(String assetModelName) {
436375
}
437376
// snippet-end:[sitewise.java2.list.asset.model.main]
438377

439-
// snippet-start:[sitewise.java2.describe.portal.main]
440-
/**
441-
* Retrieves a portal's description.
442-
*
443-
* @param portalId the ID of the portal to describe.
444-
* @return a {@link CompletableFuture} that represents a {@link String} result of the portal's start URL
445-
* (see: {@link DescribePortalResponse#portalStartUrl()}). The calling code can attach callbacks, then handle the
446-
* result or exception by calling {@link CompletableFuture#join()} or {@link CompletableFuture#get()}.
447-
* <p>
448-
* If any completion stage in this method throws an exception, the method logs the exception cause and keeps
449-
* it available to the calling code as a {@link CompletionException}. By calling
450-
* {@link CompletionException#getCause()}, the calling code can access the original exception.
451-
*/
452-
public CompletableFuture<String> describePortalAsync(String portalId) {
453-
DescribePortalRequest request = DescribePortalRequest.builder()
454-
.portalId(portalId)
455-
.build();
456-
457-
return getAsyncClient().describePortal(request)
458-
.handle((response, exception) -> {
459-
if (exception != null) {
460-
logger.error("An exception occurred retrieving the portal description: {}", exception.getCause().getMessage());
461-
throw (CompletionException) exception;
462-
}
463-
return response.portalStartUrl();
464-
});
465-
}
466-
// snippet-end:[sitewise.java2.describe.portal.main]
467-
468378
// snippet-start:[sitewise.java2.create.gateway.main]
469379

470380
/**

javav2/example_code/iotsitewise/src/test/java/SitewiseTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public void testGETHumValue() {
154154

155155
@Test
156156
@Tag("IntegrationTest")
157-
@Order(9)
157+
@Order(7)
158158
public void testCreateGateway() {
159159
assertDoesNotThrow(() -> {
160160
gatewayId = sitewiseActions.createGatewayAsync(gatewayName, myThing).join();
@@ -165,7 +165,7 @@ public void testCreateGateway() {
165165

166166
@Test
167167
@Tag("IntegrationTest")
168-
@Order(10)
168+
@Order(8)
169169
public void testDescribeGateway() {
170170
assertDoesNotThrow(() -> {
171171
sitewiseActions.describeGatewayAsync(gatewayId).join();
@@ -175,7 +175,7 @@ public void testDescribeGateway() {
175175

176176
@Test
177177
@Tag("IntegrationTest")
178-
@Order(12)
178+
@Order(9)
179179
public void testDeleteAsset() throws InterruptedException {
180180
Thread.sleep(30000);
181181
assertDoesNotThrow(() -> {
@@ -186,7 +186,7 @@ public void testDeleteAsset() throws InterruptedException {
186186

187187
@Test
188188
@Tag("IntegrationTest")
189-
@Order(13)
189+
@Order(10)
190190
public void testDeleteAssetModel() throws InterruptedException {
191191
Thread.sleep(30000);
192192
assertDoesNotThrow(() -> {

0 commit comments

Comments
 (0)