William Bernadsson

Greenhorn
+ Follow
since Jul 14, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by William Bernadsson

Hi,

I am trying to do this with easymock:



And I get exception back:



I am aware that

If you would like to use matchers in a call, you have to specify matchers for all arguments of the method call.



However I have only one argument...

Best regards

14 years ago

Ilja Preuss wrote:Mhh, haven't done that myself, but this might be a perfect application for Aspects. Google for Aspect Oriented Programming - logging is a common example for this.



It's great idea! I am not very familiar with Aspects either but I will check it out. Thanks!
Hi Ilja,

I did implement a logger class and then put calls into appropriate places where connection/requests to those systems occur. In example:



But it is specific for every system... and specific for some calls. Calls and systems don't implement any common interface and in theory might not follow common pattern. If developer adds another system or other calls he has always keep in mind to place those logConnection calls. I think this is not very nice but how would one make this logging apply to any new system without too much effort?

Best regards,
Hi all,

We have a core system which connects to multiple external systems. There are about 8 external systems total. I have to implement logging when there is a problem with external system and when the system is available again. The challenge is that modules (connectors) to those external systems do not follow common interface.

Best regards and thanks!
but on the other hand in a clustered environment each node would have it's own such log.?
Howdy,

I work on JEE project that communicates to multiple external systems. I have to implement connection log, i.e. up/down for each external subsystem. If outgoing request is successful then connection state is switched to UP, if not then it is DOWN. The log should not contain same repeating entries for the connection. That is only when state is switched, entry has to be written to log file. This is why we have to store current connection state somewhere. We update connection state in Hashtable everytime request goes out. What is the best place to put this hashtable. Initially I made singleton. But now we are thinking to move it to stateless session bean and save this data in context.

Thanks,

1) If your unit tests are testing the public interface of the class, and are focused on testing behavior rather than methods, the unit tests are somewhat resilient to many common refactorings (as they only change the internals of a class.



I have to refactor the code that lays out products, marketing images, and other widgets on shop page. It is quite complex - about of 1000 java lines of code and logic is fuzzy.
This is huge amount for testing, right? I can approach it 2 ways:
1. Test input against output. I can create big input data chunk, put it into XML and test it against the output. This way I will never have to change test code. On the other hand such testing would not really point to the place/method that is faulty. It just will say - does not work. That would be more black box testing.
2. If I write tests per method/classes I will have to refactor them as well. This is where I am afraid to introduce errors. But such tests would easier detect the place of the error and they can serve as some sort of example how the specific methods can be used.
15 years ago
I am reading "Refactorings" book. It does strongly suggest to have unit test before doing any serious refactoring. But the refactoring may rearrange code, move functionality between methods and classes. As I understand unit test are unit based : class/methods. Then, the unit tests have to be refactored as well? How to keep unit tests match the tested code and do not introduce errors while refactoring?
15 years ago
Thank you. I am not frequent user of jsp:useBean tag. I wonder how much useful it is given it can take only simple types as parameters.
Also I am trying to play with unit testing and I am thinking how would I squeeze-in mock object implementation instead of the "real" one to anything instantiated with useBean.
15 years ago
JSP
Hi,

I want to write a scriptless JSP. I have a complex object Product, and a ViewHelper bean. ViewHelper bean is JSP friendly representation of Product. I know there is Product object already stored in request attribute. useBean tag does allow only simple parameters, like Strings. I see 3 ways to make JSP scriptletless:
1. Instantiate ViewHelper in controller.
2. Write custom tag (they have access to request).
3. Pas product id as param to useBean. And then set up some sort of caching for Product (Product is AccessBean extended from entity EJB).

What would be the right way to instantiate ViewHelper?

Thanks
15 years ago
JSP