incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "marios@redhat.com" <mandr...@redhat.com>
Subject Re: jboss tools deltacloud java client contributions
Date Tue, 24 May 2011 16:04:34 GMT
On 23/05/11 16:13, André Dietisheim wrote:
> Hi guys
>
> I just finished cleaning my Deltacloud java client code and pushed
> things to my DC fork on github.
> I added 2 java projects (org.jboss.tools.deltacloud.client &
> org.jboss.tools.deltacloud.client.test) to the java folder in clients/.
> I'd greatly appreciate if anybody could have a look at it and verify
> that I added things in the way you'd have expected it (since I'm not
> much git experienced so far).
>
> https://github.com/apache/deltacloud/pull/1
>
> As soon as the code is moved over to your repo, we'll remove the client
> from our repo and include a jar'ed version of it in our tooling.
>
> Cheers
> André

ACK from me - some notes (some of this might be of use to anyone else 
who'd like to test):

*** slight issue with (I am guessing) the unmarshalling of the instance 
actions. From some_instance.toString() I get something like:

Instance:	i-4bf52625
Owner:		297467797945
Image:		ami-f51aff9c
Realm:		us-east-1d
Profile:		m1.small
State:		STOPPED
Actions:	org.jboss.tools.deltacloud.client.Action@152c4d9
		org.jboss.tools.deltacloud.client.Action@f99ff5

*** junit test suites are green:

   ==> running ec2 driver:
     --> java org.junit.runner.JUnitCore 
org.jboss.tools.internal.deltacloud.client.test.DeltaCloudClientTestSuite
JUnit version 4.6
......................
Time: 0.504

OK (22 tests)


   ==> running mock driver:
     -->  java org.junit.runner.JUnitCore 
org.jboss.tools.internal.deltacloud.client.test.DeltaCloudClientIntegrationTestSuite
..........................
Time: 200.531

OK (31 tests)

*** needs documentation! (i guess this is something we can add later). 
It wasn't clear how to use the client - in particular I wasn't sure how 
to invoke actions (like Instance.start/stop etc)

*** A simple test class (pretty small so I copy/paste) - forgive the 
noobiness of my java - its been a while!:

import org.jboss.tools.deltacloud.client.* ;
import java.util.* ;
public class TestClient
{
   public static void main(String [] args)
   {
     try
     {
       String user = args[0];
       String pass = args[1];
       DeltaCloudClient the_client = new 
DeltaCloudClientImpl("http://localhost:3001", user, pass) ;
//IMAGES
       List images = the_client.listImages();
       System.out.println("A total of " + images.size() + " images was 
returned");
       ListIterator litr = images.listIterator() ;
       while (litr.hasNext())
       {
           System.out.println(litr.next().toString()) ;
       }
//DRIVER
       API.Driver the_driver = the_client.getServerType();
       System.out.println("Current server driver is " + 
the_driver.toString());
//INSTANCES
       List instances = the_client.listInstances();
       System.out.println(instances.size() + " instances returned");
       ListIterator inst_litr = instances.listIterator();
       Instance current;
       while(inst_litr.hasNext())
       {
         current = (Instance) inst_litr.next();
         System.out.println(current.toString());
//      current.stop(the_client)
//      current.destroy(the_client);
       }
       //create instance
       //Instance my_server = the_client.createInstance("ami-f51aff9c");

     }
     catch (Exception dcce)
     {
       dcce.printStackTrace() ;
     }
   }
}

*** we need to wait for michal since he is admin of the github repo 
before we push. For the record and as David said, the github repo is 
just a mirror of the (git) svn repo @ apache. An alternative way of 
contributing (but I stress, github is perfectly acceptable):

<initialise the local repo>:
  mkdir deltacloud; cd deltacloud; git svn init -s 
https://svn.apache.org/repos/asf/incubator/deltacloud;  git svn fetch 
--log-window-size 10000

<make a branch for your changes>:
git branch -b my_branch

<make lots of changes, add files, etc. Now commit the changes>
git commit -a

<see what changes you've made>
git status

<check which branch you're on>
git branch

<fetch any new items from master and rebase your code before sending a 
patch>
git checkout master; git svn rebase; git rebase master my_branch

<make a patch>
git format-patch -o /some/directory/for/your/patches

<send the patch>
git send-email --compose --subject 'subject' --thread 
/some/directory/for/your/patches/* --to deltacloud-dev@incubator.apache.org

marios


Mime
View raw message