Drop that line since $class should refer to a java class not a nucleus
component path.
-- Adam
1)
2)
3)
4)
5)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ATG_Tech" group.
To post to this group, send email to atg_...@googlegroups.com
To unsubscribe from this group, send email to
atg_tech-u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/atg_tech?hl=en
-~----------~----~----~----~------~----~------~--~---
If you use a subclass of ATgDustCase then the following snippet copies
.propertes files from your "source" configpath (typically your module) into
the configpath of the test.
@Override
public void setUp() throws Exception {
super.setUp();
File configDir = NucleusTestUtils.getConfigpath(this.getClass(),
"config");
// make sure all needed files are at the config location.
// "target/test-classes/config" is then prompoted to the configuration
// directory.
copyConfigurationFiles(new String[] {
"C:/ATG/ATG2007.1/MyModule/config/"
}, configDir.getAbsolutePath(), new String[] {
".svn"
});
}
Let's say you need ProfileTools, and ProductCatalog. You'll also need those
.properties files and their dependencies to be in your configpath.
In my example above, the "configpath" for my test is returned by the method:
NucleusTestUtils.getConfigpath(this.getClass(), "config");
In your case, that directory would have to include
atg/userprofiling/ProfileTools, atg/commerce/catalog/ProductCatalog etc...
Do you have those files setup to be copied?
Can your MealDeliveryManager component be broken down into smaller chunks
that could be tested without as many dependencies?
BTW it was atg.nucleus.InitialService
Also I typically have a different "configpath" for each test class:
File configDir = NucleusTestUtils.getConfigpath(this.getClass(),
"config");
The "Class" passed as the first argument should be used to construct the
directory name. That way you don't have multiple tests stepping on each
other.
You're right though it doesn't clean up the configpath dir. You could do
that in the tearDown() method in junit.
Maybe try a really simple test just to confirm that you can resolve some of
those components you need.
For example:
public class MyDustCaseTest extends AtgDustCase {
private File mConfigDir = null;
@Override
public void setUp() throws Exception {
super.setUp();
mConfigDir = NucleusTestUtils.getConfigpath(this.getClass(), "config");
// make sure all needed files are at the config location.
copyConfigurationFiles(new String[] {
"C:/ATG/ATG2007.1/MyModule/config/"
}, mConfigDir.getAbsolutePath(), new String[] {
".svn"
});
}
@Override
public void tearDown() throws Exception {
super.tearDown();
}
public void testComponentResolution() throws Exception {
ProfileTools ptools =
resolveNucleusComponent("/atg/userprofiling/ProfileTools");
assertNotNull(ptools);
}
-----Original Message-----
From: atg_...@googlegroups.com [mailto:atg_...@googlegroups.com] On Behalf
Of trak3r
Sent: Tuesday, July 15, 2008 10:31 AM
To: ATG_Tech
Thanks for the help.
--~--~---------~--~----~------------~-------~--~----~