0

Configure Id Generator for different enviroments

asked 2016-01-08 14:20:27 +0800

eclipse1 gravatar image eclipse1
21 4

Hi,

In our project we had the need to implement our id generator, but we just want to use it in test environment.

We cannot use the configuration described in:

http://books.zkoss.org/wiki/ZK%20Developer's%20Reference/Testing/Testing%20Tips

Because we have restricted access to environment configurations.

We tried to define the id generator in WebAppInit:

wapp.getConfiguration().setIdGeneratorClass(CustomIdGenerator.class)

But has no effect.

How can i change the configuration without change ZK.xml?

Thank you all :)

delete flag offensive retag edit

Comments

Thank you all for your answers, we decided to create a maven property configuration to change the value of the ID Generator.

eclipse1 ( 2016-01-19 09:16:03 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-01-08 18:03:25 +0800

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

A solution could be making a delegater CustomIdGenerator.

What do I mean with this, it's acting as a IdGenerator but has internally an other IdGenerater instance. So your methods just contain :

public void doX() {
    generator.doX();
}

But now you could instantiate the generator by yourself and in order if it's a test environment, you intantiate the testing Id generator, otherwise you set the other one.

Greetz chill.

link publish delete flag offensive edit

Comments

Thanks for your answer, but set the ID generator in Web app init It is not supposed to work?

eclipse1 ( 2016-01-12 14:56:48 +0800 )edit

I don't know. Did not test that, just offer a possible solution

chillworld ( 2016-01-12 15:21:41 +0800 )edit

Ok, thanks for your help

eclipse1 ( 2016-01-12 17:00:18 +0800 )edit
0

answered 2016-01-10 16:21:15 +0800

Darksu gravatar image Darksu
1991 1 4

Hello eclipse1,

Also please check out the following:

http://books.zkoss.org/wiki/SmallTalks/2009/February/HowtoTestZKApplicationwith_Selenium

Best Regards,

Darksu

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2016-01-08 14:20:27 +0800

Seen: 21 times

Last updated: Jan 10 '16

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