Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for explicit password fetch. Fix.
- Loading branch information
Showing
7 changed files
with
283 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...oning-impl/src/test/java/com/evolveum/midpoint/provisioning/test/impl/TestDummyExtra.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (c) 2015 Evolveum | ||
* | ||
* Licensed 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. | ||
*/ | ||
package com.evolveum.midpoint.provisioning.test.impl; | ||
|
||
import static org.testng.AssertJUnit.assertEquals; | ||
import static org.testng.AssertJUnit.assertNotNull; | ||
|
||
import org.springframework.test.annotation.DirtiesContext; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.testng.annotations.Test; | ||
|
||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.prism.crypto.EncryptionException; | ||
import com.evolveum.midpoint.provisioning.ucf.impl.ConnectorFactoryIcfImpl; | ||
import com.evolveum.midpoint.schema.GetOperationOptions; | ||
import com.evolveum.midpoint.schema.result.OperationResult; | ||
import com.evolveum.midpoint.test.util.TestUtil; | ||
import com.evolveum.midpoint.util.exception.SchemaException; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; | ||
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType; | ||
|
||
/** | ||
* Almost the same as TestDummy but with some extra things, such as: | ||
* readable password | ||
* | ||
* @author Radovan Semancik | ||
* | ||
*/ | ||
@ContextConfiguration(locations = "classpath:ctx-provisioning-test-main.xml") | ||
@DirtiesContext | ||
public class TestDummyExtra extends TestDummy { | ||
|
||
public static final String TEST_DIR = "src/test/resources/impl/dummy-extra/"; | ||
public static final String RESOURCE_DUMMY_FILENAME = TEST_DIR + "resource-dummy.xml"; | ||
|
||
@Override | ||
protected String getResourceDummyFilename() { | ||
return RESOURCE_DUMMY_FILENAME; | ||
} | ||
|
||
@Override | ||
protected void checkAccountWill(ShadowType shadow, OperationResult result) throws SchemaException, EncryptionException { | ||
super.checkAccountWill(shadow, result); | ||
assertPassword(shadow, "3lizab3th"); | ||
} | ||
|
||
@Test | ||
public void testFakeToEnableDebug() { | ||
|
||
} | ||
|
||
} |
195 changes: 195 additions & 0 deletions
195
provisioning/provisioning-impl/src/test/resources/impl/dummy-extra/resource-dummy.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ 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. | ||
~ 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. | ||
--> | ||
|
||
<resource oid="ef2bc95b-76e0-59e2-86d6-9999dddddddd" | ||
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" | ||
xmlns:mr="http://prism.evolveum.com/xml/ns/public/matching-rule-3" | ||
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance/ef2bc95b-76e0-59e2-86d6-9999dddddddd" | ||
xsi:schemaLocation="http://midpoint.evolveum.com/xml/ns/public/common/common-3 ../../../../../../infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd | ||
http://www.w3.org/2001/XMLSchema ../../../../../../infra/schema/src/test/resources/standard/XMLSchema.xsd"> | ||
|
||
<name>Dummy Resource</name> | ||
<connectorRef oid="will-be-supplied-by-the-test-code"/> | ||
<connectorConfiguration xmlns:icfi="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.icf.dummy/com.evolveum.icf.dummy.connector.DummyConnector" | ||
xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"> | ||
|
||
<icfc:configurationProperties> | ||
<icfi:instanceId></icfi:instanceId> <!-- Default instance --> | ||
<icfi:uselessString>Shiver me timbers!</icfi:uselessString> | ||
<icfi:uselessGuardedString> <!-- Add some whitespace --> | ||
<clearValue>Dead men tell no tales</clearValue> | ||
</icfi:uselessGuardedString> | ||
<icfi:supportValidity>true</icfi:supportValidity> | ||
<icfi:readablePassword>true</icfi:readablePassword> | ||
</icfc:configurationProperties> | ||
|
||
</connectorConfiguration> | ||
<namespace>http://midpoint.evolveum.com/xml/ns/public/resource/instance/ef2bc95b-76e0-59e2-86d6-9999dddddddd</namespace> | ||
<!-- No schema. It should be generated by provisioning on the first use of this resource. --> | ||
<schemaHandling> | ||
<objectType> | ||
<kind>account</kind> | ||
<intent>default</intent> | ||
<displayName>Default Account</displayName> | ||
<default>true</default> | ||
<objectClass>ri:AccountObjectClass</objectClass> | ||
<attribute> | ||
<ref>icfs:name</ref> | ||
<displayName>Username</displayName> | ||
</attribute> | ||
<attribute> | ||
<ref>ri:weapon</ref> | ||
<matchingRule>mr:stringIgnoreCase</matchingRule> | ||
</attribute> | ||
<attribute> | ||
<ref>ri:loot</ref> | ||
<fetchStrategy>explicit</fetchStrategy> | ||
</attribute> | ||
<attribute> | ||
<ref>ri:ship</ref> | ||
<limitations> | ||
<access> | ||
<read>true</read> | ||
<add>true</add> | ||
<modify>true</modify> | ||
</access> | ||
</limitations> | ||
</attribute> | ||
<attribute> | ||
<ref>ri:drink</ref> | ||
<limitations> | ||
<access> | ||
<read>true</read> | ||
<add>false</add> | ||
<modify>true</modify> | ||
</access> | ||
</limitations> | ||
</attribute> | ||
<attribute> | ||
<ref>ri:quote</ref> | ||
<limitations> | ||
<access> | ||
<read>true</read> | ||
<add>true</add> | ||
<modify>false</modify> | ||
</access> | ||
</limitations> | ||
</attribute> | ||
<attribute> | ||
<ref>ri:gossip</ref> | ||
<limitations> | ||
<access> | ||
<read>false</read> | ||
<add>true</add> | ||
<modify>true</modify> | ||
</access> | ||
</limitations> | ||
</attribute> | ||
<attribute> | ||
<ref>ri:water</ref> | ||
<limitations> | ||
<access> | ||
<read>false</read> | ||
<add>false</add> | ||
<modify>false</modify> | ||
</access> | ||
</limitations> | ||
</attribute> | ||
<credentials> | ||
<password> | ||
<fetchStrategy>explicit</fetchStrategy> | ||
</password> | ||
</credentials> | ||
<association> | ||
<ref>ri:group</ref> | ||
<kind>entitlement</kind> | ||
<intent>group</intent> | ||
<direction>objectToSubject</direction> | ||
<associationAttribute>ri:members</associationAttribute> | ||
<valueAttribute>icfs:name</valueAttribute> | ||
</association> | ||
<association> | ||
<ref>ri:priv</ref> | ||
<kind>entitlement</kind> | ||
<intent>privilege</intent> | ||
<direction>subjectToObject</direction> | ||
<associationAttribute>ri:privileges</associationAttribute> | ||
<valueAttribute>icfs:name</valueAttribute> | ||
</association> | ||
<protected> | ||
<icfs:name>root</icfs:name> | ||
</protected> | ||
<protected> | ||
<icfs:name>daemon</icfs:name> | ||
</protected> | ||
<protected> | ||
<filter> | ||
<q:equal> | ||
<q:path> | ||
declare namespace icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"; | ||
attributes/icfs:name | ||
</q:path> | ||
<q:value>daviejones</q:value> | ||
</q:equal> | ||
</filter> | ||
</protected> | ||
<protected> | ||
<filter> | ||
<q:substring> | ||
<q:path> | ||
declare namespace icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"; | ||
attributes/icfs:name | ||
</q:path> | ||
<q:value>X</q:value> | ||
<q:anchorStart>true</q:anchorStart> | ||
</q:substring> | ||
</filter> | ||
</protected> | ||
<protected> | ||
<filter> | ||
<q:substring> | ||
<q:path> | ||
declare namespace icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"; | ||
attributes/icfs:name | ||
</q:path> | ||
<q:value>-adm</q:value> | ||
<q:anchorEnd>true</q:anchorEnd> | ||
</q:substring> | ||
</filter> | ||
</protected> | ||
</objectType> | ||
<objectType> | ||
<kind>entitlement</kind> | ||
<intent>group</intent> | ||
<default>true</default> | ||
<objectClass>ri:GroupObjectClass</objectClass> | ||
</objectType> | ||
<objectType> | ||
<kind>entitlement</kind> | ||
<intent>privilege</intent> | ||
<default>false</default> | ||
<objectClass>ri:CustomprivilegeObjectClass</objectClass> | ||
</objectType> | ||
</schemaHandling> | ||
<consistency> | ||
<avoidDuplicateValues>true</avoidDuplicateValues> | ||
</consistency> | ||
</resource> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters