This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new 62f222a301 Prefer Mutable/MutableObject over AtomicReference for
utility
62f222a301 is described below
commit 62f222a301d43236993539af2c41ff2733ee49e0
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Wed Apr 23 09:42:30 2025 +0200
Prefer Mutable/MutableObject over AtomicReference for utility
---
.../clientapps/ClientAppModalPanelBuilder.java | 2 +-
.../apache/syncope/client/console/panels/OIDC.java | 25 ++++++++--------
.../client/console/rest/OIDCJWKSRestClient.java | 9 +++---
.../wizards/any/LinkedAccountDetailsPanel.java | 15 +++++-----
.../client/zookeeper/ZookeeperTestingServer.java | 13 +++++----
.../org/apache/syncope/core/logic/GroupLogic.java | 14 +++++----
.../core/persistence/api/utils/URIUtilsTest.java | 15 +++++-----
.../common/validation/AttributableValidator.java | 31 ++++++++++----------
.../jpa/dao/repo/ExternalResourceRepoExtImpl.java | 11 ++++----
.../dao/repo/ExternalResourceRepoExtImpl.java | 11 ++++----
.../syncope/core/provisioning/api/Connector.java | 10 +++----
.../provisioning/java/ConnectorFacadeProxy.java | 18 ++++++------
.../provisioning/java/DefaultMappingManager.java | 33 +++++++++++-----------
.../java/data/JEXLItemTransformerImpl.java | 11 ++++----
.../java/data/SchemaDataBinderImpl.java | 27 +++++++++---------
.../provisioning/java/job/MacroJobDelegate.java | 20 +++++++------
.../AbstractPropagationTaskExecutor.java | 19 +++++++------
.../java/pushpull/stream/CSVStreamConnector.java | 12 ++++----
.../java/job/SyncopeTaskSchedulerTest.java | 9 +++---
.../UsernamePasswordAuthenticationProvider.java | 22 ++++++++-------
.../starter/actuate/DomainsHealthIndicator.java | 9 +++---
.../actuate/ExternalResourcesHealthIndicator.java | 9 +++---
.../ext/openfga/client/OpenFGAHealthIndicator.java | 11 ++++----
.../org/apache/syncope/fit/AbstractITCase.java | 19 +++++++------
.../fit/core/AbstractNotificationTaskITCase.java | 9 +++---
.../syncope/fit/core/AbstractTaskITCase.java | 21 +++++++-------
.../org/apache/syncope/fit/core/BatchITCase.java | 13 +++++----
.../org/apache/syncope/fit/core/GroupITCase.java | 11 ++++----
.../apache/syncope/fit/core/KeymasterITCase.java | 11 ++++----
.../apache/syncope/fit/core/LiveSyncITCase.java | 9 +++---
.../apache/syncope/fit/core/PullTaskITCase.java | 9 +++---
.../org/apache/syncope/fit/core/ReportITCase.java | 14 +++++----
.../java/org/apache/syncope/sra/RouteProvider.java | 29 ++++++++++---------
.../apache/syncope/sra/ZookeeperTestingServer.java | 21 +++++++-------
.../syncope/wa/starter/ZookeeperTestingServer.java | 19 +++++++------
35 files changed, 288 insertions(+), 253 deletions(-)
diff --git
a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
index 4694247dc7..784023fbe0 100644
---
a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
+++
b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
@@ -301,7 +301,7 @@ public class ClientAppModalPanelBuilder<T extends
ClientAppTO> extends AbstractM
AjaxTextFieldPanel clientSecret = new AjaxTextFieldPanel(
"field", "clientSecret", new
PropertyModel<>(clientAppTO, "clientSecret"), false);
clientSecret.setChoices(List.of(RandomStringUtils.secure().nextNumeric(15)));
- fields.add(clientSecret.setRequired(true));
+ fields.add(clientSecret);
AjaxTextFieldPanel idTokenIssuer = new AjaxTextFieldPanel(
"field", "idTokenIssuer", new
PropertyModel<>(clientAppTO, "idTokenIssuer"), false);
diff --git
a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/OIDC.java
b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/OIDC.java
index 4bc40ab029..416752079a 100644
---
a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/OIDC.java
+++
b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/OIDC.java
@@ -21,7 +21,8 @@ package org.apache.syncope.client.console.panels;
import com.fasterxml.jackson.databind.json.JsonMapper;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import java.io.IOException;
-import java.util.concurrent.atomic.AtomicReference;
+import java.util.Optional;
+import org.apache.commons.lang3.mutable.Mutable;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.rest.OIDCJWKSRestClient;
import
org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
@@ -82,7 +83,7 @@ public class OIDC extends Panel {
WebMarkupContainer container = new WebMarkupContainer("container");
add(container.setOutputMarkupId(true));
- AtomicReference<OIDCJWKSTO> oidcjwksto = oidcJWKSRestClient.get();
+ Mutable<OIDCJWKSTO> oidcjwksto = oidcJWKSRestClient.get();
view = new AjaxLink<>("view") {
@@ -93,10 +94,10 @@ public class OIDC extends Panel {
String pretty;
try {
pretty = MAPPER.writerWithDefaultPrettyPrinter().
-
writeValueAsString(MAPPER.readTree(oidcjwksto.get().getJson()));
+
writeValueAsString(MAPPER.readTree(oidcjwksto.getValue().getJson()));
} catch (IOException e) {
LOG.error("Could not pretty-print", e);
- pretty = oidcjwksto.get().getJson();
+ pretty =
Optional.ofNullable(oidcjwksto.getValue()).map(OIDCJWKSTO::getJson).orElse(null);
}
viewModal.header(Model.of("JSON Web Key Sets"));
@@ -108,12 +109,12 @@ public class OIDC extends Panel {
protected void onComponentTag(final ComponentTag tag) {
super.onComponentTag(tag);
- if (oidcjwksto.get() == null) {
+ if (oidcjwksto.getValue() == null) {
tag.put("class", "btn btn-app disabled");
}
}
};
- view.setEnabled(oidcjwksto.get() != null);
+ view.setEnabled(oidcjwksto.getValue() != null);
container.add(view.setOutputMarkupId(true));
MetaDataRoleAuthorizationStrategy.authorize(view, ENABLE,
AMEntitlement.OIDC_JWKS_READ);
@@ -124,7 +125,7 @@ public class OIDC extends Panel {
@Override
public void onClick(final AjaxRequestTarget target) {
try {
- oidcjwksto.set(oidcJWKSRestClient.generate());
+ oidcjwksto.setValue(oidcJWKSRestClient.generate());
generate.setEnabled(false);
view.setEnabled(true);
@@ -141,12 +142,12 @@ public class OIDC extends Panel {
protected void onComponentTag(final ComponentTag tag) {
super.onComponentTag(tag);
- if (oidcjwksto.get() != null) {
+ if (oidcjwksto.getValue() != null) {
tag.put("class", "btn btn-app disabled");
}
}
};
- generate.setEnabled(oidcjwksto.get() == null);
+ generate.setEnabled(oidcjwksto.getValue() == null);
container.add(generate.setOutputMarkupId(true));
MetaDataRoleAuthorizationStrategy.authorize(generate, ENABLE,
AMEntitlement.OIDC_JWKS_GENERATE);
@@ -158,7 +159,7 @@ public class OIDC extends Panel {
public void onClick(final AjaxRequestTarget target) {
try {
oidcJWKSRestClient.delete();
- oidcjwksto.set(null);
+ oidcjwksto.setValue(null);
generate.setEnabled(true);
view.setEnabled(false);
@@ -175,12 +176,12 @@ public class OIDC extends Panel {
protected void onComponentTag(final ComponentTag tag) {
super.onComponentTag(tag);
- if (oidcjwksto.get() == null) {
+ if (oidcjwksto.getValue() == null) {
tag.put("class", "btn btn-app disabled");
}
}
};
- delete.setEnabled(oidcjwksto.get() != null);
+ delete.setEnabled(oidcjwksto.getValue() != null);
container.add(delete.setOutputMarkupId(true));
MetaDataRoleAuthorizationStrategy.authorize(delete, ENABLE,
AMEntitlement.OIDC_JWKS_DELETE);
diff --git
a/client/am/console/src/main/java/org/apache/syncope/client/console/rest/OIDCJWKSRestClient.java
b/client/am/console/src/main/java/org/apache/syncope/client/console/rest/OIDCJWKSRestClient.java
index 8743bd7110..864cfaace1 100644
---
a/client/am/console/src/main/java/org/apache/syncope/client/console/rest/OIDCJWKSRestClient.java
+++
b/client/am/console/src/main/java/org/apache/syncope/client/console/rest/OIDCJWKSRestClient.java
@@ -19,7 +19,8 @@
package org.apache.syncope.client.console.rest;
import jakarta.ws.rs.core.Response;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.common.lib.to.OIDCJWKSTO;
import org.apache.syncope.common.rest.api.service.OIDCJWKSService;
@@ -27,10 +28,10 @@ public class OIDCJWKSRestClient extends BaseRestClient {
private static final long serialVersionUID = -1392090291817187902L;
- public AtomicReference<OIDCJWKSTO> get() {
- AtomicReference<OIDCJWKSTO> result = new AtomicReference<>();
+ public Mutable<OIDCJWKSTO> get() {
+ MutableObject<OIDCJWKSTO> result = new MutableObject<>();
try {
- result.set(getService(OIDCJWKSService.class).get());
+ result.setValue(getService(OIDCJWKSService.class).get());
} catch (Exception e) {
LOG.debug("While getting OIDC JKS", e);
}
diff --git
a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
index 466b5d2c23..9ed98ba837 100644
---
a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
+++
b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/any/LinkedAccountDetailsPanel.java
@@ -23,9 +23,10 @@ import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.client.console.rest.ResourceRestClient;
import org.apache.syncope.client.lib.SyncopeClient;
@@ -159,12 +160,12 @@ public class LinkedAccountDetailsPanel extends WizardStep
{
final String resource,
final String searchTerm) {
- AtomicReference<String> resourceRemoteKey = new
AtomicReference<>(ConnIdSpecialName.NAME);
+ Mutable<String> resourceRemoteKey = new
MutableObject<>(ConnIdSpecialName.NAME);
try {
resourceRestClient.read(resource).getProvision(AnyTypeKind.USER.name()).
flatMap(provision ->
Optional.ofNullable(provision.getMapping())).
flatMap(ItemContainer::getConnObjectKeyItem).
- ifPresent(connObjectKeyItem ->
resourceRemoteKey.set(connObjectKeyItem.getExtAttrName()));
+ ifPresent(connObjectKeyItem ->
resourceRemoteKey.setValue(connObjectKeyItem.getExtAttrName()));
} catch (Exception ex) {
LOG.error("While reading mapping for resource {}", resource, ex);
}
@@ -172,17 +173,17 @@ public class LinkedAccountDetailsPanel extends WizardStep
{
ConnObjectTOQuery.Builder builder = new
ConnObjectTOQuery.Builder().size(SEARCH_SIZE);
if (StringUtils.isNotBlank(searchTerm)) {
builder.fiql(SyncopeClient.getConnObjectTOFiqlSearchConditionBuilder().
- is(resourceRemoteKey.get()).equalTo(searchTerm +
"*").query()).build();
+ is(resourceRemoteKey.getValue()).equalTo(searchTerm +
"*").query()).build();
}
Pair<String, List<ConnObject>> items =
resourceRestClient.searchConnObjects(
resource,
AnyTypeKind.USER.name(),
builder,
- new SortParam<>(resourceRemoteKey.get(), true));
+ new SortParam<>(resourceRemoteKey.getValue(), true));
connObjectKeyFieldValues = items.getRight().stream().
- map(item -> item.getAttr(resourceRemoteKey.get()).
- map(attr -> attr.getValues().getFirst()).orElse(null)).
+ map(item -> item.getAttr(resourceRemoteKey.getValue()).
+ map(attr -> attr.getValues().getFirst()).orElse(null)).
filter(Objects::nonNull).
collect(Collectors.toList());
ajaxTextFieldPanel.setChoices(connObjectKeyFieldValues);
diff --git
a/common/keymaster/client-zookeeper/src/test/java/org/apache/syncope/common/keymaster/client/zookeeper/ZookeeperTestingServer.java
b/common/keymaster/client-zookeeper/src/test/java/org/apache/syncope/common/keymaster/client/zookeeper/ZookeeperTestingServer.java
index bd7682684d..c9748120d7 100644
---
a/common/keymaster/client-zookeeper/src/test/java/org/apache/syncope/common/keymaster/client/zookeeper/ZookeeperTestingServer.java
+++
b/common/keymaster/client-zookeeper/src/test/java/org/apache/syncope/common/keymaster/client/zookeeper/ZookeeperTestingServer.java
@@ -24,9 +24,10 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import java.util.concurrent.atomic.AtomicReference;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.curator.test.InstanceSpec;
import org.apache.curator.test.TestingServer;
@@ -36,14 +37,14 @@ public final class ZookeeperTestingServer {
public static void start() throws Exception {
if (ZK_SERVER == null) {
- AtomicReference<String> username = new AtomicReference<>();
- AtomicReference<String> password = new AtomicReference<>();
+ Mutable<String> username = new MutableObject<>();
+ Mutable<String> password = new MutableObject<>();
try (InputStream propStream =
ZookeeperServiceOpsTest.class.getResourceAsStream("/test.properties")) {
Properties props = new Properties();
props.load(propStream);
- username.set(props.getProperty("keymaster.username"));
- password.set(props.getProperty("keymaster.password"));
+ username.setValue(props.getProperty("keymaster.username"));
+ password.setValue(props.getProperty("keymaster.password"));
} catch (Exception e) {
fail("Could not load /test.properties", e);
}
@@ -55,7 +56,7 @@ public final class ZookeeperTestingServer {
"org.apache.zookeeper.server.auth.DigestLoginModule",
AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
Map.of(
- "user_" + username.get(), password.get()
+ "user_" + username.getValue(), password.getValue()
))
};
diff --git
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
index 6edfdbcd35..ba8631710d 100644
---
a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
+++
b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
@@ -245,8 +245,7 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO,
GroupCR, GroupUR> {
@PreAuthorize("hasRole('" + IdRepoEntitlement.GROUP_DELETE + "')")
@Override
public ProvisioningResult<GroupTO> delete(final String key, final boolean
nullPriorityAsync) {
- GroupTO group = binder.getGroupTO(key);
- Pair<GroupTO, List<LogicActions>> before = beforeDelete(group);
+ Pair<GroupTO, List<LogicActions>> before =
beforeDelete(binder.getGroupTO(key));
Set<String> authRealms = RealmUtils.getEffective(
AuthContextUtils.getAuthorizations().get(IdRepoEntitlement.GROUP_DELETE),
@@ -267,10 +266,15 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO,
GroupCR, GroupUR> {
List<PropagationStatus> statuses = provisioningManager.delete(
before.getLeft().getKey(), nullPriorityAsync,
AuthContextUtils.getUsername(), REST_CONTEXT);
- GroupTO groupTO = new GroupTO();
- groupTO.setKey(before.getLeft().getKey());
+ GroupTO deletedTO;
+ if (groupDAO.existsById(before.getLeft().getKey())) {
+ deletedTO = binder.getGroupTO(before.getLeft().getKey());
+ } else {
+ deletedTO = new GroupTO();
+ deletedTO.setKey(before.getLeft().getKey());
+ }
- return afterDelete(groupTO, statuses, before.getRight());
+ return afterDelete(deletedTO, statuses, before.getRight());
}
protected GroupTO updateChecks(final String key) {
diff --git
a/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/utils/URIUtilsTest.java
b/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/utils/URIUtilsTest.java
index 15b1e89d9d..ce39e18732 100644
---
a/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/utils/URIUtilsTest.java
+++
b/core/persistence-api/src/test/java/org/apache/syncope/core/persistence/api/utils/URIUtilsTest.java
@@ -25,22 +25,23 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.junit.jupiter.api.Test;
public class URIUtilsTest extends AbstractTest {
@Test
public void buildForConnId() throws URISyntaxException,
MalformedURLException {
- AtomicReference<String> location = new AtomicReference<>();
- location.set("www.tirasa.net");
+ Mutable<String> location = new MutableObject<>();
+ location.setValue("www.tirasa.net");
IllegalArgumentException exception =
- assertThrows(IllegalArgumentException.class, () ->
URIUtils.buildForConnId(location.get()));
+ assertThrows(IllegalArgumentException.class, () ->
URIUtils.buildForConnId(location.getValue()));
assertEquals(exception.getClass(), IllegalArgumentException.class);
- location.set("connid:test/location");
- URI expectedURI = new URI(location.get().trim());
- assertEquals(expectedURI, URIUtils.buildForConnId(location.get()));
+ location.setValue("connid:test/location");
+ URI expectedURI = new URI(location.getValue().trim());
+ assertEquals(expectedURI,
URIUtils.buildForConnId(location.getValue()));
assertDoesNotThrow(() ->
URIUtils.buildForConnId("file:Z:\\syncope\\fit\\core-reference\\target/bundles/"));
assertDoesNotThrow(() ->
URIUtils.buildForConnId("file:/Z:\\syncope\\fit\\core-reference\\target/bundles/"));
diff --git
a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AttributableValidator.java
b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AttributableValidator.java
index 72b71e076d..92d20b6bfc 100644
---
a/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AttributableValidator.java
+++
b/core/persistence-common/src/main/java/org/apache/syncope/core/persistence/common/validation/AttributableValidator.java
@@ -19,7 +19,8 @@
package org.apache.syncope.core.persistence.common.validation;
import jakarta.validation.ConstraintValidatorContext;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.common.lib.types.EntityViolationType;
import org.apache.syncope.core.persistence.api.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
@@ -112,20 +113,18 @@ public class AttributableValidator extends
AbstractValidator<AttributableCheck,
context.disableDefaultConstraintViolation();
- AtomicReference<Boolean> isValid = new AtomicReference<>(Boolean.TRUE);
- entity.getPlainAttrs().forEach(attr -> {
- PlainSchema schema =
schemaDAO.findById(attr.getSchema()).orElse(null);
- if (schema == null) {
- isValid.getAndSet(false);
- context.buildConstraintViolationWithTemplate(
- getTemplate(EntityViolationType.InvalidSchema,
"Invalid schema " + attr.getSchema())).
-
addPropertyNode(attr.getSchema()).addConstraintViolation();
- } else {
- isValid.getAndSet(isValid.get() && isValid(attr, schema,
context));
- attr.getValues().forEach(value ->
isValid.getAndSet(isValid.get() && isValid(value, context)));
- }
- });
-
- return isValid.get();
+ Mutable<Boolean> isValid = new MutableObject<>(true);
+ entity.getPlainAttrs().forEach(attr ->
schemaDAO.findById(attr.getSchema()).ifPresentOrElse(
+ schema -> {
+ isValid.setValue(isValid.getValue() && isValid(attr,
schema, context));
+ attr.getValues().forEach(value ->
isValid.setValue(isValid.getValue() && isValid(value, context)));
+ }, () -> {
+ isValid.setValue(false);
+ context.buildConstraintViolationWithTemplate(
+ getTemplate(EntityViolationType.InvalidSchema,
"Invalid schema " + attr.getSchema())).
+
addPropertyNode(attr.getSchema()).addConstraintViolation();
+ }));
+
+ return isValid.getValue();
}
}
diff --git
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/ExternalResourceRepoExtImpl.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/ExternalResourceRepoExtImpl.java
index 1a4a600a93..184087be01 100644
---
a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/ExternalResourceRepoExtImpl.java
+++
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/repo/ExternalResourceRepoExtImpl.java
@@ -22,7 +22,8 @@ import jakarta.persistence.EntityManager;
import jakarta.persistence.TypedQuery;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.common.lib.types.IdMEntitlement;
import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
@@ -150,14 +151,14 @@ public class ExternalResourceRepoExtImpl implements
ExternalResourceRepoExt {
@Override
public void deleteMapping(final String schemaKey) {
findAll().forEach(resource -> {
- AtomicBoolean removed = new AtomicBoolean(false);
+ Mutable<Boolean> removed = new MutableObject<>(false);
- resource.getProvisions().forEach(provision -> removed.set(
- removed.get()
+ resource.getProvisions().forEach(provision -> removed.setValue(
+ removed.getValue()
|| (provision.getMapping() != null
&& provision.getMapping().getItems().removeIf(item ->
schemaKey.equals(item.getIntAttrName())))));
- if (removed.get()) {
+ if (removed.getValue()) {
entityManager.merge(resource);
}
});
diff --git
a/core/persistence-neo4j/src/main/java/org/apache/syncope/core/persistence/neo4j/dao/repo/ExternalResourceRepoExtImpl.java
b/core/persistence-neo4j/src/main/java/org/apache/syncope/core/persistence/neo4j/dao/repo/ExternalResourceRepoExtImpl.java
index dfd1f22da3..47c76c4a2d 100644
---
a/core/persistence-neo4j/src/main/java/org/apache/syncope/core/persistence/neo4j/dao/repo/ExternalResourceRepoExtImpl.java
+++
b/core/persistence-neo4j/src/main/java/org/apache/syncope/core/persistence/neo4j/dao/repo/ExternalResourceRepoExtImpl.java
@@ -21,8 +21,9 @@ package org.apache.syncope.core.persistence.neo4j.dao.repo;
import java.util.List;
import java.util.Optional;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
import javax.cache.Cache;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.common.lib.types.IdMEntitlement;
import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
@@ -275,14 +276,14 @@ public class ExternalResourceRepoExtImpl extends
AbstractDAO implements External
@Override
public void deleteMapping(final String schemaKey) {
findAll().forEach(resource -> {
- AtomicBoolean removed = new AtomicBoolean(false);
+ Mutable<Boolean> removed = new MutableObject<>(false);
- resource.getProvisions().forEach(provision -> removed.set(
- removed.get()
+ resource.getProvisions().forEach(provision -> removed.setValue(
+ removed.getValue()
|| (provision.getMapping() != null
&& provision.getMapping().getItems().removeIf(item ->
schemaKey.equals(item.getIntAttrName())))));
- if (removed.get()) {
+ if (removed.getValue()) {
((Neo4jExternalResource) resource).list2json();
ExternalResource saved = neo4jTemplate.save(resource);
((Neo4jExternalResource) saved).postSave();
diff --git
a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
index 51ff287504..0cce5d60b0 100644
---
a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
+++
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.provisioning.api;
import java.util.List;
import java.util.Optional;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.provisioning.api.pushpull.ReconFilterBuilder;
import org.identityconnectors.framework.common.objects.Attribute;
@@ -71,7 +71,7 @@ public interface Connector {
ObjectClass objectClass,
Set<Attribute> attrs,
OperationOptions options,
- AtomicReference<Boolean> propagationAttempted);
+ Mutable<Boolean> propagationAttempted);
/**
* Update user, group or any object on a connector instance.
@@ -88,7 +88,7 @@ public interface Connector {
Uid uid,
Set<Attribute> attrs,
OperationOptions options,
- AtomicReference<Boolean> propagationAttempted);
+ Mutable<Boolean> propagationAttempted);
/**
* Partial update user, group or any object on a connector instance.
@@ -105,7 +105,7 @@ public interface Connector {
Uid uid,
Set<AttributeDelta> modifications,
OperationOptions options,
- AtomicReference<Boolean> propagationAttempted);
+ Mutable<Boolean> propagationAttempted);
/**
* Delete user, group or any object on a connector instance.
@@ -119,7 +119,7 @@ public interface Connector {
ObjectClass objectClass,
Uid uid,
OperationOptions options,
- AtomicReference<Boolean> propagationAttempted);
+ Mutable<Boolean> propagationAttempted);
/**
* Fetches all remote objects (for use during full reconciliation).
diff --git
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
index 9444d6fc4d..ae678a0dd1 100644
---
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
+++
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java
@@ -25,7 +25,7 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
import org.apache.syncope.common.lib.types.ConnectorCapability;
import org.apache.syncope.core.persistence.api.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
@@ -162,12 +162,12 @@ public class ConnectorFacadeProxy implements Connector {
final ObjectClass objectClass,
final Set<Attribute> attrs,
final OperationOptions options,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
Uid result = null;
if
(connInstance.getCapabilities().contains(ConnectorCapability.CREATE)) {
- propagationAttempted.set(true);
+ propagationAttempted.setValue(true);
Future<Uid> future = asyncFacade.create(connector, objectClass,
attrs, options);
try {
@@ -197,12 +197,12 @@ public class ConnectorFacadeProxy implements Connector {
final Uid uid,
final Set<Attribute> attrs,
final OperationOptions options,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
Uid result = null;
if
(connInstance.getCapabilities().contains(ConnectorCapability.UPDATE)) {
- propagationAttempted.set(true);
+ propagationAttempted.setValue(true);
Future<Uid> future = asyncFacade.update(connector, objectClass,
uid, attrs, options);
@@ -234,12 +234,12 @@ public class ConnectorFacadeProxy implements Connector {
final Uid uid,
final Set<AttributeDelta> modifications,
final OperationOptions options,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
Set<AttributeDelta> result = null;
if
(connInstance.getCapabilities().contains(ConnectorCapability.UPDATE_DELTA)) {
- propagationAttempted.set(true);
+ propagationAttempted.setValue(true);
Future<Set<AttributeDelta>> future =
asyncFacade.updateDelta(connector, objectClass, uid,
modifications, options);
@@ -271,10 +271,10 @@ public class ConnectorFacadeProxy implements Connector {
final ObjectClass objectClass,
final Uid uid,
final OperationOptions options,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
if
(connInstance.getCapabilities().contains(ConnectorCapability.DELETE)) {
- propagationAttempted.set(true);
+ propagationAttempted.setValue(true);
Future<Uid> future = asyncFacade.delete(connector, objectClass,
uid, options);
diff --git
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultMappingManager.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultMappingManager.java
index bde85abe23..001ecce60c 100644
---
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultMappingManager.java
+++
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultMappingManager.java
@@ -27,13 +27,14 @@ import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import javax.cache.Cache;
import org.apache.commons.jexl3.JexlContext;
import org.apache.commons.jexl3.MapContext;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.Attr;
@@ -329,7 +330,7 @@ public class DefaultMappingManager implements
MappingManager {
any, provision, any.getPlainAttrs());
Set<Attribute> attributes = new HashSet<>();
- AtomicReference<String> connObjectKeyValue = new AtomicReference<>();
+ Mutable<String> connObjectKeyValue = new MutableObject<>();
MappingUtils.getPropagationItems(provision.getMapping().getItems().stream()).forEach(mapItem
-> {
LOG.debug("Processing expression '{}'", mapItem.getIntAttrName());
@@ -345,25 +346,25 @@ public class DefaultMappingManager implements
MappingManager {
AccountGetter.DEFAULT,
AccountGetter.DEFAULT,
PlainAttrGetter.DEFAULT),
- attributes).ifPresent(connObjectKeyValue::set);
+ attributes).ifPresent(connObjectKeyValue::setValue);
} catch (Exception e) {
LOG.error("Expression '{}' processing failed",
mapItem.getIntAttrName(), e);
}
});
-
MappingUtils.getConnObjectKeyItem(provision).ifPresent(connObjectKeyItem -> {
- Attribute connObjectKeyAttr =
AttributeUtil.find(connObjectKeyItem.getExtAttrName(), attributes);
+ MappingUtils.getConnObjectKeyItem(provision).ifPresent(item -> {
+ Attribute connObjectKeyAttr =
AttributeUtil.find(item.getExtAttrName(), attributes);
if (connObjectKeyAttr != null) {
attributes.remove(connObjectKeyAttr);
-
attributes.add(AttributeBuilder.build(connObjectKeyItem.getExtAttrName(),
connObjectKeyValue.get()));
+ attributes.add(AttributeBuilder.build(item.getExtAttrName(),
connObjectKeyValue.getValue()));
}
- Name name = evaluateNAME(any, provision, connObjectKeyValue.get());
+ Name name = evaluateNAME(any, provision,
connObjectKeyValue.getValue());
attributes.add(name);
- Optional.ofNullable(connObjectKeyValue.get()).
+ Optional.ofNullable(connObjectKeyValue.getValue()).
filter(cokv -> connObjectKeyAttr == null &&
!cokv.equals(name.getNameValue())).
- ifPresent(cokv ->
attributes.add(AttributeBuilder.build(connObjectKeyItem.getExtAttrName(),
cokv)));
+ ifPresent(cokv ->
attributes.add(AttributeBuilder.build(item.getExtAttrName(), cokv)));
});
Optional.ofNullable(enable).ifPresent(e ->
attributes.add(AttributeBuilder.buildEnabled(e)));
@@ -373,7 +374,7 @@ public class DefaultMappingManager implements
MappingManager {
ifPresent(attributes::remove);
}
- return Pair.of(connObjectKeyValue.get(), attributes);
+ return Pair.of(connObjectKeyValue.getValue(), attributes);
}
@Transactional(readOnly = true)
@@ -452,7 +453,7 @@ public class DefaultMappingManager implements
MappingManager {
LOG.debug("Preparing resource attributes for {} with orgUnit {}",
realm, orgUnit);
Set<Attribute> attributes = new HashSet<>();
- AtomicReference<String> connObjectKeyValue = new AtomicReference<>();
+ Mutable<String> connObjectKeyValue = new MutableObject<>();
MappingUtils.getPropagationItems(orgUnit.getItems().stream()).forEach(orgUnitItem
-> {
LOG.debug("Processing expression '{}'",
orgUnitItem.getIntAttrName());
@@ -460,7 +461,7 @@ public class DefaultMappingManager implements
MappingManager {
String value = getIntValue(realm, orgUnitItem);
if (orgUnitItem.isConnObjectKey()) {
- connObjectKeyValue.set(value);
+ connObjectKeyValue.setValue(value);
}
Optional.ofNullable(AttributeUtil.find(orgUnitItem.getExtAttrName(),
attributes)).ifPresentOrElse(
@@ -487,12 +488,12 @@ public class DefaultMappingManager implements
MappingManager {
orgUnit.getConnObjectKeyItem().ifPresent(item -> {
Optional.ofNullable(AttributeUtil.find(item.getExtAttrName(),
attributes)).ifPresent(attr -> {
attributes.remove(attr);
- attributes.add(AttributeBuilder.build(item.getExtAttrName(),
connObjectKeyValue.get()));
+ attributes.add(AttributeBuilder.build(item.getExtAttrName(),
connObjectKeyValue.getValue()));
});
- attributes.add(evaluateNAME(realm, orgUnit,
connObjectKeyValue.get()));
+ attributes.add(evaluateNAME(realm, orgUnit,
connObjectKeyValue.getValue()));
});
- return Pair.of(connObjectKeyValue.get(), attributes);
+ return Pair.of(connObjectKeyValue.getValue(), attributes);
}
protected Optional<String> decodePassword(final Account account) {
@@ -991,7 +992,7 @@ public class DefaultMappingManager implements
MappingManager {
GroupableRelatableTO groupableTO;
Group group;
if (anyTO instanceof final GroupableRelatableTO
groupableRelatableTO
- && intAttrName.getMembershipOfGroup() != null) {
+ && intAttrName.getMembershipOfGroup() != null) {
groupableTO = groupableRelatableTO;
group =
groupDAO.findByName(intAttrName.getMembershipOfGroup()).orElse(null);
} else {
diff --git
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/JEXLItemTransformerImpl.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/JEXLItemTransformerImpl.java
index 04ca6712e5..546a4f1615 100644
---
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/JEXLItemTransformerImpl.java
+++
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/JEXLItemTransformerImpl.java
@@ -21,10 +21,11 @@ package org.apache.syncope.core.provisioning.java.data;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.jexl3.JexlContext;
import org.apache.commons.jexl3.MapContext;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.common.lib.to.EntityTO;
@@ -150,16 +151,16 @@ public class JEXLItemTransformerImpl implements
JEXLItemTransformer {
return JEXLItemTransformer.super.beforePropagation(item, any,
schemaType, values);
}
- AtomicReference<AttrSchemaType> tType = new AtomicReference<>();
+ Mutable<AttrSchemaType> tType = new MutableObject<>();
if (values.isEmpty()) {
PlainAttrValue value = new PlainAttrValue();
- tType.set(beforePropagation(any, schemaType, value));
+ tType.setValue(beforePropagation(any, schemaType, value));
values.add(value);
} else {
- values.forEach(value -> tType.set(beforePropagation(any,
schemaType, value)));
+ values.forEach(value -> tType.setValue(beforePropagation(any,
schemaType, value)));
}
- return Pair.of(tType.get(), values);
+ return Pair.of(tType.getValue(), values);
}
@Override
diff --git
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
index 840c424313..39489825a5 100644
---
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
+++
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SchemaDataBinderImpl.java
@@ -19,8 +19,9 @@
package org.apache.syncope.core.provisioning.java.data;
import java.util.Optional;
-import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.common.lib.SyncopeClientCompositeException;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.DerSchemaTO;
@@ -138,7 +139,7 @@ public class SchemaDataBinderImpl implements
SchemaDataBinder {
PlainSchema saved = plainSchemaDAO.save(schema);
- AtomicReference<AnyTypeClass> atc = new AtomicReference<>();
+ Mutable<AnyTypeClass> atc = new MutableObject<>();
if (schemaTO.getAnyTypeClass() != null
&& (saved.getAnyTypeClass() == null
||
!schemaTO.getAnyTypeClass().equals(saved.getAnyTypeClass().getKey()))) {
@@ -148,7 +149,7 @@ public class SchemaDataBinderImpl implements
SchemaDataBinder {
anyTypeClass.add(saved);
saved.setAnyTypeClass(anyTypeClass);
- atc.set(anyTypeClass);
+ atc.setValue(anyTypeClass);
},
() -> LOG.debug("Invalid {}{}, ignoring...",
AnyTypeClass.class.getSimpleName(),
schemaTO.getAnyTypeClass()));
@@ -156,11 +157,11 @@ public class SchemaDataBinderImpl implements
SchemaDataBinder {
saved.getAnyTypeClass().getPlainSchemas().remove(saved);
saved.setAnyTypeClass(null);
- atc.set(saved.getAnyTypeClass());
+ atc.setValue(saved.getAnyTypeClass());
}
PlainSchema filled = plainSchemaDAO.save(saved);
- Optional.ofNullable(atc.get()).ifPresent(anyTypeClassDAO::save);
+ Optional.ofNullable(atc.getValue()).ifPresent(anyTypeClassDAO::save);
return filled;
}
@@ -252,7 +253,7 @@ public class SchemaDataBinderImpl implements
SchemaDataBinder {
DerSchema saved = derSchemaDAO.save(schema);
- AtomicReference<AnyTypeClass> atc = new AtomicReference<>();
+ Mutable<AnyTypeClass> atc = new MutableObject<>();
if (schemaTO.getAnyTypeClass() != null
&& (saved.getAnyTypeClass() == null
||
!schemaTO.getAnyTypeClass().equals(saved.getAnyTypeClass().getKey()))) {
@@ -262,7 +263,7 @@ public class SchemaDataBinderImpl implements
SchemaDataBinder {
anyTypeClass.add(saved);
saved.setAnyTypeClass(anyTypeClass);
- atc.set(anyTypeClass);
+ atc.setValue(anyTypeClass);
},
() -> LOG.debug("Invalid {}{}, ignoring...",
AnyTypeClass.class.getSimpleName(),
schemaTO.getAnyTypeClass()));
@@ -270,11 +271,11 @@ public class SchemaDataBinderImpl implements
SchemaDataBinder {
saved.getAnyTypeClass().getDerSchemas().remove(saved);
saved.setAnyTypeClass(null);
- atc.set(saved.getAnyTypeClass());
+ atc.setValue(saved.getAnyTypeClass());
}
DerSchema filled = derSchemaDAO.save(saved);
- Optional.ofNullable(atc.get()).ifPresent(anyTypeClassDAO::save);
+ Optional.ofNullable(atc.getValue()).ifPresent(anyTypeClassDAO::save);
return filled;
}
@@ -332,7 +333,7 @@ public class SchemaDataBinderImpl implements
SchemaDataBinder {
VirSchema saved = virSchemaDAO.save(schema);
- AtomicReference<AnyTypeClass> atc = new AtomicReference<>();
+ Mutable<AnyTypeClass> atc = new MutableObject<>();
if (schemaTO.getAnyTypeClass() != null
&& (saved.getAnyTypeClass() == null
||
!schemaTO.getAnyTypeClass().equals(saved.getAnyTypeClass().getKey()))) {
@@ -342,7 +343,7 @@ public class SchemaDataBinderImpl implements
SchemaDataBinder {
anyTypeClass.add(saved);
saved.setAnyTypeClass(anyTypeClass);
- atc.set(anyTypeClass);
+ atc.setValue(anyTypeClass);
},
() -> LOG.debug("Invalid {}{}, ignoring...",
AnyTypeClass.class.getSimpleName(),
schemaTO.getAnyTypeClass()));
@@ -350,11 +351,11 @@ public class SchemaDataBinderImpl implements
SchemaDataBinder {
saved.getAnyTypeClass().getVirSchemas().remove(saved);
saved.setAnyTypeClass(null);
- atc.set(saved.getAnyTypeClass());
+ atc.setValue(saved.getAnyTypeClass());
}
VirSchema filled = virSchemaDAO.save(saved);
- Optional.ofNullable(atc.get()).ifPresent(anyTypeClassDAO::save);
+ Optional.ofNullable(atc.getValue()).ifPresent(anyTypeClassDAO::save);
return filled;
}
diff --git
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/MacroJobDelegate.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/MacroJobDelegate.java
index 475e9f86e3..a2fd5aa0df 100644
---
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/MacroJobDelegate.java
+++
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/MacroJobDelegate.java
@@ -32,13 +32,14 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import org.apache.commons.jexl3.JexlContext;
import org.apache.commons.jexl3.MapContext;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.command.CommandArgs;
import org.apache.syncope.common.lib.form.FormProperty;
@@ -155,7 +156,7 @@ public class MacroJobDelegate extends
AbstractSchedTaskJobDelegate<MacroTask> {
: List.of(value.split(";"));
if (!actions.map(a ->
a.getDropdownValues(fpd.getName()).keySet()).
- orElseGet(Set::of).containsAll(values)) {
+ orElseGet(Set::of).containsAll(values)) {
throw new JobExecutionException("Not allowed for "
+ fpd.getName() + ": " + values);
}
@@ -188,12 +189,12 @@ public class MacroJobDelegate extends
AbstractSchedTaskJobDelegate<MacroTask> {
final boolean dryRun)
throws JobExecutionException {
- Future<AtomicReference<Pair<String, Throwable>>> future =
taskExecutor.submit(
+ Future<Mutable<Pair<String, Throwable>>> future = taskExecutor.submit(
new DelegatingSecurityContextCallable<>(() -> {
- AtomicReference<Pair<String, Throwable>> error = new
AtomicReference<>();
+ Mutable<Pair<String, Throwable>> error = new
MutableObject<>();
- for (int i = 0; i < commands.size() && error.get() ==
null; i++) {
+ for (int i = 0; i < commands.size() && error.getValue() ==
null; i++) {
Pair<Command<CommandArgs>, CommandArgs> command =
commands.get(i);
try {
@@ -217,7 +218,7 @@ public class MacroJobDelegate extends
AbstractSchedTaskJobDelegate<MacroTask> {
LOG.error("While running {} with args {},
continuing on error",
command.getLeft().getClass().getName(), command.getRight(), t);
} else {
-
error.set(Pair.of(AopUtils.getTargetClass(command.getLeft()).getName(), t));
+
error.setValue(Pair.of(AopUtils.getTargetClass(command.getLeft()).getName(),
t));
}
}
output.append("\n\n");
@@ -227,9 +228,10 @@ public class MacroJobDelegate extends
AbstractSchedTaskJobDelegate<MacroTask> {
}));
try {
- AtomicReference<Pair<String, Throwable>> error = future.get();
- if (error.get() != null) {
- throw new JobExecutionException("While running " +
error.get().getLeft(), error.get().getRight());
+ Mutable<Pair<String, Throwable>> error = future.get();
+ if (error.getValue() != null) {
+ throw new JobExecutionException("While running "
+ + error.getValue().getLeft(),
error.getValue().getRight());
}
} catch (ExecutionException | InterruptedException e) {
throw new JobExecutionException("While waiting for macro commands
completion", e);
diff --git
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
index b3cff0c3b4..b26a0af4a5 100644
---
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
+++
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
@@ -28,9 +28,10 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.common.lib.to.ExecTO;
import org.apache.syncope.common.lib.to.Item;
import org.apache.syncope.common.lib.to.OrgUnit;
@@ -218,7 +219,7 @@ public abstract class AbstractPropagationTaskExecutor
implements PropagationTask
protected Uid doCreate(
final PropagationTaskInfo taskInfo,
final Connector connector,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
Set<Attribute> attrs = taskInfo.getPropagationData().getAttributes();
@@ -257,7 +258,7 @@ public abstract class AbstractPropagationTaskExecutor
implements PropagationTask
final PropagationTaskInfo taskInfo,
final Connector connector,
final ConnectorObject beforeObj,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
Set<Attribute> attrs = taskInfo.getPropagationData().getAttributes();
@@ -321,7 +322,7 @@ public abstract class AbstractPropagationTaskExecutor
implements PropagationTask
final PropagationTaskInfo taskInfo,
final Set<AttributeDelta> modifications,
final Connector connector,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
Uid uid = new Uid(taskInfo.getConnObjectKey());
@@ -346,7 +347,7 @@ public abstract class AbstractPropagationTaskExecutor
implements PropagationTask
final boolean fetchRemoteObj,
final ConnectorObject beforeObj,
final Connector connector,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
PropagationData propagationData = taskInfo.getPropagationData();
@@ -370,7 +371,7 @@ public abstract class AbstractPropagationTaskExecutor
implements PropagationTask
final boolean fetchRemoteObj,
final ConnectorObject beforeObj,
final Connector connector,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
Uid result;
@@ -547,7 +548,7 @@ public abstract class AbstractPropagationTaskExecutor
implements PropagationTask
String failureReason = null;
// Flag to state whether any propagation has been attempted
- AtomicReference<Boolean> propagationAttempted = new
AtomicReference<>(false);
+ Mutable<Boolean> propagationAttempted = new MutableObject<>(false);
boolean fetchRemoteObj = isFetchRemoteObj(taskInfo);
@@ -592,7 +593,7 @@ public abstract class AbstractPropagationTaskExecutor
implements PropagationTask
default:
}
- exec.setStatus(propagationAttempted.get()
+ exec.setStatus(propagationAttempted.getValue()
? ExecStatus.SUCCESS.name()
: ExecStatus.NOT_ATTEMPTED.name());
@@ -604,7 +605,7 @@ public abstract class AbstractPropagationTaskExecutor
implements PropagationTask
exec.setStatus(ExecStatus.FAILURE.name());
- propagationAttempted.set(true);
+ propagationAttempted.setValue(true);
LOG.error("Exception during provision on resource {}",
taskInfo.getResource().getKey(), e);
diff --git
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/CSVStreamConnector.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/CSVStreamConnector.java
index 7fec41ffb7..cfe628e116 100644
---
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/CSVStreamConnector.java
+++
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/stream/CSVStreamConnector.java
@@ -31,9 +31,9 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.mutable.Mutable;
import org.apache.syncope.common.rest.api.beans.CSVPullSpec;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.provisioning.api.Connector;
@@ -149,7 +149,7 @@ public class CSVStreamConnector implements Connector,
AutoCloseable {
final ObjectClass objectClass,
final Set<Attribute> attrs,
final OperationOptions options,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
synchronized (schemaBuilder) {
if (schemaBuilder.size() == 0) {
@@ -190,7 +190,7 @@ public class CSVStreamConnector implements Connector,
AutoCloseable {
} catch (IOException e) {
throw new ConnectorException("Could not write object " + row, e);
}
- propagationAttempted.set(Boolean.TRUE);
+ propagationAttempted.setValue(true);
return null;
}
@@ -200,7 +200,7 @@ public class CSVStreamConnector implements Connector,
AutoCloseable {
final Uid uid,
final Set<Attribute> attrs,
final OperationOptions options,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
return null;
}
@@ -211,7 +211,7 @@ public class CSVStreamConnector implements Connector,
AutoCloseable {
final Uid uid,
final Set<AttributeDelta> modifications,
final OperationOptions options,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
return Set.of();
}
@@ -221,7 +221,7 @@ public class CSVStreamConnector implements Connector,
AutoCloseable {
final ObjectClass objectClass,
final Uid uid,
final OperationOptions options,
- final AtomicReference<Boolean> propagationAttempted) {
+ final Mutable<Boolean> propagationAttempted) {
// nothing to do
}
diff --git
a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/job/SyncopeTaskSchedulerTest.java
b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/job/SyncopeTaskSchedulerTest.java
index 50969dd3b5..2882d5527c 100644
---
a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/job/SyncopeTaskSchedulerTest.java
+++
b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/job/SyncopeTaskSchedulerTest.java
@@ -27,7 +27,8 @@ import static org.mockito.Mockito.when;
import java.time.Instant;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.core.persistence.api.dao.JobStatusDAO;
import org.apache.syncope.core.provisioning.api.job.JobExecutionContext;
import org.apache.syncope.core.provisioning.api.job.JobExecutionException;
@@ -42,13 +43,13 @@ import
org.springframework.transaction.annotation.Transactional;
@Transactional
public class SyncopeTaskSchedulerTest extends AbstractTest {
- private static final AtomicInteger VALUE = new AtomicInteger();
+ private static final Mutable<Integer> VALUE = new MutableObject<>(0);
private static class TestJob extends Job {
@Override
protected void execute(final JobExecutionContext context) throws
JobExecutionException {
- VALUE.set(1);
+ VALUE.setValue(1);
}
}
@@ -76,6 +77,6 @@ public class SyncopeTaskSchedulerTest extends AbstractTest {
assertTrue(scheduler.getNextTrigger(AuthContextUtils.getDomain(),
job.getContext().getJobName()).isPresent());
- await().atMost(10, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> VALUE.get() == 1);
+ await().atMost(10, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> VALUE.getValue() == 1);
}
}
diff --git
a/core/spring/src/main/java/org/apache/syncope/core/spring/security/UsernamePasswordAuthenticationProvider.java
b/core/spring/src/main/java/org/apache/syncope/core/spring/security/UsernamePasswordAuthenticationProvider.java
index dd9e119eac..99c8e1ea13 100644
---
a/core/spring/src/main/java/org/apache/syncope/core/spring/security/UsernamePasswordAuthenticationProvider.java
+++
b/core/spring/src/main/java/org/apache/syncope/core/spring/security/UsernamePasswordAuthenticationProvider.java
@@ -19,8 +19,9 @@
package org.apache.syncope.core.spring.security;
import java.util.Optional;
-import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.syncope.common.keymaster.client.api.DomainOps;
import org.apache.syncope.common.keymaster.client.api.KeymasterException;
@@ -90,16 +91,16 @@ public class UsernamePasswordAuthenticationProvider
implements AuthenticationPro
}
}
- AtomicReference<String> username = new AtomicReference<>();
+ Mutable<String> username = new MutableObject<>();
Boolean authenticated;
- AtomicReference<String> delegationKey = new AtomicReference<>();
+ Mutable<String> delegationKey = new MutableObject<>();
if
(securityProperties.getAnonymousUser().equals(authentication.getName())) {
- username.set(securityProperties.getAnonymousUser());
+ username.setValue(securityProperties.getAnonymousUser());
credentialChecker.checkIsDefaultAnonymousKeyInUse();
authenticated =
authentication.getCredentials().toString().equals(securityProperties.getAnonymousKey());
} else if
(securityProperties.getAdminUser().equals(authentication.getName())) {
- username.set(securityProperties.getAdminUser());
+ username.setValue(securityProperties.getAdminUser());
if (SyncopeConstants.MASTER_DOMAIN.equals(domainKey)) {
credentialChecker.checkIsDefaultAdminPasswordInUse();
authenticated = encryptorManager.getInstance().verify(
@@ -121,20 +122,21 @@ public class UsernamePasswordAuthenticationProvider
implements AuthenticationPro
() -> dataAccessor.authenticate(domainKey,
authentication));
authenticated = authResult.getMiddle();
if (authResult.getLeft() != null && authResult.getMiddle() !=
null) {
- username.set(authResult.getLeft().getUsername());
+ username.setValue(authResult.getLeft().getUsername());
if (!authenticated) {
AuthContextUtils.runAsAdmin(domainKey, () ->
provisioningManager.internalSuspend(
authResult.getLeft().getKey(),
securityProperties.getAdminUser(), "Failed authentication"));
}
}
- delegationKey.set(authResult.getRight());
+ delegationKey.setValue(authResult.getRight());
}
- if (username.get() == null) {
- username.set(authentication.getPrincipal().toString());
+ if (username.getValue() == null) {
+ username.setValue(authentication.getPrincipal().toString());
}
- return finalizeAuthentication(authenticated, domainKey,
username.get(), delegationKey.get(), authentication);
+ return finalizeAuthentication(
+ authenticated, domainKey, username.getValue(),
delegationKey.getValue(), authentication);
}
protected Authentication finalizeAuthentication(
diff --git
a/core/starter/src/main/java/org/apache/syncope/core/starter/actuate/DomainsHealthIndicator.java
b/core/starter/src/main/java/org/apache/syncope/core/starter/actuate/DomainsHealthIndicator.java
index ff3143da20..9742c96250 100644
---
a/core/starter/src/main/java/org/apache/syncope/core/starter/actuate/DomainsHealthIndicator.java
+++
b/core/starter/src/main/java/org/apache/syncope/core/starter/actuate/DomainsHealthIndicator.java
@@ -18,7 +18,8 @@
*/
package org.apache.syncope.core.starter.actuate;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.core.persistence.api.DomainHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,15 +41,15 @@ public class DomainsHealthIndicator implements
HealthIndicator {
public Health health() {
Health.Builder builder = new Health.Builder();
- AtomicReference<Boolean> anyDown = new
AtomicReference<>(Boolean.FALSE);
+ Mutable<Boolean> anyDown = new MutableObject<>(false);
domainHolder.getHealthInfo().forEach((domain, status) -> {
builder.withDetail(domain, status ? Status.UP : Status.DOWN);
if (!status) {
- anyDown.set(true);
+ anyDown.setValue(true);
}
});
- builder.status(anyDown.get() ? Status.DOWN : Status.UP);
+ builder.status(anyDown.getValue() ? Status.DOWN : Status.UP);
return builder.build();
}
diff --git
a/core/starter/src/main/java/org/apache/syncope/core/starter/actuate/ExternalResourcesHealthIndicator.java
b/core/starter/src/main/java/org/apache/syncope/core/starter/actuate/ExternalResourcesHealthIndicator.java
index 17c58feb96..91b8eea099 100644
---
a/core/starter/src/main/java/org/apache/syncope/core/starter/actuate/ExternalResourcesHealthIndicator.java
+++
b/core/starter/src/main/java/org/apache/syncope/core/starter/actuate/ExternalResourcesHealthIndicator.java
@@ -18,8 +18,9 @@
*/
package org.apache.syncope.core.starter.actuate;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Stream;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.common.keymaster.client.api.DomainOps;
import org.apache.syncope.common.keymaster.client.api.model.Domain;
import org.apache.syncope.common.lib.SyncopeConstants;
@@ -61,7 +62,7 @@ public class ExternalResourcesHealthIndicator implements
HealthIndicator {
public Health health() {
Health.Builder builder = new Health.Builder();
- AtomicReference<Boolean> anyDown = new
AtomicReference<>(Boolean.FALSE);
+ Mutable<Boolean> anyDown = new MutableObject<>(false);
Stream.concat(Stream.of(SyncopeConstants.MASTER_DOMAIN),
domainOps.list().stream().map(Domain::getKey)).
forEach(domain -> AuthContextUtils.runAsAdmin(domain, () -> {
@@ -83,12 +84,12 @@ public class ExternalResourcesHealthIndicator implements
HealthIndicator {
builder.withDetail(domain + "#" + resource.getKey(), status);
if (status != Status.UP) {
- anyDown.set(true);
+ anyDown.setValue(true);
}
});
}));
- builder.status(anyDown.get() ? Status.DOWN : Status.UP);
+ builder.status(anyDown.getValue() ? Status.DOWN : Status.UP);
return builder.build();
}
diff --git
a/ext/openfga/client-openfga/src/main/java/org/apache/syncope/ext/openfga/client/OpenFGAHealthIndicator.java
b/ext/openfga/client-openfga/src/main/java/org/apache/syncope/ext/openfga/client/OpenFGAHealthIndicator.java
index cb768cd4e1..2f2374897d 100644
---
a/ext/openfga/client-openfga/src/main/java/org/apache/syncope/ext/openfga/client/OpenFGAHealthIndicator.java
+++
b/ext/openfga/client-openfga/src/main/java/org/apache/syncope/ext/openfga/client/OpenFGAHealthIndicator.java
@@ -19,7 +19,8 @@
package org.apache.syncope.ext.openfga.client;
import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.core.persistence.api.DomainHolder;
import org.apache.syncope.ext.openfga.client.model.ListStoresResponse;
import org.springframework.boot.actuate.health.Health;
@@ -45,7 +46,7 @@ public class OpenFGAHealthIndicator implements
HealthIndicator {
Health.Builder builder = new Health.Builder();
builder.withDetail("baseUri", clientFactory.getBaseUri());
- AtomicReference<Boolean> anyDown = new
AtomicReference<>(Boolean.FALSE);
+ Mutable<Boolean> anyDown = new MutableObject<>(Boolean.FALSE);
domainHolder.getDomains().keySet().forEach(domain -> {
try {
@@ -57,15 +58,15 @@ public class OpenFGAHealthIndicator implements
HealthIndicator {
"status", Status.UP.getCode()));
} else {
builder.withDetail(domain, Status.DOWN);
- anyDown.set(true);
+ anyDown.setValue(true);
}
} catch (Exception e) {
builder.withDetail(domain, Status.DOWN).withException(e);
- anyDown.set(true);
+ anyDown.setValue(true);
}
});
- builder.status(anyDown.get() ? Status.DOWN : Status.UP);
+ builder.status(anyDown.getValue() ? Status.DOWN : Status.UP);
return builder.build();
}
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
index 3e0c89b1fd..edfbfaec5a 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
@@ -52,9 +52,10 @@ import java.util.Optional;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
import javax.sql.DataSource;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.syncope.client.lib.SyncopeAnonymousClient;
@@ -901,17 +902,17 @@ public abstract class AbstractITCase {
final Class<T> requiredType,
final Object... args) {
- AtomicReference<T> object = new AtomicReference<>();
+ Mutable<T> object = new MutableObject<>();
await().atMost(maxWaitSeconds, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> {
try {
- object.set(jdbcTemplate.queryForObject(sql, requiredType,
args));
- return object.get() != null;
+ object.setValue(jdbcTemplate.queryForObject(sql, requiredType,
args));
+ return object.getValue() != null;
} catch (Exception e) {
return false;
}
});
- return object.get();
+ return object.getValue();
}
protected static <T> List<T> queryForList(
@@ -921,17 +922,17 @@ public abstract class AbstractITCase {
final Class<T> requiredType,
final Object... args) {
- AtomicReference<List<T>> object = new AtomicReference<>();
+ Mutable<List<T>> object = new MutableObject<>();
await().atMost(maxWaitSeconds, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> {
try {
- object.set(jdbcTemplate.queryForList(sql, requiredType, args));
- return object.get() != null;
+ object.setValue(jdbcTemplate.queryForList(sql, requiredType,
args));
+ return object.getValue() != null;
} catch (Exception e) {
return false;
}
});
- return object.get();
+ return object.getValue();
}
protected static OIDCRPClientAppTO buildOIDCRP() {
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractNotificationTaskITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractNotificationTaskITCase.java
index b12d2c92f2..f9fd733b8d 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractNotificationTaskITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractNotificationTaskITCase.java
@@ -29,7 +29,8 @@ import jakarta.mail.Store;
import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.junit.jupiter.api.BeforeAll;
public abstract class AbstractNotificationTaskITCase extends
AbstractTaskITCase {
@@ -79,11 +80,11 @@ public abstract class AbstractNotificationTaskITCase
extends AbstractTaskITCase
final String mailAddress,
final int maxWaitSeconds) throws Exception {
- AtomicReference<Boolean> read = new AtomicReference<>(false);
+ Mutable<Boolean> read = new MutableObject<>(false);
await().atMost(maxWaitSeconds, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> {
try {
- read.set(pop3(sender, subject, mailAddress));
- return read.get();
+ read.setValue(pop3(sender, subject, mailAddress));
+ return read.getValue();
} catch (Exception e) {
return false;
}
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
index 3569062c52..18d28bc857 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java
@@ -29,7 +29,8 @@ import java.util.Optional;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.request.ResourceDR;
@@ -81,22 +82,22 @@ public abstract class AbstractTaskITCase extends
AbstractITCase {
final int maxWaitSeconds,
final boolean dryRun) {
- AtomicReference<TaskTO> taskTO = new
AtomicReference<>(taskService.read(type, taskKey, true));
- int preSyncSize = taskTO.get().getExecutions().size();
+ Mutable<TaskTO> taskTO = new MutableObject<>(taskService.read(type,
taskKey, true));
+ int preSyncSize = taskTO.getValue().getExecutions().size();
ExecTO execution = taskService.execute(new
ExecSpecs.Builder().key(taskKey).dryRun(dryRun).build());
Optional.ofNullable(initialStatus).ifPresent(status ->
assertEquals(status, execution.getStatus()));
assertNotNull(execution.getExecutor());
await().atMost(maxWaitSeconds, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> {
try {
- taskTO.set(taskService.read(type, taskKey, true));
- return preSyncSize < taskTO.get().getExecutions().size();
+ taskTO.setValue(taskService.read(type, taskKey, true));
+ return preSyncSize < taskTO.getValue().getExecutions().size();
} catch (Exception e) {
return false;
}
});
- return
taskTO.get().getExecutions().stream().max(Comparator.comparing(ExecTO::getStart)).orElseThrow();
+ return
taskTO.getValue().getExecutions().stream().max(Comparator.comparing(ExecTO::getStart)).orElseThrow();
}
public static ExecTO execSchedTask(
@@ -154,20 +155,20 @@ public abstract class AbstractTaskITCase extends
AbstractITCase {
}
protected NotificationTaskTO findNotificationTask(final String
notification, final int maxWaitSeconds) {
- AtomicReference<NotificationTaskTO> notificationTask = new
AtomicReference<>();
+ Mutable<NotificationTaskTO> notificationTask = new MutableObject<>();
await().atMost(maxWaitSeconds, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> {
try {
PagedResult<NotificationTaskTO> tasks = TASK_SERVICE.search(
new
TaskQuery.Builder(TaskType.NOTIFICATION).notification(notification).build());
if (!tasks.getResult().isEmpty()) {
- notificationTask.set(tasks.getResult().getFirst());
+ notificationTask.setValue(tasks.getResult().getFirst());
}
} catch (Exception e) {
// ignore
}
- return notificationTask.get() != null;
+ return notificationTask.getValue() != null;
});
- return notificationTask.get();
+ return notificationTask.getValue();
}
}
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BatchITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BatchITCase.java
index 7e732de59b..b7527c48c1 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BatchITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/BatchITCase.java
@@ -38,7 +38,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.cxf.jaxrs.client.Client;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.syncope.client.lib.batch.BatchRequest;
@@ -146,7 +147,7 @@ public class BatchITCase extends AbstractITCase {
assertNotNull(resItems.getFirst().getHeaders().get(RESTHeaders.DOMAIN));
assertNotNull(resItems.getFirst().getHeaders().get(RESTHeaders.RESOURCE_KEY));
assertEquals(RESTHeaders.APPLICATION_YAML, resItems.getFirst().
- getHeaders().get(HttpHeaders.CONTENT_TYPE).getFirst());
+ getHeaders().get(HttpHeaders.CONTENT_TYPE).getFirst());
ProvisioningResult<UserTO> user = YAML_MAPPER.readValue(
resItems.get(0).getContent(), new TypeReference<>() {
});
@@ -229,16 +230,16 @@ public class BatchITCase extends AbstractITCase {
header(HttpHeaders.AUTHORIZATION, "Bearer " +
ADMIN_CLIENT.getJWT()).
type(RESTHeaders.multipartMixedWith(boundary.substring(2)));
- AtomicReference<Response> holder = new AtomicReference<>();
+ Mutable<Response> holder = new MutableObject<>();
await().atMost(MAX_WAIT_SECONDS, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> {
try {
- holder.set(client.get());
- return holder.get().getStatus() !=
Response.Status.ACCEPTED.getStatusCode();
+ holder.setValue(client.get());
+ return holder.getValue().getStatus() !=
Response.Status.ACCEPTED.getStatusCode();
} catch (Exception e) {
return false;
}
});
- response = holder.get();
+ response = holder.getValue();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
assertTrue(response.getMediaType().toString().
startsWith(RESTHeaders.multipartMixedWith(boundary.substring(2))));
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
index 9a2c6b7c9b..29390422b3 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java
@@ -39,8 +39,9 @@ import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.AnyOperations;
import org.apache.syncope.common.lib.Attr;
@@ -957,16 +958,16 @@ public class GroupITCase extends AbstractITCase {
ExecTO exec = GROUP_SERVICE.provisionMembers(groupTO.getKey(),
ProvisionAction.PROVISION);
assertNotNull(exec.getRefKey());
- AtomicReference<List<ExecTO>> execs = new AtomicReference<>();
+ Mutable<List<ExecTO>> execs = new MutableObject<>();
await().atMost(MAX_WAIT_SECONDS, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> {
try {
- execs.set(TASK_SERVICE.read(TaskType.SCHEDULED,
exec.getRefKey(), true).getExecutions());
- return !execs.get().isEmpty();
+ execs.setValue(TASK_SERVICE.read(TaskType.SCHEDULED,
exec.getRefKey(), true).getExecutions());
+ return !execs.getValue().isEmpty();
} catch (Exception e) {
return false;
}
});
- assertEquals(TaskJob.Status.SUCCESS.name(),
execs.get().getFirst().getStatus());
+ assertEquals(TaskJob.Status.SUCCESS.name(),
execs.getValue().getFirst().getStatus());
// 6. verify that the user above is now fond on LDAP
ConnObject userOnLdap =
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/KeymasterITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/KeymasterITCase.java
index cd9e1d1b48..b51459e2c3 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/KeymasterITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/KeymasterITCase.java
@@ -37,8 +37,9 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
import org.apache.syncope.common.keymaster.client.api.KeymasterException;
import org.apache.syncope.common.keymaster.client.api.model.Domain;
@@ -154,16 +155,16 @@ public class KeymasterITCase extends AbstractITCase {
final Function<List<NetworkService>, Boolean> check,
final int maxWaitSeconds) {
- AtomicReference<List<NetworkService>> holder = new AtomicReference<>();
+ Mutable<List<NetworkService>> holder = new MutableObject<>();
await().atMost(maxWaitSeconds, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> {
try {
- holder.set(serviceOps.list(type));
- return !check.apply(holder.get());
+ holder.setValue(serviceOps.list(type));
+ return !check.apply(holder.getValue());
} catch (Exception e) {
return false;
}
});
- return holder.get();
+ return holder.getValue();
}
@Test
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LiveSyncITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LiveSyncITCase.java
index 455c0fa40e..7c4b766dfa 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LiveSyncITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LiveSyncITCase.java
@@ -34,7 +34,8 @@ import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
@@ -138,7 +139,7 @@ public class LiveSyncITCase extends AbstractITCase {
}
private static boolean found(final SyncDeltaType syncDeltaType, final
String username) {
- AtomicBoolean found = new AtomicBoolean(false);
+ Mutable<Boolean> found = new MutableObject<>(false);
try (KafkaConsumer<String, String> consumer = createConsumer()) {
consumer.poll(Duration.ofSeconds(10)).forEach(record -> {
if (ACCOUNT_TOPIC.equals(record.topic())) {
@@ -156,11 +157,11 @@ public class LiveSyncITCase extends AbstractITCase {
fail(e.getMessage(), e);
}
- found.set(syncDeltaType == sdt && username.equals(uid));
+ found.setValue(syncDeltaType == sdt &&
username.equals(uid));
}
});
}
- return found.get();
+ return found.getValue();
}
@Test
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
index ea147a3437..e9149da0fe 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
@@ -49,10 +49,11 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.lib.batch.BatchRequest;
@@ -490,20 +491,20 @@ public class PullTaskITCase extends AbstractTaskITCase {
execSchedTask(TASK_SERVICE, TaskType.PULL, LDAP_PULL_TASK,
MAX_WAIT_SECONDS, false);
// 4. verify that LDAP group membership is pulled as Syncope membership
- AtomicReference<Integer> numMembers = new AtomicReference<>();
+ Mutable<Integer> numMembers = new MutableObject<>();
await().atMost(MAX_WAIT_SECONDS, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> {
try {
PagedResult<UserTO> members = USER_SERVICE.search(
new
AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
fiql(SyncopeClient.getUserSearchConditionBuilder().inGroups(groupTO.getKey()).query()).
build());
- numMembers.set(members.getResult().size());
+ numMembers.setValue(members.getResult().size());
return !members.getResult().isEmpty();
} catch (Exception e) {
return false;
}
});
- assertEquals(1, numMembers.get());
+ assertEquals(1, numMembers.getValue());
// SYNCOPE-1343, verify that the title attribute has been reset
matchingUsers = USER_SERVICE.search(
diff --git
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
index f33fec80b0..3c841e798d 100644
---
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
+++
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
@@ -33,7 +33,8 @@ import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.ExecTO;
import org.apache.syncope.common.lib.to.ReportTO;
@@ -53,21 +54,22 @@ import org.springframework.http.MediaType;
public class ReportITCase extends AbstractITCase {
protected static String execReport(final String reportKey) {
- AtomicReference<ReportTO> reportTO = new
AtomicReference<>(REPORT_SERVICE.read(reportKey));
- int preExecSize = reportTO.get().getExecutions().size();
+ Mutable<ReportTO> reportTO = new
MutableObject<>(REPORT_SERVICE.read(reportKey));
+ int preExecSize = reportTO.getValue().getExecutions().size();
ExecTO execution = REPORT_SERVICE.execute(new
ExecSpecs.Builder().key(reportKey).build());
assertNotNull(execution.getExecutor());
await().atMost(MAX_WAIT_SECONDS, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until(() -> {
try {
- reportTO.set(REPORT_SERVICE.read(reportKey));
- return preExecSize < reportTO.get().getExecutions().size();
+ reportTO.setValue(REPORT_SERVICE.read(reportKey));
+ return preExecSize <
reportTO.getValue().getExecutions().size();
} catch (Exception e) {
return false;
}
});
- ExecTO exec =
reportTO.get().getExecutions().stream().max(Comparator.comparing(ExecTO::getStart)).orElseThrow();
+ ExecTO exec = reportTO.getValue().getExecutions().stream().
+ max(Comparator.comparing(ExecTO::getStart)).orElseThrow();
assertEquals(ReportJob.Status.SUCCESS.name(), exec.getStatus());
return exec.getKey();
}
diff --git a/sra/src/main/java/org/apache/syncope/sra/RouteProvider.java
b/sra/src/main/java/org/apache/syncope/sra/RouteProvider.java
index 4745d108c7..1a48dc1fd4 100644
--- a/sra/src/main/java/org/apache/syncope/sra/RouteProvider.java
+++ b/sra/src/main/java/org/apache/syncope/sra/RouteProvider.java
@@ -22,11 +22,12 @@ import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
-import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.stream.Stream;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.syncope.client.lib.AnonymousAuthenticationHandler;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
@@ -273,15 +274,15 @@ public class RouteProvider {
break;
case RETRY:
- AtomicInteger retries = new AtomicInteger();
+ Mutable<Integer> retries = new MutableObject<>();
try {
- retries.set(Integer.valueOf(gwfilter.getArgs().trim()));
+
retries.setValue(Integer.valueOf(gwfilter.getArgs().trim()));
} catch (NumberFormatException e) {
LOG.error("Unexpected argument value: {}",
gwfilter.getArgs().trim(), e);
- retries.set(0);
+ retries.setValue(0);
}
filter = ctx.getBean(RetryGatewayFilterFactory.class).
- apply(c -> c.setRetries(retries.get()));
+ apply(c -> c.setRetries(retries.getValue()));
break;
case SAVE_SESSION:
@@ -319,15 +320,15 @@ public class RouteProvider {
break;
case STRIP_PREFIX:
- AtomicInteger parts = new AtomicInteger();
+ Mutable<Integer> parts = new MutableObject<>();
try {
- parts.set(Integer.valueOf(gwfilter.getArgs().trim()));
+ parts.setValue(Integer.valueOf(gwfilter.getArgs().trim()));
} catch (NumberFormatException e) {
LOG.error("Unexpected argument value: {}",
gwfilter.getArgs().trim(), e);
- parts.set(0);
+ parts.setValue(0);
}
filter = ctx.getBean(StripPrefixGatewayFilterFactory.class).
- apply(c -> c.setParts(parts.get()));
+ apply(c -> c.setParts(parts.getValue()));
break;
case REQUEST_HEADER_TO_REQUEST_URI:
@@ -337,7 +338,7 @@ public class RouteProvider {
case SET_REQUEST_SIZE:
filter = ctx.getBean(RequestSizeGatewayFilterFactory.class).
- apply(c ->
c.setMaxSize(DataSize.ofBytes(Long.valueOf(gwfilter.getArgs().trim()))));
+ apply(c ->
c.setMaxSize(DataSize.ofBytes(Long.parseLong(gwfilter.getArgs().trim()))));
break;
case SET_REQUEST_HOST:
@@ -476,16 +477,16 @@ public class RouteProvider {
case WEIGHT:
String[] weigthArgs = gwpredicate.getArgs().split(",");
- AtomicInteger weight = new AtomicInteger();
+ Mutable<Integer> weight = new MutableObject<Integer>();
try {
- weight.set(Integer.valueOf(weigthArgs[1].trim()));
+ weight.setValue(Integer.valueOf(weigthArgs[1].trim()));
} catch (NumberFormatException e) {
LOG.error("Unexpected argument value: {}",
weigthArgs[1].trim(), e);
- weight.set(0);
+ weight.setValue(0);
}
predicate = ctx.getBean(WeightRoutePredicateFactory.class).
applyAsync(c -> c.setGroup(weigthArgs[0].trim()).
- setWeight(weight.get()));
+ setWeight(weight.getValue()));
break;
case CUSTOM:
diff --git
a/sra/src/test/java/org/apache/syncope/sra/ZookeeperTestingServer.java
b/sra/src/test/java/org/apache/syncope/sra/ZookeeperTestingServer.java
index fe4c29910e..0549ebc3ce 100644
--- a/sra/src/test/java/org/apache/syncope/sra/ZookeeperTestingServer.java
+++ b/sra/src/test/java/org/apache/syncope/sra/ZookeeperTestingServer.java
@@ -24,7 +24,6 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import java.util.concurrent.atomic.AtomicReference;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
import org.apache.commons.lang3.StringUtils;
@@ -34,33 +33,35 @@ import org.apache.zookeeper.server.auth.DigestLoginModule;
import org.apache.zookeeper.server.auth.SASLAuthenticationProvider;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
+import wiremock.org.apache.commons.lang3.mutable.Mutable;
+import wiremock.org.apache.commons.lang3.mutable.MutableObject;
public class ZookeeperTestingServer implements
ApplicationContextInitializer<ConfigurableApplicationContext> {
@Override
public void initialize(final ConfigurableApplicationContext ctx) {
- AtomicReference<Integer> port = new AtomicReference<>();
- AtomicReference<String> username = new AtomicReference<>();
- AtomicReference<String> password = new AtomicReference<>();
+ Mutable<Integer> port = new MutableObject<>();
+ Mutable<String> username = new MutableObject<>();
+ Mutable<String> password = new MutableObject<>();
try (InputStream propStream =
getClass().getResourceAsStream("/test.properties")) {
Properties props = new Properties();
props.load(propStream);
-
port.set(Integer.valueOf(StringUtils.substringAfter(props.getProperty("keymaster.address"),
":")));
- username.set(props.getProperty("keymaster.username"));
- password.set(props.getProperty("keymaster.password"));
+
port.setValue(Integer.valueOf(StringUtils.substringAfter(props.getProperty("keymaster.address"),
":")));
+ username.setValue(props.getProperty("keymaster.username"));
+ password.setValue(props.getProperty("keymaster.password"));
} catch (Exception e) {
throw new IllegalStateException("Could not load /test.properties",
e);
}
- if (AbstractTest.available(port.get())) {
+ if (AbstractTest.available(port.getValue())) {
Configuration.setConfiguration(new Configuration() {
private final AppConfigurationEntry[] entries = {
new AppConfigurationEntry(
DigestLoginModule.class.getName(),
AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
- Map.of("user_" + username.get(), password.get()))
+ Map.of("user_" + username.getValue(), password.getValue()))
};
@Override
@@ -71,7 +72,7 @@ public class ZookeeperTestingServer implements
ApplicationContextInitializer<Con
Map<String, Object> customProperties = new HashMap<>();
customProperties.put("authProvider.1",
SASLAuthenticationProvider.class.getName());
- InstanceSpec spec = new InstanceSpec(null, port.get(), -1, -1,
true, 1, -1, -1, customProperties);
+ InstanceSpec spec = new InstanceSpec(null, port.getValue(), -1,
-1, true, 1, -1, -1, customProperties);
try {
new TestingServer(spec, true);
diff --git
a/wa/starter/src/test/java/org/apache/syncope/wa/starter/ZookeeperTestingServer.java
b/wa/starter/src/test/java/org/apache/syncope/wa/starter/ZookeeperTestingServer.java
index 273a6a55b3..03e5aae202 100644
---
a/wa/starter/src/test/java/org/apache/syncope/wa/starter/ZookeeperTestingServer.java
+++
b/wa/starter/src/test/java/org/apache/syncope/wa/starter/ZookeeperTestingServer.java
@@ -24,10 +24,11 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import java.util.concurrent.atomic.AtomicReference;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.curator.test.InstanceSpec;
import org.apache.curator.test.TestingServer;
import org.apache.zookeeper.server.auth.DigestLoginModule;
@@ -39,16 +40,16 @@ public class ZookeeperTestingServer implements
ApplicationContextInitializer<Con
@Override
public void initialize(final ConfigurableApplicationContext ctx) {
- AtomicReference<Integer> port = new AtomicReference<>();
- AtomicReference<String> username = new AtomicReference<>();
- AtomicReference<String> password = new AtomicReference<>();
+ Mutable<Integer> port = new MutableObject<>();
+ Mutable<String> username = new MutableObject<>();
+ Mutable<String> password = new MutableObject<>();
try (InputStream propStream =
getClass().getResourceAsStream("/test.properties")) {
Properties props = new Properties();
props.load(propStream);
-
port.set(Integer.valueOf(StringUtils.substringAfter(props.getProperty("keymaster.address"),
":")));
- username.set(props.getProperty("keymaster.username"));
- password.set(props.getProperty("keymaster.password"));
+
port.setValue(Integer.valueOf(StringUtils.substringAfter(props.getProperty("keymaster.address"),
":")));
+ username.setValue(props.getProperty("keymaster.username"));
+ password.setValue(props.getProperty("keymaster.password"));
} catch (Exception e) {
throw new IllegalStateException("Could not load /test.properties",
e);
}
@@ -59,7 +60,7 @@ public class ZookeeperTestingServer implements
ApplicationContextInitializer<Con
new AppConfigurationEntry(
DigestLoginModule.class.getName(),
AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
- Map.of("user_" + username.get(), password.get()))
+ Map.of("user_" + username.getValue(), password.getValue()))
};
@Override
@@ -70,7 +71,7 @@ public class ZookeeperTestingServer implements
ApplicationContextInitializer<Con
Map<String, Object> customProperties = new HashMap<>();
customProperties.put("authProvider.1",
SASLAuthenticationProvider.class.getName());
- InstanceSpec spec = new InstanceSpec(null, port.get(), -1, -1, true,
1, -1, -1, customProperties);
+ InstanceSpec spec = new InstanceSpec(null, port.getValue(), -1, -1,
true, 1, -1, -1, customProperties);
try {
new TestingServer(spec, true);