Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Integration Test for PU

Hi

I am trying to create an integration test to show that the processing units on the space react to an event published. My integration test works to the point where I write an event to the space and the processing unit picks up the object and changes the status. The problem occurs when I try to read the object from the space by doing gigaSpace.read (object). I don't get anything back. When I debug I can see my processor picking up the object and doing stuff to it and when I try to count the number of objects in the space I get zero.

Here is my integration test: [code] private IntegratedProcessingUnitContainerProvider provider; private IntegratedProcessingUnitContainer container;

@Before public void setUp() throws Exception { //set up the container and the provider //as described in the documentation }

@test public void testCanProcessEvent() throws Exception { GigaSpace gigaSpace = (GigaSpace)container.getApplicationContext().getBean("gigaSpace"); Contract c = new Contract(); gigaSpace.write(c); Contract cFromSpace = gigaSpace.read(c); assertNotNull(cFromSpace);

} [/code]

I know my processing unit is configured correctly otherwise I would not be able to debug into it.

Not sure what the problem might be. Any help would be highly appreciated. I can provide additional info if required.

Thanks

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2563]{quote}

asked 2008-09-03 02:13:38 -0600

amin1977 gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

Can you submit the Space Object?
There is a good chance you constructed the template wrongly. Please check the following:
- Do you have int , long data types? Do you have the null-value for these? I suggest using Integer , Long instead to avoid the null-value annotation.
- Do you have no arg constructor?
- Do you have getters and setters for all fields you have to be part of the space object?
- Do you have non primitive fields (user defined fields or collocations) as part of the space object? Are these initialized with null?
Shay

answered 2008-09-03 07:40:33 -0600

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Hi there

My space class looks like this:

@SpaceClass public class Contract {

private String id;

private String description = "";

private String type = "";

private Status contractStatus = Status.NEW;

private User owner =null;

private List<User> parties = new ArrayList<User>();

public Contract() {
}

  //getters and setters
    @SpaceId(autoGenerate = true)
public String getId() {
    return id;
}

}

After doing this I now find that my processing unit does not fire. I can see the contract object in the space when I do gigaspace.count but it is not being processed.

Thanks for your help

amin1977 gravatar imageamin1977 ( 2008-09-03 14:29:51 -0600 )edit

Please Make this change:
private List parties = null;

Shay

shay hassidim gravatar imageshay hassidim ( 2008-09-03 14:36:22 -0600 )edit

Thanks for your quick reply! I made the changes you recommended but unfortunately it's still not working. The PU is not being invoked... I made the User object be a SpaceClass.

Thanks again!

amin1977 gravatar imageamin1977 ( 2008-09-03 14:44:19 -0600 )edit

Please starts everything from scratch to allow the JVM to load the new class.

Make sure you place this class under a folder called shared-lib within a jar file.

Shay

shay hassidim gravatar imageshay hassidim ( 2008-09-03 14:48:44 -0600 )edit

Do you have getter and setters for the other fields with in the POJO? You must have such. The user Class do not need the @SpaceClass.

Make also the contractStatus to have null.

Shay

Edited by: Shay Hassidim on Sep 3, 2008 2:55 PM

shay hassidim gravatar imageshay hassidim ( 2008-09-03 14:55:08 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2008-09-03 02:13:38 -0600

Seen: 177 times

Last updated: Sep 03 '08