Return-Path: Delivered-To: apmail-maven-continuum-commits-archive@www.apache.org Received: (qmail 51157 invoked from network); 14 Apr 2006 11:01:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Apr 2006 11:01:49 -0000 Received: (qmail 44594 invoked by uid 500); 14 Apr 2006 11:01:33 -0000 Delivered-To: apmail-maven-continuum-commits-archive@maven.apache.org Received: (qmail 44568 invoked by uid 500); 14 Apr 2006 11:01:33 -0000 Mailing-List: contact continuum-commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: continuum-dev@maven.apache.org Delivered-To: mailing list continuum-commits@maven.apache.org Received: (qmail 44556 invoked by uid 99); 14 Apr 2006 11:01:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Apr 2006 04:01:33 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 14 Apr 2006 04:01:32 -0700 Received: (qmail 50591 invoked by uid 65534); 14 Apr 2006 11:00:55 -0000 Message-ID: <20060414110055.50590.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r394062 - /maven/continuum/branches/continuum-1.0.x/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/SampleClient.java Date: Fri, 14 Apr 2006 11:00:55 -0000 To: continuum-commits@maven.apache.org From: evenisse@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: evenisse Date: Fri Apr 14 04:00:24 2006 New Revision: 394062 URL: http://svn.apache.org/viewcvs?rev=394062&view=rev Log: Add a little sample client Added: maven/continuum/branches/continuum-1.0.x/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/SampleClient.java (with props) Added: maven/continuum/branches/continuum-1.0.x/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/SampleClient.java URL: http://svn.apache.org/viewcvs/maven/continuum/branches/continuum-1.0.x/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/SampleClient.java?rev=394062&view=auto ============================================================================== --- maven/continuum/branches/continuum-1.0.x/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/SampleClient.java (added) +++ maven/continuum/branches/continuum-1.0.x/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/SampleClient.java Fri Apr 14 04:00:24 2006 @@ -0,0 +1,117 @@ +package org.apache.maven.continuum.rpc; + +/* + * Copyright 2004-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.continuum.model.project.Project; + +import java.net.URL; + +public class SampleClient +{ + public static void main( String[] args ) + throws Exception + { + String address = "http://localhost:8000/continuum"; + + if ( args.length > 0 ) + { + address = args[0]; + } + + ProjectsReader pr = new ProjectsReader( new URL( address ) ); + + Project[] projects = null; + + try + { + System.out.println( "******************************" ); + System.out.println( "Projects list" ); + System.out.println( "******************************" ); + + projects = pr.readProjects(); + + for ( int i = 0; i < projects.length; i++ ) + { + System.out.println( projects[i] + " - Name=" + projects[i].getName() ); + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + + if ( projects != null && projects.length > 0 ) + { + try + { + System.out.println( "******************************" ); + System.out.println( "Project detail" ); + System.out.println( "******************************" ); + + Project project = new Project(); + project.setId( projects[0].getId() ); + pr.refreshProject( project ); + + System.out.println( "Name for project " + project.getId() + " : " + project.getName() ); + + if ( project.getState() == 1 || project.getState() == 10 ) + { + System.out.println( "State: New" ); + } + + if ( project.getState() == 2 ) + { + System.out.println( "State: OK" ); + } + + if ( project.getState() == 3 ) + { + System.out.println( "State: Failed" ); + } + + if ( project.getState() == 4 ) + { + System.out.println( "State: Error" ); + } + + if ( project.getState() == 6 ) + { + System.out.println( "State: Building" ); + } + + if ( project.getState() == 7 ) + { + System.out.println( "State: Checking out" ); + } + + if ( project.getState() == 8 ) + { + System.out.println( "State: Updating" ); + } + + if ( project.getState() == 9 ) + { + System.out.println( "State: Warning" ); + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } + } +} Propchange: maven/continuum/branches/continuum-1.0.x/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/SampleClient.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/continuum/branches/continuum-1.0.x/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/SampleClient.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision