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

Ask Your Question
0

Setting up a cluster for integration tests / deployment speed

Two questions, but correlated - I'm busy writing some integration tests. Ideally, the first test should trigger firing up the whole cluster (mirror, 3 spaces, and two .war deployments), including all the GS stuff that goes with it. Is there an easy programmatic way to do this? IntegratedPU seems not to be the solution (no clustering, therefore no mirroring, etcetera)...

Related - how can we (for example for local developer deployment when testing) speed up deployment? There seems to be a lot of stuff going on during deployment - copying/unpacking on war files, service lookups, probably recovery etcetera - that should all be doable much quicker if I can somehow convince GS that recovery is not needed, the only disk is the local disk (ideally GS would grab the unpacked war from the maven target/ dir) and the only relevant network is 127.0.0.0/8 ;-).

TIA,

Cees

Attachments

  1. GigaspacesSetupExecutionListener.java
  2. GigaspacesContainer.java
  3. UsesPU.java

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2009-06-12 07:11:57 -0500

cdegroot gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

Hi,

The IntegratedProcessingUnitContainer is the tool we provide to easily
run processing units out of development projects. With it you can run
any project within your ide.

For a more automated API controlled approach towards integration
testing, I would advise you to use the new R7.0 Admin API. This is what
we currently do internally.

Cheers,
Guy

Attachments

  1. GigaspacesSetupExecutionListener.java
  2. GigaspacesContainer.java
  3. UsesPU.java

answered 2009-06-12 16:13:12 -0500

nirpaz gravatar image
edit flag offensive delete link more

Comments

We are having a similar issue regarding running PUs in a unit test environment, and I wanted to know what is the best approach.

We have implemented a couple of PUs, and a service that acts as a client for the PUs. So, in the real production environment, the PUs are deployed into Gigaspaces, and a webapplication calls a plain old java service that starts submitting jobs to to the PUs. I am interested in writing the test case for the service layer.

So, in my ideal ideal world, we would have an API that can start multiple PUs in an embedded environment. I can call these APIs from my JUnit before running the tests. The tests will call the service layer, which would submit jobs to the embedded PUs. Is there a way to do this? Is there a way I can start multiple embedded PUs? Running multiple PUs is important because the service needs multiple PUs to be up and running

I was looking at the documentation, and it looks like there are 2 APIs that can be useful: StandAloneProcessingUnitContainerProvider and IntegeratedProcessingUnitContainerProvider. The API wasn't clear on what the differrence between these two is. Can either of these can be used to start multiple embedded PUs?

Jayesh

Attachments

  1. GigaspacesSetupExecutionListener.java
  2. GigaspacesContainer.java
  3. UsesPU.java
jlalwani gravatar image jlalwani  ( 2009-06-18 09:25:11 -0500 )edit

If anyone has interested, I made a Spring JUnit Test Execution Listener that loads the PU when JUnit is preparing an instance of the test class. The attached files have the code for the execution listener. If you want your unit test class to load a PU before execution, do this

@RunWith(SpringJUnit4ClassRunner.class) @TestExecutionListeners( {GigaspacesSetupExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class} ) @ContextConfiguration( inheritLocations = true, locations = { "classpath:/my-test-context.xml", "classpath:/my-spring-context.xml"}

)

@UsesPU(jars={"pu1.jar", "pu2.jar"})

public class MyTest { @test public void test1() throws Exception { // blah blah call my PUs here } } h4. Attachments

[GigaspacesSetupExecutionListener.java|/upfiles/1375970843346877.java]

[GigaspacesContainer.java|/upfiles/1375970843254797.java]

[UsesPU.java|/upfiles/1375970843418457.java]

jlalwani gravatar image jlalwani  ( 2009-07-08 15:05:02 -0500 )edit

Cool!
Well done.
Shay

shay hassidim gravatar image shay hassidim  ( 2009-07-08 15:10:00 -0500 )edit
0

The simplest thing to do is to use the puInstance command. This takes a PU folder as an argument. There is no need to start a GSC or GSM , no need to create a jar , just pass the exploded PU folder (with the relevant parameters) – this will run the PU/Space cluster.

Here is the basic command: {code} puInstance ..\deploy\myPU {code}

Here is an example how you can start a full cluster: {code} puInstance -cluster schema=partitioned-sync2backup total_members=2,1 -properties embed://dataGridName=myIMDG ..\deploy\templates\datagrid {code}

If you don’t need backups: {code} puInstance -cluster schema=partitioned total_members=2 -properties embed://dataGridName=myIMDG ..\deploy\templates\datagrid {code}

Shay

answered 2009-06-12 08:28:09 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Hi Shay,

in production environment I deploy all my stuff with "gs.sh pudeply ServiceName". Is it possible to do the same but with list of services? In my case it would be nice because now just deployment takes about half hour and most of time is consumed by staring new JVMs.

Regards, Mateusz

mnemos gravatar image mnemos  ( 2009-06-19 10:12:15 -0500 )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: 2009-06-12 07:11:57 -0500

Seen: 190 times

Last updated: Jun 12 '09