Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014-2016 ForgeRock AS.
* Portions copyright 2026 3A Systems,LLC
*/

package org.forgerock.openidm.audit.impl;
Expand Down Expand Up @@ -46,6 +47,7 @@
import org.forgerock.services.context.RootContext;
import org.forgerock.util.promise.Promise;
import org.forgerock.util.query.QueryFilter;
import org.forgerock.util.test.assertj.AssertJPromiseAssert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -81,15 +83,15 @@ public void testReadEntry() throws Exception {
));
Promise<ResourceResponse, ResourceException> createPromise =
routerAuditEventHandler.publishEvent(new RootContext(), ACCESS, content);
assertThat(createPromise).succeeded();
AssertJPromiseAssert.assertThat(createPromise).succeeded();
ResourceResponse createResponse = createPromise.getOrThrow();

// when
Promise<ResourceResponse, ResourceException> promise =
routerAuditEventHandler.readEvent(new RootContext(), ACCESS, TEST_ID);

// then
assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
ResourceResponse readResponse = promise.getOrThrow();
assertThat(readResponse.getId()).isEqualTo(TEST_ID);
assertThat(readResponse.getContent().get(FIELD_CONTENT_ID).required().asString())
Expand All @@ -109,7 +111,7 @@ public void testQueryEntries() throws Exception {
));
Promise<ResourceResponse, ResourceException> createPromise =
routerAuditEventHandler.publishEvent(new RootContext(), ACCESS, content);
assertThat(createPromise).succeeded();
AssertJPromiseAssert.assertThat(createPromise).succeeded();
createPromise.getOrThrow();

// when
Expand All @@ -130,7 +132,7 @@ public boolean handleResource(ResourceResponse resource) {
}
});
// then
assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
promise.getOrThrow();
assertThat(responses).hasSize(1);
assertThat(responses.get(0).getId()).isEqualTo(TEST_ID);
Expand All @@ -151,7 +153,7 @@ public void testCreateEntry() throws Exception {
routerAuditEventHandler.publishEvent(new RootContext(), ACCESS, content);

// then
assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
ResourceResponse resource = promise.getOrThrow();
assertThat(resource).isNotNull();
assertThat(resource.getContent().isEqualTo(content.put(FIELD_CONTENT_REVISION, "0"))).isTrue();
Expand All @@ -169,7 +171,7 @@ public boolean handleResource(ResourceResponse resource) {
return true;
}
});
assertThat(queryPromise).succeeded();
AssertJPromiseAssert.assertThat(queryPromise).succeeded();
queryPromise.getOrThrow();
assertThat(contentRecords).hasSize(1);
JsonValue dbContent = contentRecords.get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2016 ForgeRock AS
* Portions copyright 2026 3A Systems, LLC
*/
package org.forgerock.openidm.auth;

