Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Nov 8, 2021
2 parents db91081 + 4445950 commit bb41b57
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 148 deletions.
10 changes: 5 additions & 5 deletions dist/src/main/bin/midpoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ then
JAVA_OPTS="-Xms${JAVA_def_Xms} ${JAVA_OPTS:-}"
fi
fi
if $(echo "${JAVA_OPTS:-}" | grep -v -q "\-Dpython.cachedir=") ; then JAVA_OPTS="${JAVA_OPTS:-} -Dpython.cachedir=${MIDPOINT_HOME}/${JAVA_def_python_cachedir}" ; fi
if $(echo "${JAVA_OPTS:-}" | grep -v -q "\-Djavax.net.ssl.trustStore=") ; then JAVA_OPTS="${JAVA_OPTS:-} -Djavax.net.ssl.trustStore=${MIDPOINT_HOME}/${JAVA_def_trustStore}" ; fi
if $(echo "${JAVA_OPTS:-}" | grep -v -q "\-Dpython.cachedir=") ; then JAVA_OPTS="${JAVA_OPTS:-} -Dpython.cachedir=\"${MIDPOINT_HOME}/${JAVA_def_python_cachedir}\"" ; fi
if $(echo "${JAVA_OPTS:-}" | grep -v -q "\-Djavax.net.ssl.trustStore=") ; then JAVA_OPTS="${JAVA_OPTS:-} -Djavax.net.ssl.trustStore=\"${MIDPOINT_HOME}/${JAVA_def_trustStore}\"" ; fi
if $(echo "${JAVA_OPTS:-}" | grep -v -q "\-Djavax.net.ssl.trustStoreType=") ; then JAVA_OPTS="${JAVA_OPTS:-} -Djavax.net.ssl.trustStoreType=${JAVA_def_trustStoreType}" ; fi

if $(echo "${JAVA_OPTS:-}" | grep -v -q "\-Dmidpoint.home=") ; then JAVA_OPTS="${JAVA_OPTS:-} -Dmidpoint.home=${MIDPOINT_HOME}" ; fi
if $(echo "${JAVA_OPTS:-}" | grep -v -q "\-Dmidpoint.home=") ; then JAVA_OPTS="${JAVA_OPTS:-} -Dmidpoint.home=\"${MIDPOINT_HOME}\"" ; fi

# TODO probably useless from Tomcat 7 and before history, remove and check LDAP/ConnId logging
if $(echo "${JAVA_OPTS:-}" | grep -v -q "\-Djava.util.logging.manager=") ; then JAVA_OPTS="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager ${JAVA_OPTS:-}" ; fi
Expand Down Expand Up @@ -248,7 +248,7 @@ then
echo "Place following content to /etc/systemd/system/midpoint.service file" >&2
echo "MP_GEN_SYSTEMD=1 ${0} ${@} | sudo tee /etc/systemd/system/midpoint.service" >&2
echo >&2
cat <<EOF
cat << EOF
[Unit]
Description=MidPoint Standalone Service
###Requires=postgresql.service
Expand Down Expand Up @@ -326,7 +326,7 @@ if [[ "$1" == "start" ]]; then
# shellcheck disable=SC2086
eval "${_NOHUP}" "\"${_RUNJAVA}\"" \
${JAVA_OPTS} \
-jar "${BASE_DIR}/lib/midpoint.war" \
-jar "\"${BASE_DIR}/lib/midpoint.war\"" \
"$@" \
"&" >>"${BOOT_OUT}" 2>&1

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
mvn clean install -P extratest,-dist -Dsurefire.args="-Xmx8g" -Dfailsafe.args="-Xmx8g -Duser.language=en"
(Skipping of default tests is managed by "extratest" profile.)
WARNING!!! Overriding failsafe/surefire.args when using "sqale" profile (new repository)
effectively disables another improtant JVM argument for tests which must be added to mvn
effectively disables another important JVM argument for tests which must be added to mvn
command line explicitly: -Dtest.config.file=test-config-new-repo.xml
Extra test run for a single module, -D property matches the module in -pl:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
import com.evolveum.midpoint.util.ShortDumpable;

