You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(7) |
Nov
|
Dec
(22) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Blake B. <bbi...@kn...> - 2009-03-11 23:42:47
|
I'm trying to setup a test case that tests a service. When I call NucleusTestUtils.startNucleus(configpath) I get the follow exception in the unit test report: testDoStartService (com.knowlysis.atg.svc.migration.test.ServiceMigrationTest) Time elapsed: 0.083 sec <<< ERROR! java.util.MissingResourceException: Can't find bundle for base name atg.service.ServiceResources, locale en_US at java .util.ResourceBundle.throwMissingResourceException(ResourceBundle.java: 836) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805) at java.util.ResourceBundle.getBundle(ResourceBundle.java:549) at com .knowlysis .atg .svc .migration .test .ServiceMigrationTest.testDoStartService(ServiceMigrationTest.java:36) I have created an atg/service/ServiceResources.properties file and have that file being copied into the config path. Anybody had any luck getting resource bundles loaded? Blake Bigelow Knowlysis Sr. Software Engineer bbi...@kn... (801) 224-0002 ext 111 cell: (801) 787-3641 |
|
From: Belmont, A. <ad...@at...> - 2008-07-27 18:43:49
|
DUST 0.6 was posted today. The main change from 0.5 has really just been some bug fixing and some recent updates for testing formhandlers. If you are using dust from svn and building it with Maven, the default pom.xml dependencies have been updated to 2007.1p1. To make it a little less of a hassle to update maven repository decencies there is now a bin/mavenInstall.bat script. This invokes maven to install maven dependencies for DAS/classes.jar and DAS/resource.jar. There's also a new article here on formhandler testing since there have been so many questions lately. http://atgdust.sourceforge.net/formhandler-test.html -- Adam |
|
From: Belmont, A. <ad...@at...> - 2008-07-27 02:14:19
|
Here's an example. It's still a work in progress I'll check it in/ post a new build and update the tutorials once it's a littler cleaner. It should get you a basic idea. -- Adam _____ From: atg...@li... [mailto:atg...@li...] On Behalf Of Padmini Rupert Sent: Thursday, July 24, 2008 6:01 AM To: atg...@li... Subject: [atgdust-general] FormHandler Test Hi All, I would like to write a ATGDustTestCase for testing a FormHandler. where i need to set the request Can you please help me for the same. Regards Padmini |
|
From: Belmont, A. <ad...@at...> - 2008-07-24 18:17:15
|
I just responded to someone else asking the same thing on atg_tech so take a peek there. Yes, form handlers are the toughest bits to test. Ideally form handlers should be very thin wrapper code to call into business logic. That business logic should then have its own set of tests thus making the form handler level test less important. If you are writing new form handlers, *don't put business logic into form handlers*. I know that's not always possible but it really should be a major design goal. However this is often code that doesn't follow this practice (ATG is guilty of it too) so you get stuck with business logic in the form handler that needs testing. Anyway, look at my last post about using the ServletTestUtils class. It'll get your part of the way there. http://atgdust.sourceforge.net/servlet-test.html -- Adam _____ From: atg...@li... [mailto:atg...@li...] On Behalf Of Anand Raman Sent: Thursday, July 24, 2008 10:07 AM To: atg...@li...; atg...@go... Subject: [atgdust-general] Testing form handlers using ATG Dust hi all, We are trying to write test cases for ATG form handlers. We are using ATG Dust for most of the repository and component testing. However we have issues with testing form handlers. (I could be wrong) Out of the box ATGDust doesn't provide any support for testing form handlers. We also find testing form handlers cumbersome because the form handlers can contain significant business logic inter twined with http request / response objects. I could deal with this limitation by abstracting all the business operations to a service layer; however the challenge still remains when we extend an ATG form handler like RepositoryFormHandler. Does the community have any strategies on how to unit test the form handlers. I am attaching a sample class which I would like to test out. Thanks anand ps: Sorry for the cross post. the number of subscribers on ATGDust forum didnt give me enough confidence. |
|
From: Padmini R. <pad...@gm...> - 2008-07-24 10:00:48
|
Hi All, I would like to write a ATGDustTestCase for testing a FormHandler. where i need to set the request Can you please help me for the same. Regards Padmini |
|
From: Adam B. <abe...@gm...> - 2008-03-07 17:11:07
|
I'm sorry for the extra email. I needed to test a posting. -- Adam |
|
From: Robert H. <ro...@zo...> - 2008-03-04 21:02:19
|
Hi, just my two cents... AtgDustCase only overrides Junit's tearDown method. I guess I could make AtgDustCase test runner/test framework independent, if there is a desire for it. With regard to multiple configuration dirs... In AtgDustCase there is a method called "copyConfigurationFiles" with the following javadoc: "Every *.properties file copied using this method will have it's scope (if one is available) set to global. Parameters: srcDirs One or more directories containing needed configuration files. dstDir where to copy the above files to. This will also be the configuration location. excludes One or more directories not to include during the copy process. Use this one to speeds up the test cycle considerably. You can also call it with an empty String[] or null if nothing should be excluded" At my work I use this method to copy config files and repos definitions from various locations on my filesystem to a single staging directory and then I use this staging directory as the configpath. In AtgDustCase there is also there is a prepareRepository method that accepts multiple repository definition files. gr, --Robert http://bsdroot.com On 4 Mar, 2008, at 21:27, Belmont, Adam wrote: > Hi Witkow, > Thanks J > That wasn’t in the list of plans, but it’s a good idea. We really > aren’t that tightly coupled to junit so it would be nicer to make > dust more unit test framework independent. > Today you could do some very basic Nucleus testing with TestNG since > non of the classes extend Junit (You probably already know this > though) > > For example, I could see this first-test example being almost > exactly the same on testng (or any other framework). > http://atgdust.sourceforge.net/first-test.html > > The ATGDustCase http://atgdust.sourceforge.net/atgdustcase.html and > GSATest classes are the problems. But again I think they are easy to > split out. > I’ll take a look at it. > > Have you gotten anything to work on your own? > > As for multiple definitions: > The tests use a single config directory just to keep things simple. > It would take a code change to NucleusTestUtils to add an overloaded > method that takes an array of config dirs so it’s more like a > traditional configpath. > Also we didn’t want to point the test configpath directly at an ATG > installation. Let’s say we started up a test with the full > configpath for DCS. > Since Nucleus is really starting, it’ll actually try to start up all > of Commerce inside the test. Chances are that not all dependencies > will be available (SQLJMS, who knows what else) and of course it’ll > take a long time to start up. > > You can combine multiple repository definition files by setting them > as a property on a repository. > > definitionFiles=definitionOne.xml,definitionTwo.xml > > The “definitionFiles” property on a GSARepository is of type > XMLFile. This class does “xml combination” so it is actually the one > with the logic for adding together multiple files. > Perhaps if your test repository just sets the definitionFiles > property to the list of definition files that would work for you? > > Taking this test as an example: > http://atgdust.sourceforge.net/xref-test/test/ > SimpleRepositoryTest.html > > Note how “definitionFiles” is an array: > // Define the path to our repository definition file called > 49 // "simpleRepository.xml" > 50 final String[] definitionFiles = { "/test/ > simpleRepository.xml" }; > 51 log.info(" definitionFile[0]=" + definitionFiles[0]); > 52 > 53 // Copy all related properties and definition files to the > previously > 54 // configured configpath > 55 FileUtil.copyDirectory("src/test/resources/config", > configpath.getPath(), Arrays > 56 .asList(new String[] { ".svn" })); > 57 > 58 // Use the DBUtils utility class to get JDBC properties for > an in memory > 59 // HSQL DB called "testdb". > 60 Properties props = > DBUtils.getHSQLDBInMemoryDBConnection("testdb"); > 61 > 62 // Start up our database > 63 DBUtils db = initDB(props); > 64 > 65 boolean rollback = true; > 66 > 67 // Setup our testing configpath > 68 // RH: disabled logging (last argument to false) to get rid > of the double > 69 // logging statements > 70 > GSATestUtils.getGSATestUtils().initializeMinimalConfigpath(configpath, > 71 "/SimpleRepository", definitionFiles, props, null, null, > null, false); > > > You should be able to just have multiple entries in there and those > multiple entries will get combined. > -- Adam > > From: atg...@li... [mailto:atg...@li... > ] On Behalf Of Milosz Witkowski > Sent: Tuesday, March 04, 2008 2:56 PM > To: atg...@li... > Subject: [Atgdust-general] Any plans for TestNG > > Hi, > Project is really great , but you know that. > Do you have any plans to make it TestNG compatible and get rid off > JUnit dependency ? > Looks like only few classes extends TestCase. > > Additionally I have a question. > Is there a possibility to test repositories that have multiple > definitions like productCatalog from Commerce? > I saw that you initialize Nucleus using only one config path, so you > ignore configuration layers, is it for purpose? > > Best Regards > Witkow > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________ > Atgdust-general mailing list > Atg...@li... > https://lists.sourceforge.net/lists/listinfo/atgdust-general |
|
From: Belmont, A. <ad...@at...> - 2008-03-04 20:29:41
|
Hi Witkow, Thanks :-) That wasn't in the list of plans, but it's a good idea. We really aren't that tightly coupled to junit so it would be nicer to make dust more unit test framework independent. Today you could do some very basic Nucleus testing with TestNG since non of the classes extend Junit (You probably already know this though) For example, I could see this first-test example being almost exactly the same on testng (or any other framework). http://atgdust.sourceforge.net/first-test.html The ATGDustCase http://atgdust.sourceforge.net/atgdustcase.html and GSATest classes are the problems. But again I think they are easy to split out. I'll take a look at it. Have you gotten anything to work on your own? As for multiple definitions: The tests use a single config directory just to keep things simple. It would take a code change to NucleusTestUtils to add an overloaded method that takes an array of config dirs so it's more like a traditional configpath. Also we didn't want to point the test configpath directly at an ATG installation. Let's say we started up a test with the full configpath for DCS. Since Nucleus is really starting, it'll actually try to start up all of Commerce inside the test. Chances are that not all dependencies will be available (SQLJMS, who knows what else) and of course it'll take a long time to start up. You can combine multiple repository definition files by setting them as a property on a repository. definitionFiles=definitionOne.xml,definitionTwo.xml The "definitionFiles" property on a GSARepository is of type XMLFile. This class does "xml combination" so it is actually the one with the logic for adding together multiple files. Perhaps if your test repository just sets the definitionFiles property to the list of definition files that would work for you? Taking this test as an example: http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html Note how "definitionFiles" is an array: // Define the path to our repository definition file called 49 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#49> // "simpleRepository.xml" 50 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#50> final String[] definitionFiles = { "/test/simpleRepository.xml" }; 51 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#51> log.info(" definitionFile[0]=" + definitionFiles[0]); 52 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#52> 53 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#53> // Copy all related properties and definition files to the previously 54 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#54> // configured configpath 55 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#55> FileUtil.copyDirectory("src/test/resources/config", configpath.getPath(), Arrays 56 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#56> .asList(new String[] { ".svn" })); 57 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#57> 58 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#58> // Use the DBUtils utility class to get JDBC properties for an in memory 59 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#59> // HSQL DB called "testdb". 60 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#60> Properties props = DBUtils.getHSQLDBInMemoryDBConnection("testdb"); 61 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#61> 62 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#62> // Start up our database 63 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#63> DBUtils db = initDB(props); 64 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#64> 65 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#65> boolean rollback = true; 66 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#66> 67 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#67> // Setup our testing configpath 68 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#68> // RH: disabled logging (last argument to false) to get rid of the double 69 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#69> // logging statements 70 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#70> GSATestUtils.getGSATestUtils().initializeMinimalConfigpath(configpath, 71 <http://atgdust.sourceforge.net/xref-test/test/SimpleRepositoryTest.html#71> "/SimpleRepository", definitionFiles, props, null, null, null, false); You should be able to just have multiple entries in there and those multiple entries will get combined. -- Adam _____ From: atg...@li... [mailto:atg...@li...] On Behalf Of Milosz Witkowski Sent: Tuesday, March 04, 2008 2:56 PM To: atg...@li... Subject: [Atgdust-general] Any plans for TestNG Hi, Project is really great , but you know that. Do you have any plans to make it TestNG compatible and get rid off JUnit dependency ? Looks like only few classes extends TestCase. Additionally I have a question. Is there a possibility to test repositories that have multiple definitions like productCatalog from Commerce? I saw that you initialize Nucleus using only one config path, so you ignore configuration layers, is it for purpose? Best Regards Witkow |
|
From: Milosz W. <wi...@gm...> - 2008-03-04 19:56:14
|
Hi, Project is really great , but you know that. Do you have any plans to make it TestNG compatible and get rid off JUnit dependency ? Looks like only few classes extends TestCase. Additionally I have a question. Is there a possibility to test repositories that have multiple definitions like productCatalog from Commerce? I saw that you initialize Nucleus using only one config path, so you ignore configuration layers, is it for purpose? Best Regards Witkow |
|
From: Ted D. <tr...@gm...> - 2007-12-10 02:36:32
|
Thanks for the notes on mocking. I'm hopeful that I don't have to go down that route -- all the other dependencies are loading fine, it's just user profile that borks -- probably some special-case since it's probably expecting to get the logged-in user out of the session or some such. On Dec 9, 2007 7:58 PM, Belmont, Adam <ad...@at...> wrote: > > > > > Also, if you do go down the dynamic mock object route you'll have to use > something like this since Profile isn't an interface, it's a concrete class. > > http://www.jmock.org/mocking-classes.html > > > > > > ________________________________ > > > From: atg...@li... > [mailto:atg...@li...] On Behalf Of Belmont, > Adam > Sent: Sunday, December 09, 2007 7:01 PM > To: Robert Hellwig; atg...@li... > > > Subject: Re: [Atgdust-general] User Profile Dependencies > > > > > > Hi, > You might also want to just put a "mock" version of > atg.userprofiling.Profile into Nucleus once it's up and running. > > > You can use atg.nucleus.NucleusTestUtils to add a component to Nucleus once > it's already running. > That's handy for cases when you just need to stick in mock objects and > don't want to go through the effort of .properties files. > > Here's some sample code. > Also you might want to check out some mock objects api like: > http://www.jmock.org/index.html > > Profile p = new Mock(Profile.class); // I'm assuming you are using > something like dynamock or jmock above. > > // Now add the component into Nucleus > > NucleusTestUtils.addComponent(Nucleus.getGlobalNucleus(),"/atg/userprofiling/Profile",p); > > Profile p2 = > Nucleus.getGlobalNucleus().resolveName("/atg/userprofiling/Profile"); > > // At this point p == p2 > > > Another alternative to a dynamic mock objects is to sub class > atg.userprofile.Profile and make your own "mock" version for testing. > Profile testingProfile = new MyTestingProfile(); > > NucleusTestUtils.addComponent(Nucleus.getGlobalNucleus(),"/atg/userprofiling/Profile",testingProfile); > > Hope this helps... > > -- Adam > > -- Adam > > > > -----Original Message----- > From: atg...@li... on behalf of Robert > Hellwig > Sent: Sun 12/9/2007 3:03 PM > To: atg...@li... > Subject: Re: [Atgdust-general] User Profile Dependencies > > Hello, > > I just find and grep'ed through the atg2007.1 installation directory > but couldn't see the /atg/userprofiling/Profile service. But there is > a thing called /userProfile which has as config /atg/userprofiling/ > userProfile.xml. The following code snippet shows you how to setup a > test using the /userProfile: > > // make sure all needed files are at the config location > copyConfigurationFiles(new String[] { "config" }, "target/test- > classes/config", ".svn"); > prepareRepository("/userProfile", "/atg/userprofiling/ > userProfile.xml"); > userProfileRepository = (MutableRepository) > resolveNucleusComponent("/userProfile"); > > If you need some files to setup your environment, have a look at the > ATG2007.1 installation directory. I guess you could setup a minimal > test /userProfile by using some of the files in there (especially > have a look at the files in the MotorpriseJSP and PioneerCyclingJSP > directories) and strip them down until they are workable for you. > > > Or of course you really mean /atg/userprofiling/Profile service but in > hat case I have no clue how to help you. > > > gr, > > --Robert > > > > On 9 Dec, 2007, at 20:18, Ted Davis wrote: > > > In my nucleus component properties file I have to following injection: > > > > profile=/atg/userprofiling/Profile > > > > When I start the test I see the following service start: > > > > **** info Sun Dec 09 14:10:36 EST 2007 1197227436827 / > Creating > > service "/atg/userprofiling/Profile" > > **** Error Sun Dec 09 14:10:36 EST 2007 1197227436827 / > Unable to set > > configured property "/widget/diet/util/MeasurementsManager.profile" > > atg.nucleus.ConfigurationException: Unable to resolve component > > /atg/userprofiling/Profile > > > > > > Any ideas why it might not be able to resolve that component? > > > > Also, since this is a mock environment and there's no user profile > > inherently available, how might I go about creating one for my tests > > to reference at run time? > > > > Thanks! :-) > > > > ------------------------------------------------------------------------- > > SF.Net email is sponsored by: > > Check out the new SourceForge.net Marketplace. > > It's the best place to buy or sell services for > > just about anything Open Source. > > http://sourceforge.net/services/buy/index.php > > _______________________________________________ > > Atgdust-general mailing list > > Atg...@li... > > https://lists.sourceforge.net/lists/listinfo/atgdust-general > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Atgdust-general mailing list > Atg...@li... > https://lists.sourceforge.net/lists/listinfo/atgdust-general > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Atgdust-general mailing list > Atg...@li... > https://lists.sourceforge.net/lists/listinfo/atgdust-general > > |
|
From: Ted D. <tr...@gm...> - 2007-12-10 02:32:14
|
On Dec 9, 2007 3:03 PM, Robert Hellwig <ro...@zo...> wrote: > Hello, > > I just find and grep'ed through the atg2007.1 installation directory > but couldn't see the /atg/userprofiling/Profile service. Sorry, I neglected to mention I'm on 2006.3 :-( > Or of course you really mean /atg/userprofiling/Profile service but in > hat case I have no clue how to help you. Hey, oh well :-) The component I'm testing is expecting the user profile of the currently logged-in user to be injected; that's what I'm trying to figure out how to accomplish. Thanks. |
|
From: Belmont, A. <ad...@at...> - 2007-12-10 00:59:02
|
Also, if you do go down the dynamic mock object route you'll have to use something like this since Profile isn't an interface, it's a concrete class. http://www.jmock.org/mocking-classes.html _____ From: atg...@li... [mailto:atg...@li...] On Behalf Of Belmont, Adam Sent: Sunday, December 09, 2007 7:01 PM To: Robert Hellwig; atg...@li... Subject: Re: [Atgdust-general] User Profile Dependencies Hi, You might also want to just put a "mock" version of atg.userprofiling.Profile into Nucleus once it's up and running. You can use atg.nucleus.NucleusTestUtils to add a component to Nucleus once it's already running. That's handy for cases when you just need to stick in mock objects and don't want to go through the effort of .properties files. Here's some sample code. Also you might want to check out some mock objects api like: http://www.jmock.org/index.html Profile p = new Mock(Profile.class); // I'm assuming you are using something like dynamock or jmock above. // Now add the component into Nucleus NucleusTestUtils.addComponent(Nucleus.getGlobalNucleus(),"/atg/userprofiling /Profile",p); Profile p2 = Nucleus.getGlobalNucleus().resolveName("/atg/userprofiling/Profile"); // At this point p == p2 Another alternative to a dynamic mock objects is to sub class atg.userprofile.Profile and make your own "mock" version for testing. Profile testingProfile = new MyTestingProfile(); NucleusTestUtils.addComponent(Nucleus.getGlobalNucleus(),"/atg/userprofiling /Profile",testingProfile); Hope this helps... -- Adam -- Adam -----Original Message----- From: atg...@li... on behalf of Robert Hellwig Sent: Sun 12/9/2007 3:03 PM To: atg...@li... Subject: Re: [Atgdust-general] User Profile Dependencies Hello, I just find and grep'ed through the atg2007.1 installation directory but couldn't see the /atg/userprofiling/Profile service. But there is a thing called /userProfile which has as config /atg/userprofiling/ userProfile.xml. The following code snippet shows you how to setup a test using the /userProfile: // make sure all needed files are at the config location copyConfigurationFiles(new String[] { "config" }, "target/test- classes/config", ".svn"); prepareRepository("/userProfile", "/atg/userprofiling/ userProfile.xml"); userProfileRepository = (MutableRepository) resolveNucleusComponent("/userProfile"); If you need some files to setup your environment, have a look at the ATG2007.1 installation directory. I guess you could setup a minimal test /userProfile by using some of the files in there (especially have a look at the files in the MotorpriseJSP and PioneerCyclingJSP directories) and strip them down until they are workable for you. Or of course you really mean /atg/userprofiling/Profile service but in hat case I have no clue how to help you. gr, --Robert On 9 Dec, 2007, at 20:18, Ted Davis wrote: > In my nucleus component properties file I have to following injection: > > profile=/atg/userprofiling/Profile > > When I start the test I see the following service start: > > **** info Sun Dec 09 14:10:36 EST 2007 1197227436827 / Creating > service "/atg/userprofiling/Profile" > **** Error Sun Dec 09 14:10:36 EST 2007 1197227436827 / Unable to set > configured property "/widget/diet/util/MeasurementsManager.profile" > atg.nucleus.ConfigurationException: Unable to resolve component > /atg/userprofiling/Profile > > > Any ideas why it might not be able to resolve that component? > > Also, since this is a mock environment and there's no user profile > inherently available, how might I go about creating one for my tests > to reference at run time? > > Thanks! :-) > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Atgdust-general mailing list > Atg...@li... > https://lists.sourceforge.net/lists/listinfo/atgdust-general ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Atgdust-general mailing list Atg...@li... https://lists.sourceforge.net/lists/listinfo/atgdust-general |
|
From: Belmont, A. <ad...@at...> - 2007-12-10 00:01:28
|
Hi, You might also want to just put a "mock" version of = atg.userprofiling.Profile into Nucleus once it's up and running. You can use atg.nucleus.NucleusTestUtils to add a component to Nucleus = once it's already running. That's handy for cases when you just need to stick in mock objects and = don't want to go through the effort of .properties files. Here's some sample code.=20 Also you might want to check out some mock objects api like: http://www.jmock.org/index.html Profile p =3D new Mock(Profile.class); // I'm assuming you are using = something like dynamock or jmock above. // Now add the component into Nucleus NucleusTestUtils.addComponent(Nucleus.getGlobalNucleus(),"/atg/userprofil= ing/Profile",p); Profile p2 =3D = Nucleus.getGlobalNucleus().resolveName("/atg/userprofiling/Profile"); // At this point p =3D=3D p2 Another alternative to a dynamic mock objects is to sub class = atg.userprofile.Profile and make your own "mock" version for testing. Profile testingProfile =3D new MyTestingProfile(); NucleusTestUtils.addComponent(Nucleus.getGlobalNucleus(),"/atg/userprofil= ing/Profile",testingProfile); Hope this helps... -- Adam -- Adam -----Original Message----- From: atg...@li... on behalf of Robert = Hellwig Sent: Sun 12/9/2007 3:03 PM To: atg...@li... Subject: Re: [Atgdust-general] User Profile Dependencies =20 Hello, I just find and grep'ed through the atg2007.1 installation directory =20 but couldn't see the /atg/userprofiling/Profile service. But there is =20 a thing called /userProfile which has as config /atg/userprofiling/=20 userProfile.xml. The following code snippet shows you how to setup a =20 test using the /userProfile: // make sure all needed files are at the config location copyConfigurationFiles(new String[] { "config" }, "target/test-=20 classes/config", ".svn"); prepareRepository("/userProfile", "/atg/userprofiling/=20 userProfile.xml"); userProfileRepository =3D (MutableRepository) =20 resolveNucleusComponent("/userProfile"); If you need some files to setup your environment, have a look at the =20 ATG2007.1 installation directory. I guess you could setup a minimal =20 test /userProfile by using some of the files in there (especially =20 have a look at the files in the MotorpriseJSP and PioneerCyclingJSP =20 directories) and strip them down until they are workable for you. Or of course you really mean /atg/userprofiling/Profile service but in =20 hat case I have no clue how to help you. gr, --Robert On 9 Dec, 2007, at 20:18, Ted Davis wrote: > In my nucleus component properties file I have to following injection: > > profile=3D/atg/userprofiling/Profile > > When I start the test I see the following service start: > > **** info Sun Dec 09 14:10:36 EST 2007 1197227436827 / Creating > service "/atg/userprofiling/Profile" > **** Error Sun Dec 09 14:10:36 EST 2007 1197227436827 / Unable to set > configured property "/widget/diet/util/MeasurementsManager.profile" > atg.nucleus.ConfigurationException: Unable to resolve component > /atg/userprofiling/Profile > > > Any ideas why it might not be able to resolve that component? > > Also, since this is a mock environment and there's no user profile > inherently available, how might I go about creating one for my tests > to reference at run time? > > Thanks! :-) > > = -------------------------------------------------------------------------= > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Atgdust-general mailing list > Atg...@li... > https://lists.sourceforge.net/lists/listinfo/atgdust-general -------------------------------------------------------------------------= SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Atgdust-general mailing list Atg...@li... https://lists.sourceforge.net/lists/listinfo/atgdust-general |
|
From: Robert H. <ro...@zo...> - 2007-12-09 20:03:52
|
Hello,
I just find and grep'ed through the atg2007.1 installation directory
but couldn't see the /atg/userprofiling/Profile service. But there is
a thing called /userProfile which has as config /atg/userprofiling/
userProfile.xml. The following code snippet shows you how to setup a
test using the /userProfile:
// make sure all needed files are at the config location
copyConfigurationFiles(new String[] { "config" }, "target/test-
classes/config", ".svn");
prepareRepository("/userProfile", "/atg/userprofiling/
userProfile.xml");
userProfileRepository = (MutableRepository)
resolveNucleusComponent("/userProfile");
If you need some files to setup your environment, have a look at the
ATG2007.1 installation directory. I guess you could setup a minimal
test /userProfile by using some of the files in there (especially
have a look at the files in the MotorpriseJSP and PioneerCyclingJSP
directories) and strip them down until they are workable for you.
Or of course you really mean /atg/userprofiling/Profile service but in
hat case I have no clue how to help you.
gr,
--Robert
On 9 Dec, 2007, at 20:18, Ted Davis wrote:
> In my nucleus component properties file I have to following injection:
>
> profile=/atg/userprofiling/Profile
>
> When I start the test I see the following service start:
>
> **** info Sun Dec 09 14:10:36 EST 2007 1197227436827 / Creating
> service "/atg/userprofiling/Profile"
> **** Error Sun Dec 09 14:10:36 EST 2007 1197227436827 / Unable to set
> configured property "/widget/diet/util/MeasurementsManager.profile"
> atg.nucleus.ConfigurationException: Unable to resolve component
> /atg/userprofiling/Profile
>
>
> Any ideas why it might not be able to resolve that component?
>
> Also, since this is a mock environment and there's no user profile
> inherently available, how might I go about creating one for my tests
> to reference at run time?
>
> Thanks! :-)
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Atgdust-general mailing list
> Atg...@li...
> https://lists.sourceforge.net/lists/listinfo/atgdust-general
|
|
From: Ted D. <tr...@gm...> - 2007-12-09 19:18:38
|
In my nucleus component properties file I have to following injection: profile=/atg/userprofiling/Profile When I start the test I see the following service start: **** info Sun Dec 09 14:10:36 EST 2007 1197227436827 / Creating service "/atg/userprofiling/Profile" **** Error Sun Dec 09 14:10:36 EST 2007 1197227436827 / Unable to set configured property "/widget/diet/util/MeasurementsManager.profile" atg.nucleus.ConfigurationException: Unable to resolve component /atg/userprofiling/Profile Any ideas why it might not be able to resolve that component? Also, since this is a mock environment and there's no user profile inherently available, how might I go about creating one for my tests to reference at run time? Thanks! :-) |
|
From: Ted D. <tr...@gm...> - 2007-12-09 18:55:04
|
Assuming it will prevent me from getting the error below :-) I'm running off trunk and using the in-memory database. Thanks. **** info Sun Dec 09 13:51:05 EST 2007 1197226265407 /widget/diet/DietRepository Dropping tables because 'dropTablesAtShutdown' is true.... **** error Sun Dec 09 13:51:05 EST 2007 1197226265409 /widget/diet/DietRepository null java.lang.ArrayIndexOutOfBoundsException: 1 at atg.adapter.gsa.TableColumns.createIdColumns(Table.java:3822) at atg.adapter.gsa.TableColumns.<init>(Table.java:3591) at atg.adapter.gsa.Table.generateSQL(Table.java:1044) at atg.adapter.gsa.Table.generateSQL(Table.java:1063) at atg.adapter.gsa.InitializingGSA.getCreateStatements(InitializingGSA.java:804) at atg.adapter.gsa.InitializingGSA.dropTables(InitializingGSA.java:605) at atg.adapter.gsa.InitializingGSA.doStopService(InitializingGSA.java:572) at atg.nucleus.GenericService.stopService(GenericService.java:533) at atg.nucleus.GenericContext.doStopService(GenericContext.java:405) at atg.nucleus.GenericService.stopService(GenericService.java:533) at atg.nucleus.GenericContext.doStopService(GenericContext.java:405) at atg.nucleus.GenericService.stopService(GenericService.java:533) at atg.nucleus.GenericContext.doStopService(GenericContext.java:405) at atg.test.AtgDustCase.tearDown(AtgDustCase.java:336) |
|
From: Ted D. <tr...@gm...> - 2007-12-09 01:40:26
|
Thanks! I'm getting closer. Not quite there yet, but closer. I see
Nucleus starting and the repository loading, but I can't instantiate
my component now. I don't understand my problems well enough yet to
form a coherent question so I'll dig a little deeper before reaching
out again :-)
On Dec 8, 2007 12:16 PM, Robert Hellwig <ro...@zo...> wrote:
> Hi,
>
> If you want to test against an existing db you must provide a
> properties instance with some values:
>
> final Properties properties = new Properties();
> properties.put("driver", "com.mysql.jdbc.Driver");
> properties.put("url", "jdbc:mysql://localhost:3306/someDb");
> properties.put("user", "someUserName");
> properties.put("password", "somePassword");
>
>
> If you want to test against an in-memory db you can use the
> prepareRepository(final String repoPath, final String...
> definitionFiles).
>
> I changed your test case slightly (I don't have your component class,
> repos definitions, etc, etc), so that it works against an example
> repository which you can find if you checkout atgdust ( svn checkout https://atgdust.svn.sourceforge.net/svnroot/atgdust
> atgdust). BTW the code below run's against the trunk of AtgDust.
> You can find the output below the changed test code.
>
> HTH
>
> gr,
>
> --Robert
>
>
> import java.io.File;
> import java.util.Properties;
>
> import atg.test.AtgDustCase;
>
> public class MeasurementsManagerTest extends AtgDustCase {
>
> @Override
> public void setUp() throws Exception {
> try {
> String componentBeingTested = "/widgets/diet/util/
> MeasurementsManager";
> String[] sourceDirectories = { "config" };
> String destinationDirectory = "dust";
> String[] exclusionPatterns = { ".svn" };
> // copyConfigurationFiles(sourceDirectories,
> destinationDirectory,
> // exclusionPatterns);
>
> copyConfigurationFiles(new String[] { "src/test/resources/config"
> .replace("/", File.separator) }, "target/test-classes/config"
> .replace("/", File.separator), ".svn");
>
> createPropertyFile(destinationDirectory, componentBeingTested,
> Object.class);
>
> String repositoryPath = "/widgets/diet/DietRepository";
> Properties connectionProperties = new Properties();
> boolean dropTable = false;
> String definitionFile = repositoryPath + ".xml";
>
> // prepareRepository(repositoryPath, connectionProperties,
> dropTable,
> // definitionFile);
>
> prepareRepository("/GettingStarted/SongsRepository",
> "/GettingStarted/songs.xml");
>
> // MeasurementsManager measurementsManager =
> (MeasurementsManager)
> // resolveNucleusComponent(componentBeingTested);
> // measurementsManager.setMeasurementFormShown(true);
> // measurementsManager.saveMeasurements();
> }
> catch (Throwable t) {
> t.printStackTrace();
> }
> }
>
> public void testRepository() throws Exception {
> assertNotNull(resolveNucleusComponent("/GettingStarted/
> SongsRepository"));
> }
> }
>
> OUTPUT:
> 2007-12-08 18:10:09,619 INFO [atg.test.AtgDustCase]
> [setConfigurationLocation] [Thread:main] - [Using configuration
> location: target/test-classes/config]
> 2007-12-08 18:10:09,623 INFO [atg.test.AtgDustCase]
> [copyConfigurationFiles] [Thread:main] - [Copying configuration files
> and forcing global scope on all configs]
> 2007-12-08 18:10:09,675 INFO
> [atg.test.configuration.RepositoryConfiguration]
> [createPropertiesByConfigurationLocation] [Thread:main] - [Created
> repository configuration fileset]
> 2007-12-08 18:10:09,696 INFO [atg.test.util.RepositoryManager]
> [initializeMinimalRepositoryConfiguration] [Thread:main] - [Connected
> to 'jdbc:hsqldb:mem:testDb' using driver 'org.hsqldb.jdbcDriver']
> 2007-12-08 18:10:09,696 INFO [atg.test.util.RepositoryManager]
> [createIdGeneratorTables] [Thread:main] - [Re-creating (drop and
> create) DAS_ID_GENERATOR]
> 2007-12-08 18:10:09,961 INFO
> [atg.test.configuration.BasicConfiguration]
> [createPropertiesByConfigurationLocation] [Thread:main] - [Created
> basic configuration fileset]
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810181 /
> atg.nucleus.NucleusResources->nucleusNameResolverCreatingService :
> Creating service "/atg/dynamo/service/logging/ScreenLog"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810201 / ---- Warning:
> there is a reference to: "/atg/dynamo/service/logging/ScreenLog"
> before it is initialized
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810203 /
> atg.nucleus.NucleusResources->nucleusNameResolverStartingService :
> Starting service "/atg/dynamo/service/logging/ScreenLog"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810203 /
> atg.nucleus.NucleusResources->nucleusNameResolverDoneCreatingService :
> Done creating service "/atg/dynamo/service/logging/ScreenLog"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810206 / Creating
> service "/Initial"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810239 / Creating
> service "/atg/dynamo/service/AppServerConfig"
> **** Warning Sat Dec 08 18:10:10 CET 2007 1197133810240 / An attempt
> has been made to use ServletUtil.isDynamoJ2EEServer() before this
> property has been set.
>
> Nucleus running
>
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810241 / Creating
> service "/GettingStarted/SongsRepository"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810677 / Creating
> service "/atg/dynamo/service/jdbc/JTDataSource"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810728 / Creating
> service "/atg/dynamo/service/jdbc/FakeXADataSource"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810741 / Starting
> service "/atg/dynamo/service/jdbc/FakeXADataSource"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810742 / Done creating
> service "/atg/dynamo/service/jdbc/FakeXADataSource"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810743 / Creating
> service "/atg/dynamo/transaction/TransactionManager"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810761 / Starting
> service "/atg/dynamo/transaction/TransactionManager"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810761 / Done creating
> service "/atg/dynamo/transaction/TransactionManager"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810762 / Starting
> service "/atg/dynamo/service/jdbc/JTDataSource"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810771 / Done creating
> service "/atg/dynamo/service/jdbc/JTDataSource"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810771 / Creating
> service "/atg/dynamo/service/IdGenerator"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810785 / Creating
> service "/atg/dynamo/service/xml/XMLToolsFactory"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810800 / Done creating
> service "/atg/dynamo/service/xml/XMLToolsFactory"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810800 / Starting
> service "/atg/dynamo/service/IdGenerator"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810803 / Creating
> service "/atg/dynamo/transaction/TransactionDemarcationLogging"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810806 / Starting
> service "/atg/dynamo/transaction/TransactionDemarcationLogging"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810806 / Done creating
> service "/atg/dynamo/transaction/TransactionDemarcationLogging"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810858 / Done creating
> service "/atg/dynamo/service/IdGenerator"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810859 / Creating
> service "/atg/dynamo/service/ClientLockManager"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810870 / Starting
> service "/atg/dynamo/service/ClientLockManager"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810870 / Done creating
> service "/atg/dynamo/service/ClientLockManager"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810871 / Starting
> service "/GettingStarted/SongsRepository"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810901 / Creating
> service "/atg/registry/RepositoryGroups"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810916 / Done creating
> service "/GettingStarted/SongsRepository"
> **** info Sat Dec 08 18:10:10 CET 2007 1197133810943 /GettingStarted/
> SongsRepository Dropping tables because 'dropTablesAtShutdown' is
> true....
>
>
>
>
>
>
> On 7 Dec, 2007, at 22:00, Ted Davis wrote:
>
> > OK I installed the JARs for the Apache Commons releases of DBCP and
> > Pool.
> >
> > It now compiles and runs... but not successfully.
> >
> > Oddly enough if I comment out the sections that copy the properties
> > file and set up the repository, the test creates the nucleus component
> > successfully but the component eventually fails as none of its
> > dependencies have been injected.
> >
> > If I put the properties file and repository code back in, the nucleus
> > component isn't instantiated. I'm perplexed.
> >
> > Is there a way for me to test or sanity check each of the test set-up
> > methods (createPropertyFile and prepareRepository) to see if they
> > really did what they needed to do?
> >
> > Here's my entire test so far:
> >
> >
> > package com.widgets.diet.util;
> >
> > import java.util.Properties;
> >
> > import atg.test.AtgDustCase;
> >
> > public class MeasurementsManagerTest extends AtgDustCase {
> > public void testSaveMeasurements() throws Exception {
> > try {
> > String componentBeingTested = "/widgets/diet/util/
> > MeasurementsManager";
> > String[] sourceDirectories = { "config" };
> > String destinationDirectory = "dust";
> > String[] exclusionPatterns = { ".svn" };
> > copyConfigurationFiles(sourceDirectories, destinationDirectory,
> > exclusionPatterns);
> >
> > createPropertyFile(destinationDirectory, componentBeingTested,
> > MeasurementsManager.class);
> >
> > String repositoryPath = "/widgets/diet/DietRepository";
> > Properties connectionProperties = new Properties();
> > boolean dropTable = false;
> > String definitionFile = repositoryPath + ".xml";
> > prepareRepository(repositoryPath, connectionProperties, dropTable,
> > definitionFile);
> >
> > MeasurementsManager measurementsManager = (MeasurementsManager)
> > resolveNucleusComponent(componentBeingTested);
> > measurementsManager.setMeasurementFormShown(true);
> > measurementsManager.saveMeasurements();
> > } catch (Throwable t) {
> > t.printStackTrace();
> > }
> > }
> > }
> >
> > -------------------------------------------------------------------------
> > SF.Net email is sponsored by:
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services for
> > just about anything Open Source.
> > http://sourceforge.net/services/buy/index.php
> > _______________________________________________
> > Atgdust-general mailing list
> > Atg...@li...
> > https://lists.sourceforge.net/lists/listinfo/atgdust-general
>
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Atgdust-general mailing list
> Atg...@li...
> https://lists.sourceforge.net/lists/listinfo/atgdust-general
>
|
|
From: Robert H. <ro...@zo...> - 2007-12-08 18:07:46
|
P.S. To actually answer your question, the destination location
specified during the copyConfigurationFiles call will be used by
AtgDust(Case) as a 'staging' directory for all generated property
files. So you can have a look at that directory to see what's being
copied and/or generated.
gr,
--Robert
On 7 Dec, 2007, at 22:00, Ted Davis wrote:
> OK I installed the JARs for the Apache Commons releases of DBCP and
> Pool.
>
> It now compiles and runs... but not successfully.
>
> Oddly enough if I comment out the sections that copy the properties
> file and set up the repository, the test creates the nucleus component
> successfully but the component eventually fails as none of its
> dependencies have been injected.
>
> If I put the properties file and repository code back in, the nucleus
> component isn't instantiated. I'm perplexed.
>
> Is there a way for me to test or sanity check each of the test set-up
> methods (createPropertyFile and prepareRepository) to see if they
> really did what they needed to do?
>
> Here's my entire test so far:
>
>
> package com.widgets.diet.util;
>
> import java.util.Properties;
>
> import atg.test.AtgDustCase;
>
> public class MeasurementsManagerTest extends AtgDustCase {
> public void testSaveMeasurements() throws Exception {
> try {
> String componentBeingTested = "/widgets/diet/util/
> MeasurementsManager";
> String[] sourceDirectories = { "config" };
> String destinationDirectory = "dust";
> String[] exclusionPatterns = { ".svn" };
> copyConfigurationFiles(sourceDirectories, destinationDirectory,
> exclusionPatterns);
>
> createPropertyFile(destinationDirectory, componentBeingTested,
> MeasurementsManager.class);
>
> String repositoryPath = "/widgets/diet/DietRepository";
> Properties connectionProperties = new Properties();
> boolean dropTable = false;
> String definitionFile = repositoryPath + ".xml";
> prepareRepository(repositoryPath, connectionProperties, dropTable,
> definitionFile);
>
> MeasurementsManager measurementsManager = (MeasurementsManager)
> resolveNucleusComponent(componentBeingTested);
> measurementsManager.setMeasurementFormShown(true);
> measurementsManager.saveMeasurements();
> } catch (Throwable t) {
> t.printStackTrace();
> }
> }
> }
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Atgdust-general mailing list
> Atg...@li...
> https://lists.sourceforge.net/lists/listinfo/atgdust-general
|
|
From: Robert H. <ro...@zo...> - 2007-12-08 17:16:57
|
Hi,
If you want to test against an existing db you must provide a
properties instance with some values:
final Properties properties = new Properties();
properties.put("driver", "com.mysql.jdbc.Driver");
properties.put("url", "jdbc:mysql://localhost:3306/someDb");
properties.put("user", "someUserName");
properties.put("password", "somePassword");
If you want to test against an in-memory db you can use the
prepareRepository(final String repoPath, final String...
definitionFiles).
I changed your test case slightly (I don't have your component class,
repos definitions, etc, etc), so that it works against an example
repository which you can find if you checkout atgdust ( svn checkout https://atgdust.svn.sourceforge.net/svnroot/atgdust
atgdust). BTW the code below run's against the trunk of AtgDust.
You can find the output below the changed test code.
HTH
gr,
--Robert
import java.io.File;
import java.util.Properties;
import atg.test.AtgDustCase;
public class MeasurementsManagerTest extends AtgDustCase {
@Override
public void setUp() throws Exception {
try {
String componentBeingTested = "/widgets/diet/util/
MeasurementsManager";
String[] sourceDirectories = { "config" };
String destinationDirectory = "dust";
String[] exclusionPatterns = { ".svn" };
// copyConfigurationFiles(sourceDirectories,
destinationDirectory,
// exclusionPatterns);
copyConfigurationFiles(new String[] { "src/test/resources/config"
.replace("/", File.separator) }, "target/test-classes/config"
.replace("/", File.separator), ".svn");
createPropertyFile(destinationDirectory, componentBeingTested,
Object.class);
String repositoryPath = "/widgets/diet/DietRepository";
Properties connectionProperties = new Properties();
boolean dropTable = false;
String definitionFile = repositoryPath + ".xml";
// prepareRepository(repositoryPath, connectionProperties,
dropTable,
// definitionFile);
prepareRepository("/GettingStarted/SongsRepository",
"/GettingStarted/songs.xml");
// MeasurementsManager measurementsManager =
(MeasurementsManager)
// resolveNucleusComponent(componentBeingTested);
// measurementsManager.setMeasurementFormShown(true);
// measurementsManager.saveMeasurements();
}
catch (Throwable t) {
t.printStackTrace();
}
}
public void testRepository() throws Exception {
assertNotNull(resolveNucleusComponent("/GettingStarted/
SongsRepository"));
}
}
OUTPUT:
2007-12-08 18:10:09,619 INFO [atg.test.AtgDustCase]
[setConfigurationLocation] [Thread:main] - [Using configuration
location: target/test-classes/config]
2007-12-08 18:10:09,623 INFO [atg.test.AtgDustCase]
[copyConfigurationFiles] [Thread:main] - [Copying configuration files
and forcing global scope on all configs]
2007-12-08 18:10:09,675 INFO
[atg.test.configuration.RepositoryConfiguration]
[createPropertiesByConfigurationLocation] [Thread:main] - [Created
repository configuration fileset]
2007-12-08 18:10:09,696 INFO [atg.test.util.RepositoryManager]
[initializeMinimalRepositoryConfiguration] [Thread:main] - [Connected
to 'jdbc:hsqldb:mem:testDb' using driver 'org.hsqldb.jdbcDriver']
2007-12-08 18:10:09,696 INFO [atg.test.util.RepositoryManager]
[createIdGeneratorTables] [Thread:main] - [Re-creating (drop and
create) DAS_ID_GENERATOR]
2007-12-08 18:10:09,961 INFO
[atg.test.configuration.BasicConfiguration]
[createPropertiesByConfigurationLocation] [Thread:main] - [Created
basic configuration fileset]
**** info Sat Dec 08 18:10:10 CET 2007 1197133810181 /
atg.nucleus.NucleusResources->nucleusNameResolverCreatingService :
Creating service "/atg/dynamo/service/logging/ScreenLog"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810201 / ---- Warning:
there is a reference to: "/atg/dynamo/service/logging/ScreenLog"
before it is initialized
**** info Sat Dec 08 18:10:10 CET 2007 1197133810203 /
atg.nucleus.NucleusResources->nucleusNameResolverStartingService :
Starting service "/atg/dynamo/service/logging/ScreenLog"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810203 /
atg.nucleus.NucleusResources->nucleusNameResolverDoneCreatingService :
Done creating service "/atg/dynamo/service/logging/ScreenLog"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810206 / Creating
service "/Initial"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810239 / Creating
service "/atg/dynamo/service/AppServerConfig"
**** Warning Sat Dec 08 18:10:10 CET 2007 1197133810240 / An attempt
has been made to use ServletUtil.isDynamoJ2EEServer() before this
property has been set.
Nucleus running
**** info Sat Dec 08 18:10:10 CET 2007 1197133810241 / Creating
service "/GettingStarted/SongsRepository"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810677 / Creating
service "/atg/dynamo/service/jdbc/JTDataSource"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810728 / Creating
service "/atg/dynamo/service/jdbc/FakeXADataSource"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810741 / Starting
service "/atg/dynamo/service/jdbc/FakeXADataSource"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810742 / Done creating
service "/atg/dynamo/service/jdbc/FakeXADataSource"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810743 / Creating
service "/atg/dynamo/transaction/TransactionManager"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810761 / Starting
service "/atg/dynamo/transaction/TransactionManager"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810761 / Done creating
service "/atg/dynamo/transaction/TransactionManager"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810762 / Starting
service "/atg/dynamo/service/jdbc/JTDataSource"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810771 / Done creating
service "/atg/dynamo/service/jdbc/JTDataSource"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810771 / Creating
service "/atg/dynamo/service/IdGenerator"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810785 / Creating
service "/atg/dynamo/service/xml/XMLToolsFactory"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810800 / Done creating
service "/atg/dynamo/service/xml/XMLToolsFactory"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810800 / Starting
service "/atg/dynamo/service/IdGenerator"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810803 / Creating
service "/atg/dynamo/transaction/TransactionDemarcationLogging"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810806 / Starting
service "/atg/dynamo/transaction/TransactionDemarcationLogging"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810806 / Done creating
service "/atg/dynamo/transaction/TransactionDemarcationLogging"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810858 / Done creating
service "/atg/dynamo/service/IdGenerator"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810859 / Creating
service "/atg/dynamo/service/ClientLockManager"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810870 / Starting
service "/atg/dynamo/service/ClientLockManager"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810870 / Done creating
service "/atg/dynamo/service/ClientLockManager"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810871 / Starting
service "/GettingStarted/SongsRepository"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810901 / Creating
service "/atg/registry/RepositoryGroups"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810916 / Done creating
service "/GettingStarted/SongsRepository"
**** info Sat Dec 08 18:10:10 CET 2007 1197133810943 /GettingStarted/
SongsRepository Dropping tables because 'dropTablesAtShutdown' is
true....
On 7 Dec, 2007, at 22:00, Ted Davis wrote:
> OK I installed the JARs for the Apache Commons releases of DBCP and
> Pool.
>
> It now compiles and runs... but not successfully.
>
> Oddly enough if I comment out the sections that copy the properties
> file and set up the repository, the test creates the nucleus component
> successfully but the component eventually fails as none of its
> dependencies have been injected.
>
> If I put the properties file and repository code back in, the nucleus
> component isn't instantiated. I'm perplexed.
>
> Is there a way for me to test or sanity check each of the test set-up
> methods (createPropertyFile and prepareRepository) to see if they
> really did what they needed to do?
>
> Here's my entire test so far:
>
>
> package com.widgets.diet.util;
>
> import java.util.Properties;
>
> import atg.test.AtgDustCase;
>
> public class MeasurementsManagerTest extends AtgDustCase {
> public void testSaveMeasurements() throws Exception {
> try {
> String componentBeingTested = "/widgets/diet/util/
> MeasurementsManager";
> String[] sourceDirectories = { "config" };
> String destinationDirectory = "dust";
> String[] exclusionPatterns = { ".svn" };
> copyConfigurationFiles(sourceDirectories, destinationDirectory,
> exclusionPatterns);
>
> createPropertyFile(destinationDirectory, componentBeingTested,
> MeasurementsManager.class);
>
> String repositoryPath = "/widgets/diet/DietRepository";
> Properties connectionProperties = new Properties();
> boolean dropTable = false;
> String definitionFile = repositoryPath + ".xml";
> prepareRepository(repositoryPath, connectionProperties, dropTable,
> definitionFile);
>
> MeasurementsManager measurementsManager = (MeasurementsManager)
> resolveNucleusComponent(componentBeingTested);
> measurementsManager.setMeasurementFormShown(true);
> measurementsManager.saveMeasurements();
> } catch (Throwable t) {
> t.printStackTrace();
> }
> }
> }
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Atgdust-general mailing list
> Atg...@li...
> https://lists.sourceforge.net/lists/listinfo/atgdust-general
|
|
From: Ted D. <tr...@gm...> - 2007-12-07 21:00:31
|
OK I installed the JARs for the Apache Commons releases of DBCP and Pool.
It now compiles and runs... but not successfully.
Oddly enough if I comment out the sections that copy the properties
file and set up the repository, the test creates the nucleus component
successfully but the component eventually fails as none of its
dependencies have been injected.
If I put the properties file and repository code back in, the nucleus
component isn't instantiated. I'm perplexed.
Is there a way for me to test or sanity check each of the test set-up
methods (createPropertyFile and prepareRepository) to see if they
really did what they needed to do?
Here's my entire test so far:
package com.widgets.diet.util;
import java.util.Properties;
import atg.test.AtgDustCase;
public class MeasurementsManagerTest extends AtgDustCase {
public void testSaveMeasurements() throws Exception {
try {
String componentBeingTested = "/widgets/diet/util/MeasurementsManager";
String[] sourceDirectories = { "config" };
String destinationDirectory = "dust";
String[] exclusionPatterns = { ".svn" };
copyConfigurationFiles(sourceDirectories, destinationDirectory,
exclusionPatterns);
createPropertyFile(destinationDirectory, componentBeingTested,
MeasurementsManager.class);
String repositoryPath = "/widgets/diet/DietRepository";
Properties connectionProperties = new Properties();
boolean dropTable = false;
String definitionFile = repositoryPath + ".xml";
prepareRepository(repositoryPath, connectionProperties, dropTable,
definitionFile);
MeasurementsManager measurementsManager = (MeasurementsManager)
resolveNucleusComponent(componentBeingTested);
measurementsManager.setMeasurementFormShown(true);
measurementsManager.saveMeasurements();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
|
|
From: Ted D. <tr...@gm...> - 2007-12-07 15:50:31
|
Thanks again. Unfortunately still not luck :-) 1. I'm now getting this error (with the new DUST JAR): junit.framework.AssertionFailedError: Exception in constructor: testSaveMeasurements (java.lang.NoClassDefFoundError: org/apache/commons/dbcp/BasicDataSource I'm guessing DUST now requires the Apache Commons library? |
|
From: Belmont, A. <ad...@at...> - 2007-12-07 01:43:24
|
Hi. I just updated the binary to .4 there might have been a change since the last one. But I think that's an overloaded method. I'm taking the examples from here: http://atgdust.sourceforge.net/xref-test/test/SongsRepositoryTest.html That should help put it in context.. I hope! -----Original Message----- From: atg...@li... [mailto:atg...@li...] On Behalf Of Ted Davis Sent: Thursday, December 06, 2007 6:51 PM To: atg...@li... Subject: Re: [Atgdust-general] Transactions and DUST Thanks. I'm confused by one line: prepareRepositoryTest("/foo/MeasurementsRepository", properties, false, "/foo/measurementsRepository.xml "); 1. Where did "properties" come from? 2. Those arguments don't match the signature of the method in the JAR I downloaded a couple nights ago: (String[] definitionFiles, String repositoryPath, Properties connectionProperties, boolean dropTable) Thanks for the quick and helpful responses :-) ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Atgdust-general mailing list Atg...@li... https://lists.sourceforge.net/lists/listinfo/atgdust-general |
|
From: Ted D. <tr...@gm...> - 2007-12-06 23:50:58
|
Thanks. I'm confused by one line:
prepareRepositoryTest("/foo/MeasurementsRepository", properties,
false, "/foo/measurementsRepository.xml ");
1. Where did "properties" come from?
2. Those arguments don't match the signature of the method in the JAR
I downloaded a couple nights ago: (String[] definitionFiles, String
repositoryPath, Properties connectionProperties, boolean dropTable)
Thanks for the quick and helpful responses :-)
|
|
From: Belmont, A. <ad...@at...> - 2007-12-06 23:14:12
|
Thanks that helps..
I think the problem is that you aren't creating a repository so the code to
write out TransactionManager.properties never gets called. Thus Nucleus just
returns null when it tries to set the tranasctionManager property of your
component.
Are you testing code that uses repositories or is it just getting a
TransactionManager and doing something else?
I suspect something like this would work: (Note that I took
resolveNucleusComponent out of your setup method and just put it in the test
just so you could see the logic all in one place.
I also invented a dummy repository called "MeasurementsRepository" just as a
way to trigger the code which initializes TransactionManager to get called.
Here's the setUp() method from the example. That call to
"copyConfigurationFiles" is used to put your testing "configpath" in place
to be used. In the case of this example you'd put any .properties files or
repository definition files (xml) in "sec/test/resource/config" directory:
public void setUp() throws Exception {
super.setUp();
// make sure all needed files are at the configuration location.
// "target/test-classes/config" is then promoted to the configuration
// staging directory (that location is a maven controlled build location
and
// therefore not part of the checked in source tree).
copyConfigurationFiles(new String[] {
"src/test/resources/config".replace(
"/", File.separator) }, "target/test-classes/config".replace("/",
File.separator), ".svn");
// Eventually set this one to 'true' to get more debug logging in your
// console from your nucleus based components.
setDebug(false);
}
public void testSaveMeasurements() throws Exception {
try {
prepareRepository("/foo/MeasurementsRepository", properties,
false,"/foo/measurementsRepository.xml ");
measurementsManager =
(MeasurementsManager)resolveNucleusComponent(COMPONENT);
measurementsManager.setMeasurementFormShown(true);
measurementsManager.saveMeasurements();
} catch (Throwable t) {
t.printStackTrace();
}
}
-----Original Message-----
From: atg...@li...
[mailto:atg...@li...] On Behalf Of Ted
Davis
Sent: Thursday, December 06, 2007 5:42 PM
To: atg...@li...
Subject: Re: [Atgdust-general] Transactions and DUST
On Dec 6, 2007 3:54 PM, Belmont, Adam <ad...@at...> wrote:
> Ok so this is a class being tested and the class is a Nucleus component?
Yes, I'm sorry I didn't make that clear. Here's the entire test:
package com.widgets.diet.util;
import com.widgets.common.test.EDAtgDustCase;
public class MeasurementsManagerTest extends EDAtgDustCase {
private static final String COMPONENT =
"/widgets/diet/util/MeasurementsManager";
private MeasurementsManager measurementsManager;
protected void setUp() throws Exception {
super.setUp();
measurementsManager = (MeasurementsManager)
resolveNucleusComponent(COMPONENT);
}
public void testSaveMeasurements() throws Exception {
try {
measurementsManager.setMeasurementFormShown(true);
measurementsManager.saveMeasurements();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Atgdust-general mailing list
Atg...@li...
https://lists.sourceforge.net/lists/listinfo/atgdust-general
|
|
From: Ted D. <tr...@gm...> - 2007-12-06 22:51:46
|
Oops you'll need to see the superclass too, sorry about that:
package com.widgets.common.test;
import atg.nucleus.logging.ClassLoggingFactoryImpl;
import atg.test.AtgDustCase;
public abstract class EDAtgDustCase extends AtgDustCase {
private static final String[] FILE_EXCLUSION_PATTERNS = new String[]
{ ".svn" };
private static final String DESTINATION_DIRECTORY = "dust";
private static final String[] SOURCE_DIRECTORIES = new String[] { "config" };
protected void setUp() throws Exception {
super.setUp();
copyConfigurationFiles(SOURCE_DIRECTORIES, DESTINATION_DIRECTORY,
FILE_EXCLUSION_PATTERNS);
createPropertyFile(DESTINATION_DIRECTORY,
"/atg/dynamo/service/logging/ClassLoggingFactory",
ClassLoggingFactoryImpl.class);
}
}
|