Basically all you really need is to make sure that the spring resources are on the build path when you're tests run.
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<!-- <exclude>**/*.java</exclude> -->
</excludes>
</testResource>
<testResource>
<directory>../consultantreg-config/references/default</directory>
</testResource>
</testResources>
</build>
Then, in your actual junit test, make sure you have it properly annotated:
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/applicationContext-common.xml"})
public class IntegrationTestsSomeJdbcDao {
Tuesday, February 8, 2011
Wednesday, January 19, 2011
Inluding multiple javascript files via javascript
The problem is typical: How can I include a javascript library or multiple .js files with only 1 javascript include.
Basically, here's a quick sample using jquery, though obviously it can be done without it.
js1.js {
$('head').ready(function() {
$('head').append('<script language="JavaScript"
type="text/javascript" src="http://javascriptFile2.js"></script>');
});
$('head').ready(function() {
$('head').append('<script language="JavaScript"
type="text/javascript" src="javascriptFile3"></script>');
});
}
That's all there is to it. Now javascriptFile3 can access the methods of javasriptFile2.
Subscribe to:
Posts (Atom)