-
Notifications
You must be signed in to change notification settings - Fork 761
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #632 from internetarchive/groovy-config
Add Groovy crawl configs
- Loading branch information
Showing
11 changed files
with
852 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
49 changes: 49 additions & 0 deletions
49
commons/src/test/java/org/archive/spring/PathSharingContextTest.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,49 @@ | ||
package org.archive.spring; | ||
|
||
import org.junit.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class PathSharingContextTest { | ||
@Test | ||
public void testGroovyConfig() { | ||
testConfig("groovy", "classpath:org/archive/spring/PathSharingContextTestBeans.groovy"); | ||
} | ||
|
||
@Test | ||
public void testXmlConfig() { | ||
testConfig("xml", "classpath:org/archive/spring/PathSharingContextTestBeans.cxml"); | ||
} | ||
|
||
private static void testConfig(String name, String configPath) { | ||
try (var context = new PathSharingContext(configPath)) { | ||
context.validate(); | ||
assertTrue("should be no validation errors", context.getAllErrors().isEmpty()); | ||
assertEquals("primaryConfiguationPath should be correct", configPath, context.getPrimaryConfigurationPath()); | ||
Bean1 bean1 = context.getBean("bean1", Bean1.class); | ||
Bean2 bean2 = context.getBean("bean2", Bean2.class); | ||
assertNotNull("bean1 should not be null", bean1); | ||
assertNotNull("bean2 should not be null", bean2); | ||
assertEquals("bean1.name should be set", name, bean1.name); | ||
assertEquals("bean1 should be autowired into bean2", bean1, bean2.bean1); | ||
} | ||
} | ||
|
||
public static class Bean1 { | ||
private String name; | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} | ||
|
||
public static class Bean2 { | ||
private Bean1 bean1; | ||
|
||
@Autowired | ||
public void setBean1(Bean1 bean1) { | ||
this.bean1 = bean1; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
commons/src/test/resources/org/archive/spring/PathSharingContextTestBeans.cxml
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,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | ||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> | ||
|
||
<context:annotation-config/> | ||
|
||
<bean id="bean1" class="org.archive.spring.PathSharingContextTest$Bean1"> | ||
<property name="name" value="xml"/> | ||
</bean> | ||
<bean id="bean2" class="org.archive.spring.PathSharingContextTest$Bean2"/> | ||
</beans> |
8 changes: 8 additions & 0 deletions
8
commons/src/test/resources/org/archive/spring/PathSharingContextTestBeans.groovy
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,8 @@ | ||
import org.archive.spring.PathSharingContextTest | ||
|
||
beans { | ||
bean1(PathSharingContextTest.Bean1) { | ||
name = "groovy" | ||
} | ||
bean2(PathSharingContextTest.Bean2) | ||
} |
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
Oops, something went wrong.