Eric Pugh wrote:

Hi..  In Fulcurm the class DefaultLocalizationService's initialize() method
was automatically called by the unit test's resolve method:
   /**
     * Called the first time the Service is used.
     */
    public void initialize() throws Exception
    {
        // initBundleNames(null);
        defaultLocale = new Locale(defaultLanguage, defaultCountry);
        Localization.setLocalizationService(this);
        if (log.isInfoEnabled())
        {
            log.info("Localization Service is Initialized now..");
        }
    }

Now however it fails, and I needed to add these two lines to get it to pass:
 LocalizationService ls = (LocalizationService) this.resolve(
"/test/localization" );
        ls.getString(null, new Locale("ko", "KR"), "key4");

Now passing unit test:

public void testFacadeConfigured() throws Exception
    {
        // this.lookup causes the service to be configured.
        this.resolve( "/test/localization" );
        LocalizationService ls = (LocalizationService) this.resolve(
"/test/localization" );
        ls.getString(null, new Locale("ko", "KR"), "key4");
        assertTrue(Localization.isInitialized());
        String s = Localization.getString(null, new Locale("ko", "KR"),
"key4");
        assertEquals(
            "Unable to retrieve localized text for locale: default",
            s,
            "value4");
    }


My challenge is that by just calling a this.resolve() the Facade Localization class should be populated.. At least I feel like that is enough. now, the inialize doens't get called until an actual method is called.. Is this pretty much the way thigns should work and my usecase is no longer valid?

Looking at your component directive ...

   <component name="localization"
     class="org.apache.fulcrum.localization.DefaultLocalizationService"
     activation="false"/>

You have activation-on-startup set to false. What this means is that Merlin is assuming that the lifecycle processing of this component can be deferred until some point in the future when an actual invocation occurs.

Changing the definition to the following should resolve your problem:

   <component name="localization"
     class="org.apache.fulcrum.localization.DefaultLocalizationService"
     activation="true"/>

Cheers, Steve.

--

|---------------------------------------|
| Magic by Merlin                       |
| Production by Avalon                  |
|                                       |
| http://avalon.apache.org              |
|---------------------------------------|

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to