Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYNCOPE-1804] Introducing syncope-core-persistence-neo4j #628

Merged
merged 10 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
55 changes: 55 additions & 0 deletions .github/workflows/neo4j.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License
name: "Neo4j"

on:
push:
branches: ['master', 'pr-*']
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 13 * * 4'

jobs:
neo4j:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Setup Maven
uses: stCarolas/setup-maven@v4.5
with:
maven-version: 3.9.4
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build
run: mvn -U -T 1C -P 'skipTests,all'
- name: 'Unit Tests: Neo4j'
run: mvn -f core/persistence-neo4j/pom.xml -P neo4j -Dinvoker.streamLogs=true -Dmodernizer.skip=true -Dianal.phase=none -Drat.skip=true -Dcheckstyle.skip=true -Djacoco.skip=true
#- name: 'Integration Tests: Neo4j'
# run: mvn -f fit/core-reference/pom.xml -P neo4j-it -Dinvoker.streamLogs=true -Dmodernizer.skip=true -Drat.skip=true -Dcheckstyle.skip=true -Djacoco.skip=true
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.common.lib.to.ConnIdBundle;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.to.ConnPoolConfTO;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.lib.types.ConnPoolConf;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings;
import org.apache.wicket.extensions.wizard.WizardStep;
Expand Down Expand Up @@ -177,7 +177,7 @@ protected void onUpdate(final AjaxRequestTarget target) {
});

if (connInstanceTO.getPoolConf() == null) {
connInstanceTO.setPoolConf(new ConnPoolConfTO());
connInstanceTO.setPoolConf(new ConnPoolConf());
}

