forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
2 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
36 changes: 36 additions & 0 deletions
36
...ions-impl/impl/src/test/org/sakaiproject/citation/impl/BaseConfigureationServiceTest.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,36 @@ | ||
package org.sakaiproject.citation.impl; | ||
|
||
import junit.framework.TestCase; | ||
import org.w3c.dom.Document; | ||
import org.xml.sax.SAXException; | ||
|
||
import javax.xml.parsers.DocumentBuilder; | ||
import javax.xml.parsers.DocumentBuilderFactory; | ||
import javax.xml.parsers.ParserConfigurationException; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class BaseConfigureationServiceTest extends TestCase { | ||
|
||
public void testParseXml() throws ParserConfigurationException, IOException, SAXException { | ||
// This is a small test of the configuration parsing developed when upgrading the xstream library. | ||
BaseConfigurationService configurationService = new BaseConfigurationService(); | ||
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); | ||
domFactory.setNamespaceAware(false); | ||
DocumentBuilder builder = domFactory.newDocumentBuilder(); | ||
Document document = builder.parse(getClass().getResourceAsStream("config-example.xml")); | ||
configurationService.saveServletClientMappings(document); | ||
|
||
Map<String, List<Map<String, String>>> saveciteClients = configurationService.getSaveciteClients(); | ||
assertEquals(1, saveciteClients.size()); | ||
List<Map<String, String>> en = saveciteClients.get("en"); | ||
assertNotNull(en); | ||
Map<String, String> first = en.get(0); | ||
assertNotNull(first); | ||
assertEquals("Test", first.get("test")); | ||
assertEquals("saveciteClients", first.get("id")); | ||
|
||
|
||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
citations/citations-impl/impl/src/test/org/sakaiproject/citation/impl/config-example.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,11 @@ | ||
<map id="saveciteClients"> | ||
<entry> | ||
<string>en</string> | ||
<list> | ||
<map> | ||
<entry><string>id</string><string>saveciteClients</string></entry> | ||
<entry><string>test</string><string>Test</string></entry> | ||
</map> | ||
</list> | ||
</entry> | ||
</map> |
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