Expand Down Expand Up @@ -47,6 +48,7 @@
import org.forgerock.services.context.AttributesContext;
import org.forgerock.services.context.RootContext;
import org.forgerock.util.promise.Promise;
import org.forgerock.util.test.assertj.AssertJPromiseAssert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -244,8 +246,8 @@ public void testLogoutAction() throws Exception {
AttributesContext context = new AttributesContext(new RootContext());
Promise<ActionResponse, ResourceException> promise =
authenticationService.actionInstance(context, newActionRequest("", Action.logout.name()));
assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
assertThat(promise.get().getJsonContent().get("success").asBoolean()).isTrue();
assertThat(context.getAttributes()).containsEntry(JwtSessionModule.LOGOUT_SESSION_REQUEST_ATTRIBUTE_NAME, true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014-2016 ForgeRock AS.
* Portions copyright 2024-2026 3A Systems,LLC
*/
package org.forgerock.openidm.config.manage;

Expand Down Expand Up @@ -81,6 +82,7 @@
import org.forgerock.services.context.TransactionIdContext;
import org.forgerock.util.promise.Promise;
import org.forgerock.util.query.QueryFilter;
import org.forgerock.util.test.assertj.AssertJPromiseAssert;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
Expand Down Expand Up @@ -367,7 +369,7 @@ public void testPatchSendsClusterEvent() {

// then
verify(clusterManagementService, times(2)).sendEvent(any(ClusterEvent.class));
assertThat(results).isNotNull().succeeded();
AssertJPromiseAssert.assertThat(results).isNotNull().succeeded();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Portions copyright 2015-2016 ForgeRock AS.
* Portions copyright 2026 3A Systems,LLC
*/

package org.forgerock.openidm.sync.impl;
Expand Down Expand Up @@ -53,6 +54,7 @@
import org.forgerock.json.resource.Connection;
import org.forgerock.json.resource.CreateRequest;
import org.forgerock.util.promise.Promise;
import org.forgerock.util.test.assertj.AssertJPromiseAssert;
import org.mockito.ArgumentCaptor;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
Expand Down Expand Up @@ -155,7 +157,7 @@ public Promise<ResourceResponse, ResourceException> answer(InvocationOnMock invo
Promise<ActionResponse, ResourceException> promise = synchronizationService.actionInstance(
mock(Context.class), actionRequest);

assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
JsonValue resource = promise.get().getJsonContent().get(0);
assertThat(resource).stringAt("resourceName").isEqualTo("system/ldap/account/0123-456789ab-cdef");
assertThat(resource).hasNull("content");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2016 ForgeRock AS.
* Portions copyright 2019-2026 3A Systems, LLC
*/

package org.forgerock.openidm.external.rest;
Expand Down Expand Up @@ -49,6 +50,7 @@
import org.forgerock.services.context.Context;
import org.forgerock.util.promise.NeverThrowsException;
import org.forgerock.util.promise.Promise;
import org.forgerock.util.test.assertj.AssertJPromiseAssert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -195,7 +197,7 @@ public void testCallAction(final ClientRequestParams clientRequestParams, final

// then
if (expectedCode != null) {
assertThat(result).failedWithException();
AssertJPromiseAssert.assertThat(result).failedWithException();
try {
result.getOrThrow();
fail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2016 ForgeRock AS
* Portions copyright 2026 3A Systems,LLC
*/
package org.forgerock.openidm.idp.impl;

Expand All @@ -31,6 +32,7 @@
import org.forgerock.openidm.idp.config.ProviderConfig;
import org.forgerock.services.context.RootContext;
import org.forgerock.util.promise.Promise;
import org.forgerock.util.test.assertj.AssertJPromiseAssert;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -87,7 +89,7 @@ public void testReadInstance() throws Exception {

final Promise<ResourceResponse, ResourceException> promise =
service.readInstance(new RootContext(), newReadRequest(""));
assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
final JsonValue response = promise.get().getContent();

assertThat(response).hasArray("providers").hasSize(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2016 ForgeRock AS.
* Portions copyright 2026 3A Systems,LLC
*/
package org.forgerock.openidm.maintenance.impl;

Expand All @@ -31,6 +32,7 @@
import org.forgerock.services.context.Context;
import org.forgerock.services.context.RootContext;
import org.forgerock.util.promise.Promise;
import org.forgerock.util.test.assertj.AssertJPromiseAssert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -93,10 +95,10 @@ public void testFitlerCreate(boolean maintenanceEnabled, String resourcePath, Co
final CreateRequest request = newCreateRequest(resourcePath, object);
final Promise<ResourceResponse, ResourceException> promise = filter.filterCreate(context, request, handler);
if (passRequest) {
assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
assertThat(handler.getRequests()).containsExactly(request);
} else {
assertThat(promise).failedWithException().isInstanceOf(ServiceUnavailableException.class);
AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(ServiceUnavailableException.class);
assertThat(handler.getRequests()).isEmpty();
}
}
Expand Down Expand Up @@ -127,7 +129,7 @@ public void testFilterRead(String resourcePath) throws Exception {
// first create an object
final CreateRequest create = newCreateRequest(resourcePath, "1", object);
Promise<ResourceResponse, ResourceException> promise = filter.filterCreate(root, create, handler);
assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
assertThat(handler.getRequests()).containsExactly(create);

handler.addResource(promise.get());
Expand All @@ -136,7 +138,7 @@ public void testFilterRead(String resourcePath) throws Exception {
// perform the read
final ReadRequest request = newReadRequest(resourcePath, "1");
promise = filter.filterRead(root, request, handler);
assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
assertThat(handler.getRequests()).containsExactly(create, request);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2016 ForgeRock AS.
* Portions copyright 2026 3A Systems,LLC
*/
package org.forgerock.openidm.maintenance.impl;

Expand Down Expand Up @@ -45,6 +46,7 @@
import org.forgerock.services.context.RootContext;
import org.forgerock.util.promise.Promise;
import org.forgerock.util.query.QueryFilter;
import org.forgerock.util.test.assertj.AssertJPromiseAssert;
import org.testng.annotations.Test;

/**
Expand All @@ -56,25 +58,25 @@ public class UpdateLogServiceImplTest {

@Test
public void actionIsNotSupported() {
assertThat(updateLogService.handleAction(mock(Context.class), mock(ActionRequest.class)))
AssertJPromiseAssert.assertThat(updateLogService.handleAction(mock(Context.class), mock(ActionRequest.class)))
.failedWithException().isInstanceOf(NotSupportedException.class);
}

@Test
public void createIsNotSupported() {
assertThat(updateLogService.handleCreate(mock(Context.class), mock(CreateRequest.class)))
AssertJPromiseAssert.assertThat(updateLogService.handleCreate(mock(Context.class), mock(CreateRequest.class)))
.failedWithException().isInstanceOf(NotSupportedException.class);
}

@Test
public void deleteIsNotSupported() {
assertThat(updateLogService.handleDelete(mock(Context.class), mock(DeleteRequest.class)))
AssertJPromiseAssert.assertThat(updateLogService.handleDelete(mock(Context.class), mock(DeleteRequest.class)))
.failedWithException().isInstanceOf(NotSupportedException.class);
}

@Test
public void patchIsNotSupported() {
assertThat(updateLogService.handlePatch(mock(Context.class), mock(PatchRequest.class)))
AssertJPromiseAssert.assertThat(updateLogService.handlePatch(mock(Context.class), mock(PatchRequest.class)))
.failedWithException().isInstanceOf(NotSupportedException.class);
}

Expand All @@ -95,7 +97,7 @@ public boolean handleResource(ResourceResponse resource) {
return true;
}
});
assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
assertThat(handler.getRequests()).hasSize(1);
}

Expand All @@ -111,7 +113,7 @@ public void testRead() throws ResourceException {
final ReadRequest request = newReadRequest("1");
final Promise<ResourceResponse, ResourceException> promise =
updateLogService.handleRead(new RootContext(), request);
assertThat(promise).succeeded();
AssertJPromiseAssert.assertThat(promise).succeeded();
assertThat(handler.getRequests()).hasSize(1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* own identifying information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2016 ForgeRock AS.
* Portions copyright 2026 3A Systems,LLC
*/
package org.forgerock.openidm.provisioner.openicf.impl;

Expand Down Expand Up @@ -43,6 +44,7 @@
import org.forgerock.openidm.provisioner.openicf.commons.OperationOptionInfoHelper;
import org.forgerock.services.context.RootContext;
import org.forgerock.util.promise.Promise;
import org.forgerock.util.test.assertj.AssertJPromiseAssert;
import org.identityconnectors.framework.api.ConnectorFacade;
import org.identityconnectors.framework.api.operations.APIOperation;
import org.identityconnectors.framework.api.operations.CreateApiOp;
Expand Down Expand Up @@ -91,7 +93,7 @@ public void testUnsupportedCreateWithId() throws Exception {
createHttpContext("PUT", httpHeaders),
Requests.newCreateRequest("", "fakeId", json(object())));
// then
assertThat(upsertPromise)
AssertJPromiseAssert.assertThat(upsertPromise)
.isNotNull()
.failedWithException()
.hasCauseInstanceOf(UnsupportedOperationException.class)
Expand All @@ -103,7 +105,7 @@ public void testUnsupportedCreateWithId() throws Exception {
createHttpContext("PUT", httpHeaders),
Requests.newCreateRequest("", "fakeId", json(object())));
// then
assertThat(upsertPromise)
AssertJPromiseAssert.assertThat(upsertPromise)
.isNotNull()
.failedWithException()
.hasCauseInstanceOf(UnsupportedOperationException.class)
Expand All @@ -113,7 +115,7 @@ public void testUnsupportedCreateWithId() throws Exception {
Promise<ResourceResponse, ResourceException> createPromise = resourceProvider.handleCreate(new RootContext(),
Requests.newCreateRequest("", "fakeId", json(object())));
// then
assertThat(createPromise)
AssertJPromiseAssert.assertThat(createPromise)
.isNotNull()
.failedWithException()
.hasCauseInstanceOf(UnsupportedOperationException.class)
Expand Down
8 changes: 7 additions & 1 deletion openidm-repo-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
~ your own identifying information:
~ "Portions Copyrighted [year] [name of copyright owner]"
~
~ Portions Copyrighted 2024 3A Systems LLC.
~ Portions Copyrighted 2019-2026 3A Systems LLC.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -136,6 +136,12 @@
<groupId>org.openidentityplatform.commons</groupId>
<artifactId>util</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.27.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@
<dependency>
<groupId>org.openidentityplatform</groupId>
<artifactId>openicf</artifactId>
<version>2.0.2</version>
<version>2.0.3-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Loading