# StaticIdGenerator for testing. [closed]

chillworld
5322 4 9
https://github.com/chillw...

Hi all,

In zk 7 is there a new feature for creating static uuid's. Very nice so you can do selenium or other web browser testing. (see here for the documentation.)
Now I'm facing the folowing problem :

I have different environments where I can't alter the Jboss config. I want to use the StaticIdGenerator on DEVELOPMENT and TEST but not on ACCEPTANCE and PRODUCTION. I may not change mine code when I go from TEST to ACCEPTANCE and to PRODUCTION.

So can we add that on specific environments (in stead of an zk-test.xml) or do I have to use an own implementation with delegator to the StaticIdGenerator and the default IdGenerator? (and what is the FQN of the default IdGenerator?)

Chill.

delete retag edit

### The question has been closed for the following reason "the question is answered, right answer was accepted"by chillworld close date 2015-03-26 16:49:03

Sort by » oldest newest most voted

cor3000
4332 1 7

Hi Chill,

you can use several config files for each environment and just define a different environment variable. e.g. -Dorg.zkoss.zk.config.path=/WEB-INF/config/zk-testing.xml

or define it on at the command line to keep the jboss startup scripts unchanged SET org.zkoss.zk.config.path=/WEB-INF/config/zk-testing.xml

If that is still not an option:

You can set/replace the IdGenerator on the WebApp after it has been initialized. Use the WebAppInit listener to change the zk application config after initialization of the webapp. You can set an IdGenerator implementation, depending on on the environment (determined by e.g. hostname/ip address/system propery ...).

e.g.

init(WebApp wapp) {
WebAppCtrl appCtrl = (WebAppCtrl)wapp;
appCtrl.setIdGenerator(yourIdGenerator)
}


BTW: there is no IdGenerator implementation for the Default generation strategy. It is coded into the DesktopImpl class (getNextUuid(...)).

Robert

The third option is the only way how I can do it, cause like I said startup Jboss is out of mine hands. Thanks cor3000.

( 2014-02-13 07:29:42 +0800 )edit

thanks for the feedback... sounds like another "victim" of too restrictive admins... ;)

( 2014-02-13 07:47:19 +0800 )edit

Lol, If you know that I have to wait 3 days to get winrar on mine pc you know enough?

( 2014-02-13 08:05:29 +0800 )edit