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 Dec 20, 2022
2 parents 6df4d53 + 1870b65 commit 634e572
Show file tree
Hide file tree
Showing 22 changed files with 247 additions and 254 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,17 @@ protected void onConfigure() {
}

protected void createBreadcrumb() {
addBreadcrumb(new Breadcrumb(getPageTitleModel(), this.getClass(), getPageParameters()));
PageParameters pageParameters = getPageParameters();
removePageParametersIfNeeded(pageParameters);
addBreadcrumb(new Breadcrumb(getPageTitleModel(), this.getClass(), pageParameters));
}

private void removePageParametersIfNeeded(PageParameters parameters) {
pageParametersToBeRemoved().forEach(parameters::remove);
}

protected List<String> pageParametersToBeRemoved() {
return new ArrayList<>();
}

public void updateBreadcrumbParameters(String key, Object value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,20 @@ public ObjectFilter createFilter(Class type, PageBase pageBase, VariablesMap var
if (singleDate != null && intervalSecondDate != null) {
return ctx.queryFor(type)
.item(path)
.gt(singleDate)
.ge(singleDate)
.and()
.item(path)
.lt(intervalSecondDate)
.le(intervalSecondDate)
.buildFilter();
} else if (singleDate != null) {
return ctx.queryFor(type)
.item(path)
.gt(singleDate)
.ge(singleDate)
.buildFilter();
} else if (intervalSecondDate != null) {
return ctx.queryFor(type)
.item(path)
.lt(intervalSecondDate)
.le(intervalSecondDate)
.buildFilter();
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,4 +489,10 @@ private void editAsXmlPerformed(ResourceType resourceType) {
private void clearSessionStorageForResourcePage() {
((PageBase) getPage()).getSessionStorage().clearResourceContentStorage();
}

@Override
protected List<String> pageParametersToBeRemoved() {
return List.of(PageBase.PARAMETER_SEARCH_BY_NAME);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,9 @@ private String createScheduledToRunAgain(IModel<SelectableBean<TaskType>> taskMo
private Long xgc2long(XMLGregorianCalendar gc) {
return gc != null ? XmlTypeConverter.toMillis(gc) : null;
}

@Override
protected List<String> pageParametersToBeRemoved() {
return List.of(PageBase.PARAMETER_SEARCH_BY_NAME);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import com.evolveum.midpoint.gui.api.page.PageBase;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.IModel;
Expand Down Expand Up @@ -418,4 +420,9 @@ public List<SelectableBean<UserType>> isAnythingSelected(AjaxRequestTarget targe

return users;
}

@Override
protected List<String> pageParametersToBeRemoved() {
return List.of(PageBase.PARAMETER_SEARCH_BY_NAME);
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,14 @@ public abstract void modifyUserCredential(Task task, OperationResult result)
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
super.initSystem(initTask, initResult);

modelService.postInit(initResult);

// System Configuration
try {
repoAddObjectFromFile(SYSTEM_CONFIGURATION_FILE, initResult);
} catch (ObjectAlreadyExistsException e) {
throw new ObjectAlreadyExistsException("System configuration already exists in repository;" +
"looks like the previous test haven't cleaned it up", e);
}
modelService.postInit(initResult);

repoAddObjectFromFile(SECURITY_POLICY_FILE, initResult);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,14 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
logger.trace("initSystem");
super.initSystem(initTask, initResult);

modelService.postInit(initResult);

// System Configuration
try {
repoAddObjectFromFile(getSystemConfigurationFile(), initResult);
} catch (ObjectAlreadyExistsException e) {
throw new ObjectAlreadyExistsException("System configuration already exists in repository;" +
"looks like the previous test haven't cleaned it up", e);
}
modelService.postInit(initResult);

// Administrator
roleSuperuser = repoAddObjectFromFile(ROLE_SUPERUSER_FILE, RoleType.class, initResult).asObjectable();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/*
* Copyright (c) 2010-2017 Evolveum and contributors
* Copyright (C) 2010-2022 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.model.impl;

import static com.evolveum.midpoint.schema.constants.SchemaConstants.RI_ACCOUNT_OBJECT_CLASS;

import java.io.File;
import javax.xml.namespace.QName;

Expand All @@ -22,33 +24,28 @@
import com.evolveum.midpoint.test.DummyResourceContoller;
import com.evolveum.midpoint.test.TestResource;
import com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemObjectsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

import static com.evolveum.midpoint.schema.constants.SchemaConstants.RI_ACCOUNT_OBJECT_CLASS;

/**
* @author semancik
*/
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
public class AbstractInternalModelIntegrationTest extends AbstractModelImplementationIntegrationTest {

public static final File SYSTEM_CONFIGURATION_FILE = new File(COMMON_DIR, "system-configuration.xml");
public static final String SYSTEM_CONFIGURATION_OID = SystemObjectsType.SYSTEM_CONFIGURATION.value();

public static final File SECURITY_POLICY_FILE = new File(COMMON_DIR, "security-policy.xml");
public static final String SECURITY_POLICY_OID = "28bf845a-b107-11e3-85bc-001e8c717e5b";

public static final File USER_ADMINISTRATOR_FILE = new File(COMMON_DIR, "user-administrator.xml");
protected static final String USER_ADMINISTRATOR_NAME = "administrator";
protected static final String USER_ADMINISTRATOR_OID = "00000000-0000-0000-0000-000000000002";

protected static final File USER_JACK_FILE = new File(COMMON_DIR, "user-jack.xml");
protected static final String USER_JACK_OID = "c0c010c0-d34d-b33f-f00d-111111111111";
protected static final String USER_JACK_USERNAME = "jack";
protected static final String USER_JACK_PASSWORD = "deadmentellnotales";

protected static final TestResource USER_JACK = new TestResource(COMMON_DIR, "user-jack.xml", USER_JACK_OID);
protected static final TestResource<?> USER_JACK = new TestResource<>(COMMON_DIR, "user-jack.xml", USER_JACK_OID);

protected static final File USER_BARBOSSA_FILE = new File(COMMON_DIR, "user-barbossa.xml");
protected static final String USER_BARBOSSA_OID = "c0c010c0-d34d-b33f-f00d-111111111112";
Expand All @@ -59,7 +56,6 @@ public class AbstractInternalModelIntegrationTest extends AbstractModelImplement

static final File USER_ELAINE_FILE = new File(COMMON_DIR, "user-elaine.xml");
protected static final String USER_ELAINE_OID = "c0c010c0-d34d-b33f-f00d-11111111111e";
protected static final String USER_ELAINE_USERNAME = "elaine";

// Largo does not have a full name set, employeeType=PIRATE
protected static final File USER_LARGO_FILE = new File(COMMON_DIR, "user-largo.xml");
Expand All @@ -76,7 +72,6 @@ public class AbstractInternalModelIntegrationTest extends AbstractModelImplement
public static final String ACCOUNT_JACK_DUMMY_USERNAME = "jack";

public static final File ACCOUNT_HERMAN_DUMMY_FILE = new File(COMMON_DIR, "account-herman-dummy.xml");
public static final String ACCOUNT_HERMAN_DUMMY_OID = "22220000-2200-0000-0000-444400004444";
public static final String ACCOUNT_HERMAN_DUMMY_USERNAME = "ht";

public static final File ACCOUNT_SHADOW_GUYBRUSH_DUMMY_FILE = new File(COMMON_DIR, "account-shadow-guybrush-dummy.xml");
Expand All @@ -87,10 +82,8 @@ public class AbstractInternalModelIntegrationTest extends AbstractModelImplement

public static final File ACCOUNT_SHADOW_ELAINE_DUMMY_FILE = new File(COMMON_DIR, "account-elaine-dummy.xml");
public static final String ACCOUNT_SHADOW_ELAINE_DUMMY_OID = "c0c010c0-d34d-b33f-f00d-22220004000e";
public static final String ACCOUNT_ELAINE_DUMMY_USERNAME = USER_ELAINE_USERNAME;

public static final File ENTITLEMENT_SHADOW_PIRATE_DUMMY_FILE = new File(COMMON_DIR, "entitlement-shadow-pirate-dummy.xml");
public static final String ENTITLEMENT_PIRATE_DUMMY_NAME = "pirate";

public static final File ACCOUNT_SHADOW_CALYPSO_DUMMY_FILE = new File(COMMON_DIR, "account-shadow-calypso-dummy.xml");
public static final String ACCOUNT_CALYPSO_DUMMY_USERNAME = "calypso";
Expand Down Expand Up @@ -128,15 +121,14 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
mockClockworkHook = new MockClockworkHook();
hookRegistry.registerChangeHook(MOCK_CLOCKWORK_HOOK_URL, mockClockworkHook);

modelService.postInit(initResult);

// System Configuration
try {
repoAddObjectFromFile(SYSTEM_CONFIGURATION_FILE, initResult);
} catch (ObjectAlreadyExistsException e) {
throw new ObjectAlreadyExistsException("System configuration already exists in repository;" +
"looks like the previous test haven't cleaned it up", e);
}
modelService.postInit(initResult);

repoAddObjectFromFile(SECURITY_POLICY_FILE, initResult);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
/*
* Copyright (c) 2010-2017 Evolveum and contributors
* Copyright (C) 2010-2022 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.model.impl.lens;

import static com.evolveum.midpoint.schema.constants.SchemaConstants.PATH_CREDENTIALS_PASSWORD_VALUE;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;

import static com.evolveum.midpoint.schema.constants.SchemaConstants.PATH_CREDENTIALS_PASSWORD_VALUE;

import java.io.File;
import java.util.List;

import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.test.TestResource;

import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.jetbrains.annotations.NotNull;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
Expand All @@ -27,12 +23,15 @@

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.crypto.EncryptionException;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.test.TestResource;
import com.evolveum.midpoint.test.util.TestUtil;
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
import com.evolveum.midpoint.util.exception.PolicyViolationException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;

@ContextConfiguration(locations = { "classpath:ctx-model-test-main.xml" })
Expand All @@ -54,7 +53,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti

abstract Class<F> getType();

abstract TestResource getTestResource();
abstract TestResource<?> getTestResource();

private String getOid() {
return getTestResource().oid;
Expand Down Expand Up @@ -235,7 +234,7 @@ public void test230ModifySamePasswordNoPasswordHistory() throws Exception {
modifyPasswordNoHistory();
}

private void modifyPasswordNoHistory() throws Exception{
private void modifyPasswordNoHistory() throws Exception {
Task task = getTestTask();
OperationResult result = getTestOperationResult();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright (c) 2020 Evolveum and contributors
* Copyright (C) 2020-2022 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.model.impl.lens;

import com.evolveum.midpoint.schema.result.OperationResult;
Expand All @@ -13,7 +12,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

/**
* Testing password policy processor for user Jack.
* Testing password policy processor for user Jack.
*/
public class TestPasswordPolicyProcessorForUser extends TestPasswordPolicyProcessor<UserType> {

Expand All @@ -30,7 +29,7 @@ Class<UserType> getType() {
}

@Override
TestResource getTestResource() {
TestResource<?> getTestResource() {
return USER_JACK;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Copyright (c) 2020 Evolveum and contributors
* Copyright (C) 2020-2022 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.model.intest;

import static com.evolveum.midpoint.model.intest.CommonArchetypes.ARCHETYPE_TASK_ITERATIVE_BULK_ACTION;
Expand Down Expand Up @@ -34,9 +33,9 @@
*
* Creates a repo with:
*
* - empty system configuration
* - administrator user (from common dir)
* - superuser role (from common dir)
* - empty system configuration
* - administrator user (from common dir)
* - superuser role (from common dir)
*
* There are some standard archetypes defined, but not imported. Individual tests should import them if necessary.
*/
Expand All @@ -61,9 +60,6 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
InternalsConfig.setAvoidLoggingChange(isAvoidLoggingChange());
super.initSystem(initTask, initResult);

modelService.postInit(initResult);
ManualConnectorInstance.setRandomDelayRange(0);

// System Configuration
PrismObject<SystemConfigurationType> configuration;
try {
Expand All @@ -81,6 +77,9 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
relationRegistry.applyRelationsConfiguration(configuration.asObjectable());
}

modelService.postInit(initResult);
ManualConnectorInstance.setRandomDelayRange(0);

// Users
userAdministrator = repoAddObjectFromFile(USER_ADMINISTRATOR_FILE, UserType.class, initResult);
repoAddObjectFromFile(ROLE_SUPERUSER_FILE, initResult);
Expand Down

0 comments on commit 634e572

Please sign in to comment.