Skip to content

Commit

Permalink
SAK-43021
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Buckett authored and bjones86 committed Jan 17, 2020
1 parent 4a4886a commit 4add14c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion citations/citations-impl/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
<version>1.4.11.1</version>
</dependency>
<dependency>
<groupId>backport-util-concurrent</groupId>
Expand Down
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"));


}
}
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>
2 changes: 1 addition & 1 deletion edu-services/gradebook-service/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.2.1</version>
<version>1.4.11.1</version>
</dependency>
</dependencies>
</project>

0 comments on commit 4add14c

Please sign in to comment.