add(new AjaxSpinnerFieldPanel.Builder<Integer>().min(0).max(Integer.MAX_VALUE).build(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.syncope.common.keymaster.client.api.DomainOps;
import org.apache.syncope.common.keymaster.client.api.KeymasterException;
import org.apache.syncope.common.keymaster.client.api.model.Domain;
import org.apache.syncope.common.keymaster.client.api.model.JPADomain;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -77,7 +78,7 @@ public DomainDirectoryPanel(final String id, final PageReference pageRef) {
utilityModal.size(Modal.Size.Small);
utilityModal.addSubmitButton();

addNewItemPanelBuilder(new DomainWizardBuilder(domainOps, new Domain(), pageRef), true);
addNewItemPanelBuilder(new DomainWizardBuilder(domainOps, new JPADomain(), pageRef), true);

initResultTable();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxSpinnerFieldPanel;
import org.apache.syncope.common.keymaster.client.api.DomainOps;
import org.apache.syncope.common.keymaster.client.api.model.Domain;
import org.apache.syncope.common.keymaster.client.api.model.JPADomain;
import org.apache.syncope.common.keymaster.client.api.model.Neo4jDomain;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.model.PropertyModel;
Expand Down Expand Up @@ -62,8 +64,17 @@ public Domain getItem() {

@Override
public void onSubmit(final AjaxRequestTarget target) {
int max = 10;
int min = 0;
if (domain instanceof JPADomain jpaDomain) {
max = jpaDomain.getPoolMaxActive();
min = jpaDomain.getPoolMinIdle();
} else if (domain instanceof Neo4jDomain neo4jDomain) {
max = neo4jDomain.getMaxConnectionPoolSize();
}

try {
domainOps.adjustPoolSize(domain.getKey(), domain.getPoolMaxActive(), domain.getPoolMinIdle());
domainOps.adjustPoolSize(domain.getKey(), max, min);

SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
this.modal.close(target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.syncope.client.ui.commons.markup.html.form.EncryptedFieldPanel;
import org.apache.syncope.common.keymaster.client.api.DomainOps;
import org.apache.syncope.common.keymaster.client.api.model.Domain;
import org.apache.syncope.common.keymaster.client.api.model.JPADomain;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -119,10 +120,11 @@ public Storage(final Domain domain) {
add(new EncryptedFieldPanel(
"dbPassword", "dbPassword", new PropertyModel<>(domain, "dbPassword"), false));

AjaxDropDownChoicePanel<Domain.TransactionIsolation> transactionIsolation = new AjaxDropDownChoicePanel<>(
"transactionIsolation", "transactionIsolation",
new PropertyModel<>(domain, "transactionIsolation"), false);
transactionIsolation.setChoices(List.of(Domain.TransactionIsolation.values()));
AjaxDropDownChoicePanel<JPADomain.TransactionIsolation> transactionIsolation =
new AjaxDropDownChoicePanel<>(
"transactionIsolation", "transactionIsolation",
new PropertyModel<>(domain, "transactionIsolation"), false);
transactionIsolation.setChoices(List.of(JPADomain.TransactionIsolation.values()));
transactionIsolation.addRequiredLabel();
transactionIsolation.setNullValid(false);
add(transactionIsolation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
import org.apache.syncope.common.keymaster.client.api.DomainOps;
import org.apache.syncope.common.keymaster.client.api.ServiceOps;
import org.apache.syncope.common.keymaster.client.api.model.Domain;
import org.apache.syncope.common.keymaster.client.api.model.JPADomain;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.info.NumbersInfo;
import org.apache.syncope.common.lib.info.PlatformInfo;
Expand Down Expand Up @@ -105,7 +105,8 @@ public ServiceOps selfServiceOps() {
@Bean
public DomainOps domainOps() {
DomainOps domainOps = mock(DomainOps.class);
when(domainOps.list()).thenReturn(List.of(new Domain.Builder(SyncopeConstants.MASTER_DOMAIN).build()));
when(domainOps.list()).thenReturn(
List.of(new JPADomain.Builder(SyncopeConstants.MASTER_DOMAIN).build()));
return domainOps;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
import org.apache.syncope.common.keymaster.client.api.DomainOps;
import org.apache.syncope.common.keymaster.client.api.ServiceOps;
import org.apache.syncope.common.keymaster.client.api.model.Domain;
import org.apache.syncope.common.keymaster.client.api.model.JPADomain;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.info.NumbersInfo;
import org.apache.syncope.common.lib.info.PlatformInfo;
Expand Down Expand Up @@ -95,7 +95,7 @@ public ServiceOps selfServiceOps() {
@Bean
public DomainOps domainOps() {
DomainOps domainOps = mock(DomainOps.class);
when(domainOps.list()).thenReturn(List.of(new Domain.Builder(SyncopeConstants.MASTER_DOMAIN).build()));
when(domainOps.list()).thenReturn(List.of(new JPADomain.Builder(SyncopeConstants.MASTER_DOMAIN).build()));
return domainOps;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.ConnPoolConf;
import org.apache.syncope.common.lib.types.ConnectorCapability;

public class ConnInstanceTO implements EntityTO {
Expand Down Expand Up @@ -59,7 +60,7 @@ public class ConnInstanceTO implements EntityTO {

private Integer connRequestTimeout;

private ConnPoolConfTO poolConf;
private ConnPoolConf poolConf;

@Override
public String getKey() {
Expand Down Expand Up @@ -166,11 +167,11 @@ public void setConnRequestTimeout(final Integer connRequestTimeout) {
this.connRequestTimeout = connRequestTimeout;
}

public ConnPoolConfTO getPoolConf() {
public ConnPoolConf getPoolConf() {
return poolConf;
}

public void setPoolConf(final ConnPoolConfTO poolConf) {
public void setPoolConf(final ConnPoolConf poolConf) {
this.poolConf = poolConf;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.syncope.common.lib.to;
package org.apache.syncope.common.lib.types;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.syncope.common.lib.BaseBean;

public class ConnPoolConfTO implements BaseBean {
public class ConnPoolConf implements BaseBean {

private static final long serialVersionUID = -214360178113476623L;

Expand Down Expand Up @@ -87,7 +87,7 @@ public boolean equals(final Object obj) {
if (getClass() != obj.getClass()) {
return false;
}
ConnPoolConfTO other = (ConnPoolConfTO) obj;
ConnPoolConf other = (ConnPoolConf) obj;
return new EqualsBuilder().
append(maxObjects, other.maxObjects).
append(minIdle, other.minIdle).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final class IdRepoImplementationType {
Pair.of(TASKJOB_DELEGATE, "org.apache.syncope.core.provisioning.api.job.SchedTaskJobDelegate"),
Pair.of(REPORT_DELEGATE, "org.apache.syncope.core.provisioning.api.job.report.ReportJobDelegate"),
Pair.of(LOGIC_ACTIONS, "org.apache.syncope.core.logic.api.LogicActions"),
Pair.of(VALIDATOR, "org.apache.syncope.core.persistence.api.attrvalue.validation.PlainAttrValueValidator"),
Pair.of(VALIDATOR, "org.apache.syncope.core.persistence.api.attrvalue.PlainAttrValueValidator"),
Pair.of(COMMAND, "org.apache.syncope.core.logic.api.Command"),
Pair.of(RECIPIENTS_PROVIDER, "org.apache.syncope.core.provisioning.api.notification.RecipientsProvider"),
Pair.of(ITEM_TRANSFORMER, "org.apache.syncope.core.provisioning.api.data.ItemTransformer"));
Expand Down
Loading
Loading