/**
* @author semancik
*
* Options for {@link RepositoryService#addObject}.
*/
public class RepoAddOptions extends AbstractOptions implements Serializable, ShortDumpable {
private static final long serialVersionUID = -6243926109579064467L;

/**
* Allows overwriting existing object *of the same type*.
* Overwriting different type is not allowed because it is unlikely done on purpose.
*/
private boolean overwrite = false;
private boolean allowUnencryptedValues = false;

Expand All @@ -42,7 +45,6 @@ public static RepoAddOptions createOverwrite() {
return opts;
}


public boolean isAllowUnencryptedValues() {
return allowUnencryptedValues;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ public interface RepositoryService {

/**
* Returns object for provided OID.
* <p>
* Must fail if object with the OID does not exists.
*
* Must fail if object with the OID does not exist.
*
* @param oid OID of the object to get
* @param parentResult parent OperationResult (in/out)
Expand Down Expand Up @@ -194,28 +194,29 @@ <T extends ObjectType> String getVersion(Class<T> type, String oid, OperationRes
// Add/modify/delete

/**
* <p>Add new object.</p>
* <p>
* The OID provided in the input message may be empty. In that case the OID
* will be assigned by the implementation of this method and it will be
* provided as return value.
* </p><p>
* Add new object.
*
* The OID provided in the input message may be empty.
* In that case the OID will be assigned by the implementation of this method
* and it will be provided as return value.
*
* This operation should fail if such object already exists (if object with
* the provided OID already exists).
* </p><p>
* The operation may fail if provided OID is in an unusable format for the
* storage. Generating own OIDs and providing them to this method is not
* Overwrite is possible if {@link RepoAddOptions#overwrite} is true, but only
* for the object of the same type.
*
* The operation may fail if provided OID is in an unusable format for the storage.
* Generating own OIDs and providing them to this method is not
* recommended for normal operation.
* </p><p>
* Should be atomic. Should not allow creation of two objects with the same
* OID (even if created in parallel).
* </p><p>
* The operation may fail if the object to be created does not conform to
* the underlying schema of the storage system or the schema enforced by the
* implementation.
* </p><p>
* Note: no need for explicit type parameter here. The object parameter contains the information.
* </p>
*
* Should be atomic.
* Should not allow creation of two objects with the same OID (even if created in parallel).
*
* The operation may fail if the object to be created does not conform to the underlying
* schema of the storage system or the schema enforced by the implementation.
*
* Note: no need for explicit type parameter here.
* The object parameter contains the information.
*
* @param object object to create
* @param parentResult parent OperationResult (in/out)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
/*
* Copyright (C) 2010-2020 Evolveum and contributors
* Copyright (C) 2010-2021 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.repo.sql;

import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertNull;

import static com.evolveum.midpoint.repo.api.RepoAddOptions.createOverwrite;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -174,10 +177,27 @@ public void test200ServiceNameMustBeUnique() throws SchemaException, ObjectAlrea

then("We can't add another service with the same name into the repository");
Assertions.assertThatThrownBy(() ->
repositoryService.addObject(
new ServiceType(prismContext).name("test-service").asPrismObject(),
null,
new OperationResult("Reimport object with the same name")))
repositoryService.addObject(
new ServiceType(prismContext).name("test-service").asPrismObject(),
null,
new OperationResult("Reimport object with the same name")))
.isInstanceOf(ObjectAlreadyExistsException.class);
}

@Test
public void test300AddWithOverwriteDifferentTypeIsNotAllowed() throws Exception {
given();
OperationResult result = createOperationResult();
UserType user = new UserType(prismContext).name("user" + getTestNumber());
String oid = repositoryService.addObject(user.asPrismObject(), null, result);

expect("adding object of different type with the same OID to the repository with overwrite option throws");
DashboardType dashboard = new DashboardType(prismContext)
.name("dashboard" + getTestNumber())
.oid(oid);
assertThatThrownBy(() -> repositoryService.addObject(dashboard.asPrismObject(), createOverwrite(), result))
.isInstanceOf(ObjectAlreadyExistsException.class);

assertThatOperationResult(result).isFatalError();
}
}

0 comments on commit bb41b57

Please sign in to comment.