Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAK-50754 sitearchive Cleanup some code and add unit tests #13106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions common/archive-impl/impl2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,51 @@
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>sakai-kernel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources />
<testResources>
<testResource>
<directory>${basedir}/src/webapp</directory>
</testResource>
<testResource>
<directory>${basedir}/src/test/resources</directory>
</testResource>
</testResources>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public String archive(String siteId, String m_storagePath, String fromSystem)

dir.mkdirs();

// for each registered ResourceService, give it a chance to archve
// for each registered EntityProducer, give it a chance to archive
Collection<EntityProducer> producers = m_entityManager.getEntityProducers();
for (EntityProducer producer : producers) {
if (producer == null) continue;
Expand Down Expand Up @@ -248,8 +248,8 @@ public String archive(String siteId, String m_storagePath, String fromSystem)
results.append("<===== End =====>\n\n");

stack.pop();
Xml.writeDocument(doc, m_storagePath + siteId + "-archive/site.xml");

Xml.writeDocument(doc, m_storagePath + siteId + "-archive/site.xml");

// *** Users
doc = Xml.createDocument();
Expand Down Expand Up @@ -293,14 +293,13 @@ public String archive(String siteId, String m_storagePath, String fromSystem)


/**
* Archive the site definition.
* @param site the site.
* @param doc The document to contain the xml.
* @param stack The stack of elements, the top of which will be the containing
* element of the "site" element.
*/

protected String archiveSite(Site site, Document doc, Stack stack, String fromSystem)
* Archive the site definition.
* @param site the site.
* @param doc The document to contain the xml.
* @param stack The stack of elements, the top of which will be the containing
* element of the "site" element.
*/
private String archiveSite(Site site, Document doc, Stack stack, String fromSystem)
{
Element element = doc.createElement(SiteService.APPLICATION_ID);
((Element)stack.peek()).appendChild(element);
Expand All @@ -322,7 +321,7 @@ protected String archiveSite(Site site, Document doc, Stack stack, String fromSy

if ( pattern != null ) {
NodeList nl = siteNode.getElementsByTagName("property");
List<Element> toRemove = new ArrayList<Element>();
List<Element> toRemove = new ArrayList<>();

for(int i = 0; i < nl.getLength(); i++) {
Element proptag = (Element)nl.item(i);
Expand Down Expand Up @@ -397,11 +396,11 @@ protected String archiveSite(Site site, Document doc, Stack stack, String fromSy
}
catch(Exception any)
{
log.warn("archve: exception archiving site: {}: {}", site.getId(), any);
log.warn("Exception archiving site: {}: {}", site.getId(), any.toString());
}

stack.pop();

return "archiving Site: " + site.getId() + "\n";

} // archiveSite
Expand Down
Loading
Loading