Módosítások

Attribute Conversion for eduGAIN

4 919 bájt hozzáadva, 2008. szeptember 5., 14:16
Testing
== Testing ==
=== XMLTest.sh ===
Attribute conversion library comes with XML-based test framework.Please consult The test can be invoked by the <code>net.geant.edugain.attributes.xmltest.AttributeConverterTest</code> main class. '''Also there is the <code>XMLTest.sh startup </code> script and attached to the files in project, which makes it easy to execute the testing framework.'''  $ ./XMLTest.sh Attribute Converter Test usage java AttributeConverterTest [-debug] [-converterconfig AttributeConverter.xml] [-attributenameconfig AttributeNameMapping.xml] [-output output.xml] input.xml  === Example test configuration ===The <code>xmltest/ </code> directorycontaines the following example '''<code>AttributeNameMapper.xml</code> converter name mapper configuration'''<source lang="xml"><?xml version="1.0" encoding="UTF-8"?><AttributeMapper xmlns='urn:geant:edugain:attribute-mapper:1.0'>  <AttributeDefinition Id="mail" AttributeName="urn:mace:dir:attribute-def:mail"> <Attribute AttributeName="urn:oid:0.9.2342.19200300.100.1.3" /> </AttributeDefinition>  <AttributeDefinition Id="edupersonAffiliation" AttributeName="urn:mace:dir:attribute-def:eduPersonAffiliation" />  <AttributeDefinition Id="homeOrganization" AttributeName="urn:mace:dir:attribute-def:homeOrganization" />  <AttributeDefinition Id="cn" AttributeName="urn:mace:dir:attribute-def:cn"> <Attribute AttributeName="urn:oid:2.5.4.3"/> </AttributeDefinition></AttributeMapper></source>  '''<code>AttributeConverter.xml</code> converter configuration'''<source lang="xml"><?xml version="1.0" encoding="UTF-8"?><AttributeConverter xmlns='urn:geant:edugain:attribute-converter:1.0'> <BasicRule> <Description>Create static attribute</Description> <Attribute attributeName="eduPersonAffiliation" replaceValues="false"> <AttributeValue>staff@niif.hu</AttributeValue> </Attribute> </BasicRule> <BasicRule> <Description>Create static attribute for some remote providers</Description> <Condition> <RemoteProviderMatch>^urn:geant:edugain:be:[^:]+\.hu$</RemoteProviderMatch> </Condition> <Attribute attributeName="homeOrganization"> <AttributeValue>niif.hu</AttributeValue> </Attribute> </BasicRule> <MergeRule> <Description>Merges the common name to the email address(es)</Description> <InputAttribute attributeName="cn" /> <InputAttribute attributeName="mail" /> <Attribute attributeName="mail" replaceValues="true"> <AttributeValue>${cn} &lt;${mail}&gt;</AttributeValue> </Attribute> </MergeRule></AttributeConverter></source> '''<code>AttributeTest.xml</code> test input xml'''<source lang="xml"><?xml version="1.0" encoding="UTF-8"?><AttributeTest xmlns='urn:geant:edugain:attribute-test:1.0' Remote="urn:geant:edugain:be:niif.hu" > <Attribute AttributeName="urn:oid:0.9.2342.19200300.100.1.3"> <AttributeValue>adam.lantos@niif.hu</AttributeValue> <AttributeValue>hege@niif.hu</AttributeValue> </Attribute> <Attribute AttributeName="urn:mace:dir:attribute-def:eduPersonAffiliation"> <AttributeValue>staff</AttributeValue> </Attribute> <Attribute AttributeName="urn:oid:2.5.4.3"> <AttributeValue>Adam Lantos</AttributeValue> </Attribute></AttributeTest></source> === Output of the example ===  $ ./XMLTest.sh \ -converterconfig xmltest/AttributeConverter.xml \ -attributenameconfig xmltest/AttributeNameMapper.xml \ xmltest/AttributeTest.xml AttributeConverter.<init> (80) : Creating new rule: class net.geant.edugain.attributes.rules.BasicRule AttributeConverter.<init> (81) : Rule Description: Create static attribute AttributeConverter.<init> (80) : Creating new rule: class net.geant.edugain.attributes.rules.BasicRule AttributeConverter.<init> (81) : Rule Description: Create static attribute for some remote providers AttributeConverter.<init> (80) : Creating new rule: class net.geant.edugain.attributes.rules.MergeRule AttributeConverter.<init> (81) : Rule Description: Merges the common name to the email address(es) <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AttributeTest xmlns="urn:geant:edugain:attribute-test:1.0"> <Attribute AttributeName="urn:mace:dir:attribute-def:eduPersonAffiliation"> <AttributeValue>staff</AttributeValue> <AttributeValue>staff@niif.hu</AttributeValue> </Attribute> <Attribute AttributeName="urn:mace:dir:attribute-def:mail"> <AttributeValue>Adam Lantos &amp;lt;adam.lantos@niif.hu&amp;gt;</AttributeValue> <AttributeValue>Adam Lantos &amp;lt;hege@niif.hu&amp;gt;</AttributeValue> </Attribute> <Attribute AttributeName="urn:mace:dir:attribute-def:homeOrganization"> <AttributeValue>niif.hu</AttributeValue> </Attribute> <Attribute AttributeName="urn:mace:dir:attribute-def:cn"> <AttributeValue>Adam Lantos</AttributeValue> </Attribute> </AttributeTest> 
=== Real-life examples ===
==== Example attribute mapper file ====
==== Example attribute converter file ====
565
szerkesztés

Navigációs menü