0

StaticIdGenerator for testing. [closed]

asked 2014-02-10 13:35:21 +0800

chillworld gravatar image chillworld flag of Belgium
5337 4 9
https://github.com/chillw...

updated 2014-02-10 13:35:56 +0800

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?)

Thx in advance.

Chill.

delete flag offensive 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

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-02-13 07:10:43 +0800

cor3000 gravatar image cor3000
4596 2 7
ZK Team

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) {
    //define your environment
    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

link publish delete flag offensive edit

Comments

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.

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

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

cor3000 ( 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?

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

Question tools

Follow
2 followers

RSS

Stats

Asked: 2014-02-10 13:35:21 +0800

Seen: 20 times

Last updated: Feb 13 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More