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 Apr 26, 2023
2 parents 0bf70e3 + 721830a commit 008bbb2
Show file tree
Hide file tree
Showing 13 changed files with 114 additions and 144 deletions.
File renamed without changes.
2 changes: 0 additions & 2 deletions gui/admin-gui/src/frontend/js/vendors.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import '../../../node_modules/select2/dist/js/select2';

import '../../../node_modules/sparklines';

import './passwords';

import '../../../node_modules/ace-builds/src-noconflict/ace';

ace.config.setModuleUrl('ace/theme/eclipse',
Expand Down
13 changes: 13 additions & 0 deletions gui/admin-gui/src/frontend/scss/vendors-fonts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*!
* Copyright (C) 2010-2023 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

@import "../../../node_modules/@fontsource/source-sans-pro/300.css";
@import "../../../node_modules/@fontsource/source-sans-pro/400.css";
@import "../../../node_modules/@fontsource/source-sans-pro/400-italic.css";
@import "../../../node_modules/@fontsource/source-sans-pro/700.css";

@import "../../../node_modules/@fortawesome/fontawesome-free/css/all.css";
6 changes: 0 additions & 6 deletions gui/admin-gui/src/frontend/scss/vendors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@
*/
@import "../../../node_modules/flag-icons/css/flag-icons.css";

@import "../../../node_modules/@fontsource/source-sans-pro/300.css";
@import "../../../node_modules/@fontsource/source-sans-pro/400.css";
@import "../../../node_modules/@fontsource/source-sans-pro/400-italic.css";
@import "../../../node_modules/@fontsource/source-sans-pro/700.css";

@import "midpoint-variables";

@import "../../../node_modules/admin-lte/build/scss/adminlte";
@import "../../../node_modules/overlayscrollbars/css/OverlayScrollbars.css";
@import "../../../node_modules/@fortawesome/fontawesome-free/css/all.css";
@import "../../../node_modules/datatables.net-bs4/css/dataTables.bootstrap4";

@import "../../../node_modules/bootstrap-select/dist/css/bootstrap-select.css";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
import java.util.List;
import java.util.Objects;

import com.evolveum.midpoint.gui.api.page.PageAdminLTE;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;

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

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ajax.AjaxChannel;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand All @@ -26,18 +20,26 @@
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.form.PasswordTextField;
import org.apache.wicket.model.*;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.Url;
import org.apache.wicket.request.resource.UrlResourceReference;
import org.apache.wicket.validation.IValidatable;
import org.apache.wicket.validation.IValidator;
import org.apache.wicket.validation.ValidationError;
import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.authentication.api.util.AuthUtil;
import com.evolveum.midpoint.gui.api.page.PageAdminLTE;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.model.api.validator.StringLimitationResult;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.security.api.MidPointPrincipal;
Expand All @@ -46,6 +48,11 @@
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.prism.InputPanel;
import com.evolveum.midpoint.web.component.util.EnableBehaviour;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsPolicyType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ValuePolicyType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;

/**
Expand Down Expand Up @@ -87,6 +94,13 @@ public <F extends FocusType> PasswordPanel(String id, IModel<ProtectedStringType
initLayout();
}

@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);

response.render(JavaScriptHeaderItem.forReference(new UrlResourceReference(Url.parse("static/vendors-passwords.js")).setContextRelative(true)));
}

@Override
protected void onInitialize() {
super.onInitialize();
Expand Down Expand Up @@ -217,7 +231,6 @@ private String getPasswordMatched(String password1, String password2) {
return "";
}


protected boolean canEditPassword() {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

<link href="css/font-evosome.css" type="text/css" rel="stylesheet"/>

<link type="text/css" rel="stylesheet" href="static/vendors-fonts.css"/>
<link type="text/css" rel="stylesheet" href="static/vendors.css"/>
<link type="text/css" rel="stylesheet" href="static/midpoint.css"/>
<link type="text/css" rel="stylesheet" href="css/overlay.css"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ public void onComponentTag(ComponentTag tag, ResourceUrlProvider resourceUrlProv
}

String newUrl = resourceUrlProvider.getForLookupPath("/" + url);
newUrl = newUrl.substring(1);
if (newUrl != null) {
newUrl = newUrl.substring(1);
} else {
newUrl = url;
}

tag.put(attributeName, newUrl);
tag.setModified(true);
Expand Down
6 changes: 6 additions & 0 deletions gui/admin-gui/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ module.exports = {
'./src/frontend/js/vendors.js',
'./src/frontend/scss/vendors.scss',
],
"vendors-passwords": [
'./src/frontend/js/vendors-passwords.js',
],
"vendors-fonts": [
'./src/frontend/scss/vendors-fonts.scss',
],
midpoint: [
'./src/frontend/js/midpoint.js',
'./src/frontend/scss/midpoint.scss',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
import static org.testng.AssertJUnit.assertNotNull;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Collections;
import java.util.Date;
import javax.xml.datatype.XMLGregorianCalendar;

import com.evolveum.midpoint.prism.polystring.PolyString;

import com.evolveum.midpoint.test.TestTask;

import com.evolveum.midpoint.util.exception.CommonException;

import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -25,7 +30,6 @@
import com.evolveum.midpoint.model.test.CommonInitialObjects;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.util.PrismAsserts;
import com.evolveum.midpoint.prism.util.PrismTestUtil;
import com.evolveum.midpoint.prism.xml.XmlTypeConverter;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
Expand All @@ -42,19 +46,18 @@ public abstract class AbstractInboundSyncTest extends AbstractInitializedModelIn

public static final File TEST_DIR = new File("src/test/resources/sync");

protected static final File TASK_LIVE_SYNC_DUMMY_EMERALD_FILE = new File(TEST_DIR, "task-dummy-emerald-livesync.xml");
protected static final String TASK_LIVE_SYNC_DUMMY_EMERALD_OID = "10000000-0000-0000-5555-55550000e404";
static final TestTask TASK_LIVE_SYNC_DUMMY_EMERALD = TestTask.file(
TEST_DIR, "task-dummy-emerald-livesync.xml", "10000000-0000-0000-5555-55550000e404");
static final TestTask TASK_RECON_DUMMY_EMERALD = TestTask.file(
TEST_DIR, "task-dummy-emerald-recon.xml", "10000000-0000-0000-5656-56560000e404");

protected static final File TASK_RECON_DUMMY_EMERALD_FILE = new File(TEST_DIR, "task-dummy-emerald-recon.xml");
protected static final String TASK_RECON_DUMMY_EMERALD_OID = "10000000-0000-0000-5656-56560000e404";
static final String ACCOUNT_MANCOMB_DUMMY_USERNAME = "mancomb";
static final Date ACCOUNT_MANCOMB_VALID_FROM_DATE = MiscUtil.asDate(2011, 2, 3, 4, 5, 6);
static final Date ACCOUNT_MANCOMB_VALID_TO_DATE = MiscUtil.asDate(2066, 5, 4, 3, 2, 1);

protected static final String ACCOUNT_MANCOMB_DUMMY_USERNAME = "mancomb";
protected static final Date ACCOUNT_MANCOMB_VALID_FROM_DATE = MiscUtil.asDate(2011, 2, 3, 4, 5, 6);
protected static final Date ACCOUNT_MANCOMB_VALID_TO_DATE = MiscUtil.asDate(2066, 5, 4, 3, 2, 1);
private static final String ACCOUNT_POSIXUSER_DUMMY_USERNAME = "posixuser";

protected static final String ACCOUNT_POSIXUSER_DUMMY_USERNAME = "posixuser";

protected long timeBeforeSync;
private long timeBeforeSync;

@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
Expand All @@ -66,28 +69,14 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
}
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);

getSyncTask().init(this, initTask, initResult);
runSyncTask(initResult); // necessary e.g. for live sync to obtain initial token (for recon should be idempotent)
}

@Override
protected File getResourceDummyEmeraldFile() {
return RESOURCE_DUMMY_EMERALD_FILE;
}

protected abstract void importSyncTask(PrismObject<ResourceType> resource) throws FileNotFoundException;

protected abstract String getSyncTaskOid(PrismObject<ResourceType> resource);

protected int getWaitTimeout() {
return DEFAULT_TASK_WAIT_TIMEOUT;
}

@Test
public void test100ImportLiveSyncTaskDummyEmerald() throws Exception {
when();
importSyncTask(resourceDummyEmerald);
abstract TestTask getSyncTask();

then();
waitForSyncTaskStart(resourceDummyEmerald);
void runSyncTask(OperationResult result) throws CommonException {
getSyncTask().rerun(result);
}

@Test
Expand Down Expand Up @@ -115,7 +104,7 @@ public void test110AddDummyEmeraldAccountMancomb() throws Exception {

dummyResourceEmerald.addAccount(account);

waitForSyncTaskNextRun(resourceDummyEmerald);
runSyncTask(getTestOperationResult());

// THEN
then();
Expand Down Expand Up @@ -161,7 +150,7 @@ public void test120ModifyDummyEmeraldAccountMancombSeepbad() throws Exception {

displayValue("Modified dummy account", account.debugDump());

waitForSyncTaskNextRun(resourceDummyEmerald);
runSyncTask(getTestOperationResult());

// THEN
then();
Expand All @@ -185,7 +174,7 @@ public void test120ModifyDummyEmeraldAccountMancombSeepbad() throws Exception {

assertLinked(userAfter, accountAfter);

PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PrismTestUtil.createPolyString("Mancomb Seepbad"));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PolyString.fromOrig("Mancomb Seepbad"));

assertUsers(7);

Expand All @@ -211,7 +200,7 @@ public void test122ModifyDummyEmeraldAccountMancombSeepNULL() throws Exception {

displayValue("Modified dummy account", account.debugDump());

waitForSyncTaskNextRun(resourceDummyEmerald);
runSyncTask(getTestOperationResult());

// THEN
then();
Expand Down Expand Up @@ -261,7 +250,7 @@ public void test124ModifyDummyEmeraldAccountMancombSeepevil() throws Exception {

displayValue("Modified dummy account", account.debugDump());

waitForSyncTaskNextRun(resourceDummyEmerald);
runSyncTask(getTestOperationResult());

// THEN
then();
Expand All @@ -285,7 +274,7 @@ public void test124ModifyDummyEmeraldAccountMancombSeepevil() throws Exception {

assertLinked(userAfter, accountAfter);

PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PrismTestUtil.createPolyString("Mancomb Seepevil"));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PolyString.fromOrig("Mancomb Seepevil"));

assertUsers(7);

Expand All @@ -311,7 +300,7 @@ public void test126ModifyDummyEmeraldAccountMancombTitlePirate() throws Exceptio

displayValue("Modified dummy account", account.debugDump());

waitForSyncTaskNextRun(resourceDummyEmerald);
runSyncTask(getTestOperationResult());

// THEN
then();
Expand All @@ -335,8 +324,8 @@ public void test126ModifyDummyEmeraldAccountMancombTitlePirate() throws Exceptio

assertLinked(userAfter, accountAfter);

PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PrismTestUtil.createPolyString("Mancomb Seepevil"));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_TITLE, PrismTestUtil.createPolyString("Pirate"));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PolyString.fromOrig("Mancomb Seepevil"));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_TITLE, PolyString.fromOrig("Pirate"));

assertUsers(7);

Expand All @@ -362,7 +351,7 @@ public void test127ModifyDummyEmeraldAccountMancombTitlePirateNull() throws Exce

displayValue("Modified dummy account", account.debugDump());

waitForSyncTaskNextRun(resourceDummyEmerald);
runSyncTask(getTestOperationResult());

// THEN
then();
Expand All @@ -386,7 +375,7 @@ public void test127ModifyDummyEmeraldAccountMancombTitlePirateNull() throws Exce

assertLinked(userAfter, accountAfter);

PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PrismTestUtil.createPolyString("Mancomb Seepevil"));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PolyString.fromOrig("Mancomb Seepevil"));
PrismAsserts.assertNoItem(userAfter, UserType.F_TITLE);

assertUsers(7);
Expand All @@ -413,7 +402,7 @@ public void test129ModifyDummyEmeraldAccountMancombSeepgood() throws Exception {

displayValue("Modified dummy account", account.debugDump());

waitForSyncTaskNextRun(resourceDummyEmerald);
runSyncTask(getTestOperationResult());

// THEN
then();
Expand All @@ -437,7 +426,7 @@ public void test129ModifyDummyEmeraldAccountMancombSeepgood() throws Exception {

assertLinked(userAfter, accountAfter);

PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PrismTestUtil.createPolyString("Mancomb Seepgood"));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PolyString.fromOrig("Mancomb Seepgood"));

assertUsers(7);

Expand Down Expand Up @@ -478,7 +467,7 @@ public void test300AddDummyEmeraldAccountPosixUser() throws Exception {

dummyResourceEmerald.addAccount(account);

waitForSyncTaskNextRun(resourceDummyEmerald);
runSyncTask(getTestOperationResult());

// THEN
then();
Expand Down Expand Up @@ -525,7 +514,7 @@ public void test310ModifyDummyEmeraldAccountPosixUserUidNumber() throws Exceptio

displayValue("Modified dummy account", account.debugDump());

waitForSyncTaskNextRun(resourceDummyEmerald);
runSyncTask(getTestOperationResult());

// THEN
then();
Expand Down Expand Up @@ -553,19 +542,12 @@ public void test310ModifyDummyEmeraldAccountPosixUserUidNumber() throws Exceptio
// TODO create and test inbounds for uid and gid numbers; also other attributes
}

protected void waitForSyncTaskStart(PrismObject<ResourceType> resource) throws Exception {
waitForTaskStart(getSyncTaskOid(resource), false, getWaitTimeout());
}

protected void waitForSyncTaskNextRun(PrismObject<ResourceType> resource) throws Exception {
waitForTaskNextRunAssertSuccess(getSyncTaskOid(resource), false, getWaitTimeout());
}

protected void rememberTimeBeforeSync() {
void rememberTimeBeforeSync() {
timeBeforeSync = System.currentTimeMillis();
}

protected void assertShadowOperationalData(PrismObject<ShadowType> shadow, SynchronizationSituationType expectedSituation) {
@SuppressWarnings("SameParameterValue")
private void assertShadowOperationalData(PrismObject<ShadowType> shadow, SynchronizationSituationType expectedSituation) {
ShadowType shadowType = shadow.asObjectable();
SynchronizationSituationType actualSituation = shadowType.getSynchronizationSituation();
assertEquals("Wrong situation in shadow " + shadow, expectedSituation, actualSituation);
Expand Down

0 comments on commit 008bbb2

Please sign in to comment.