Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jan 9, 2015
2 parents e0ccb2a + 0c66eb3 commit 35bed36
Show file tree
Hide file tree
Showing 14 changed files with 592 additions and 100 deletions.
Expand Up @@ -409,7 +409,6 @@ private SystemConfigurationType saveNotificationConfiguration(SystemConfiguratio
NotificationConfigurationDto dto;
NotificationConfigurationType notificationConfig;
MailConfigurationType mailConfig;
MailServerConfigurationType mailServerConfig;

if(systemConfigPanel != null && systemConfigPanel.getModel().getObject().getNotificationConfig() != null){
dto = systemConfigPanel.getModel().getObject().getNotificationConfig();
Expand Down Expand Up @@ -442,6 +441,8 @@ private SystemConfigurationType saveNotificationConfiguration(SystemConfiguratio
ProtectedStringType pass = new ProtectedStringType();
pass.setClearValue(serverDto.getPassword());
newConfig.setPassword(pass);
} else {
newConfig.setPassword(serverDto.getOldConfig().getPassword());
}

mailConfig.getServer().add(newConfig);
Expand Down
Expand Up @@ -25,6 +25,7 @@
import com.evolveum.midpoint.web.util.InfoTooltipBehavior;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MailTransportSecurityType;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
Expand Down Expand Up @@ -144,6 +145,18 @@ public String getIdValue(MailServerConfigurationTypeDto object, int index) {

@Override
protected void onUpdate(AjaxRequestTarget target) {
PasswordTextField passwordField = (PasswordTextField)get(ID_MAIN_FORM + ":" + ID_MAIL_SERVER_CONFIG_CONTAINER + ":" + ID_PASSWORD);

if(getModelObject() != null){
if(getModelObject().getNotificationConfig().getSelectedServer() != null &&
getModelObject().getNotificationConfig().getSelectedServer().getPassword() != null){

passwordField.add(new AttributeModifier("placeholder", createStringResource("SystemConfigPanel.mail.password.placeholder.set")));
} else {
passwordField.add(new AttributeModifier("placeholder", createStringResource("SystemConfigPanel.mail.password.placeholder.empty")));
}
}

target.add(SystemConfigPanel.this);
}
});
Expand Down Expand Up @@ -175,16 +188,6 @@ public boolean isVisible() {
PasswordTextField passwordField = new PasswordTextField(ID_PASSWORD, new PropertyModel<String>(getModel(), "notificationConfig.selectedServer.password"));
passwordField.setRequired(false);

if(getModelObject() != null){
if(getModelObject().getNotificationConfig().getSelectedServer() != null &&
getModelObject().getNotificationConfig().getSelectedServer().getPassword() != null){

passwordField.add(new AttributeAppender("placeholder", createStringResource("SystemConfigPanel.mail.password.placeholder.set")));
} else {
passwordField.add(new AttributeAppender("placeholder", createStringResource("SystemConfigPanel.mail.password.placeholder.empty")));
}
}

TextField<String> redirectToFileField = new TextField<>(ID_REDIRECT_TO_FILE, new PropertyModel<String>(getModel(), "notificationConfig.redirectToFile"));

DropDownFormGroup transportSecurity = new DropDownFormGroup<>(ID_TRANSPORT_SECURITY, new PropertyModel<MailTransportSecurityType>(getModel(),
Expand Down
Expand Up @@ -32,6 +32,7 @@ public class MailServerConfigurationTypeDto implements Serializable {
public static final String F_PASSWORD = "password";
public static final String F_MAIL_TRANSPORT_SECURITY_TYPE = "mailTransportSecurityType";

private MailServerConfigurationType oldConfig;
private String host;
private Integer port;
private String username;
Expand All @@ -42,6 +43,7 @@ public MailServerConfigurationTypeDto(){}

public MailServerConfigurationTypeDto(MailServerConfigurationType config){

oldConfig = config;
host = config.getHost();
port = config.getPort();
username = config.getUsername();
Expand Down Expand Up @@ -95,15 +97,24 @@ public void setMailTransportSecurityType(MailTransportSecurityType mailTransport
this.mailTransportSecurityType = mailTransportSecurityType;
}

public MailServerConfigurationType getOldConfig() {
return oldConfig;
}

public void setOldConfig(MailServerConfigurationType oldConfig) {
this.oldConfig = oldConfig;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!(o instanceof MailServerConfigurationTypeDto)) return false;

MailServerConfigurationTypeDto that = (MailServerConfigurationTypeDto) o;

if (host != null ? !host.equals(that.host) : that.host != null) return false;
if (mailTransportSecurityType != that.mailTransportSecurityType) return false;
if (oldConfig != null ? !oldConfig.equals(that.oldConfig) : that.oldConfig != null) return false;
if (password != null ? !password.equals(that.password) : that.password != null) return false;
if (port != null ? !port.equals(that.port) : that.port != null) return false;
if (username != null ? !username.equals(that.username) : that.username != null) return false;
Expand All @@ -113,7 +124,8 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
int result = host != null ? host.hashCode() : 0;
int result = oldConfig != null ? oldConfig.hashCode() : 0;
result = 31 * result + (host != null ? host.hashCode() : 0);
result = 31 * result + (port != null ? port.hashCode() : 0);
result = 31 * result + (username != null ? username.hashCode() : 0);
result = 31 * result + (password != null ? password.hashCode() : 0);
Expand Down
Expand Up @@ -18,6 +18,7 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;

import javax.xml.namespace.QName;
Expand Down Expand Up @@ -397,6 +398,33 @@ protected void copyValues(ResourceAttributeContainer clone) {
// Nothing to copy
}


@Override
public void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw,
ConsistencyCheckScope scope) {
super.checkConsistenceInternal(rootItem, requireDefinitions, prohibitRaw, scope);
List<PrismContainerValue> values = getValues();
if (values == null) {
throw new IllegalStateException("Null values in ResourceAttributeContainer");
}
if (values.isEmpty()) {
return;
}
if (values.size() > 1) {
throw new IllegalStateException(values.size()+" values in ResourceAttributeContainer, expected just one");
}
PrismContainerValue value = values.get(0);
List<Item<?>> items = value.getItems();
if (items == null) {
throw new IllegalStateException("Null items in ResourceAttributeContainer");
}
for (Item item: items) {
if (!(item instanceof ResourceAttribute)) {
throw new IllegalStateException("Found illegal item in ResourceAttributeContainer: "+item+" ("+item.getClass()+")");
}
}
}

/**
* Return a human readable name of this class suitable for logs.
*/
Expand Down
Expand Up @@ -620,14 +620,17 @@ public static void assertAttribute(SearchResultEntry response, String name, Stri
for (String value: values) {
boolean found = false;
Iterator<AttributeValue> iterator = attribute.iterator();
List<String> attrVals = new ArrayList<String>();
while (iterator.hasNext()) {
AttributeValue attributeValue = iterator.next();
if (attributeValue.toString().equals(value)) {
String attrVal = attributeValue.toString();
attrVals.add(attrVal);
if (attrVal.equals(value)) {
found = true;
}
}
if (!found) {
AssertJUnit.fail("Attribute "+name+" does not contain value "+value);
AssertJUnit.fail("Attribute "+name+" does not contain value "+value+", it has values: "+attrVals);
}
}
}
Expand Down
Expand Up @@ -246,6 +246,7 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra
public static final String ACCOUNT_SHADOW_GUYBRUSH_DUMMY_FILENAME = COMMON_DIR + "/account-shadow-guybrush-dummy.xml";
public static final String ACCOUNT_SHADOW_GUYBRUSH_OID = "22226666-2200-6666-6666-444400004444";
public static final String ACCOUNT_GUYBRUSH_DUMMY_USERNAME = "guybrush";
public static final String ACCOUNT_GUYBRUSH_DUMMY_FULLNAME = "Guybrush Threepwood";
public static final File ACCOUNT_GUYBRUSH_DUMMY_FILE = new File (COMMON_DIR, "account-guybrush-dummy.xml");
public static final String ACCOUNT_GUYBRUSH_DUMMY_RED_FILENAME = COMMON_DIR + "/account-guybrush-dummy-red.xml";

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2015 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -113,10 +113,11 @@ public void test050AddResource() throws Exception {

@Test
public void test100ModifyUserAddAccount() throws Exception {
TestUtil.displayTestTile(this, "test100ModifyUserAddAccount");
final String TEST_NAME = "test100ModifyUserAddAccount";
TestUtil.displayTestTile(this, TEST_NAME);

// GIVEN
Task task = taskManager.createTaskInstance(TestModelCrudService.class.getName() + ".test100ModifyUserAddAccount");
Task task = taskManager.createTaskInstance(TestModelCrudService.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);

Expand Down

0 comments on commit 35bed36

Please sign in to comment.