Bonjour,
j'utilise continuum 1.1-beta-2 avec son API XmlRpc client de la même version (avec maven 2.0.4), j'ai un problème, je n'arrive pas à ajouter un BuildDefinition correctement; quand je l'ajoute, il genère un Id automatiquement que je ne peux pas recuperer
Avec le code suivant:
Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101 (....) client = new ContinuumXmlRpcClient( new URL( "http://localhost:8080/continuum/xmlrpc" ), "admin", "dev09" ); System.out.println( "Adding project..." ); AddingResult result = client.addMavenTwoProject( "http://repo1/projets_java/projet1/tags/V0.4-beta12/pom.xml" ); if ( result.hasErrors() ) { System.out.println( result.getErrorsAsString() ); return; } System.out.println( "Project Groups added." ); System.out.println( "=====================" ); int projectGroupId = 0; ProjectGroupSummary pg = null;; for ( Iterator i = result.getProjectGroups().iterator(); i.hasNext(); ) { pg = (ProjectGroupSummary) i.next(); projectGroupId = pg.getId(); System.out.println( "Id: " + pg.getId() ); System.out.println( "Group Id" + pg.getGroupId() ); System.out.println( "Name: " + pg.getName() ); System.out.println( "Description:" + pg.getDescription() ); } System.out.println(); System.out.println( "Projects added." ); System.out.println( "=====================" ); for ( Iterator i = result.getProjects().iterator(); i.hasNext(); ) { ProjectSummary p = (ProjectSummary) i.next(); printProjectSummary( client.getProjectSummary( p.getId() ) ); } System.out.println(); System.out.println( "Waiting the end of the check out..." ); ProjectSummary ps = (ProjectSummary) result.getProjects().get( 0 ); ps.setScmUrl("scm:svn:" +"http://serapis/projets_java/Neo/tags/V0.4-beta12"); BuildDefinition bd = getMyBuilDefinition(); bd = client.addBuildDefinitionToProjectGroup(pg.getId(), bd); pg = client.updateProjectGroup(pg); pg = client.refreshProjectGroupSummary(pg); // je ne sais pas si ça sert à grand chose ! System.out.println(bd.getId()); // tjrs = 0 List bds = client.getBuildDefinitionsForProjectGroup(pg.getId()); for (Iterator iterator = bds.iterator(); iterator.hasNext();) { BuildDefinition bdd = (BuildDefinition) iterator.next(); System.out.println(bdd.getId()); // tjrs = 0 } System.out.println("SCM changé avec succès !"); // <========================= MaJ Scm (ça marche) while ( !"New".equals( client.getProjectStatusAsString( ps.getState() ) ) ) { ps = client.refreshProjectSummary( ps ); System.out.println( "State of " + ps.getName() + "(" + ps.getId() + "): " + client.getProjectStatusAsString( ps.getState() ) ); Thread.sleep( 1000 ); } (...) } public static BuildDefinition getMyBuilDefinition(){ BuildDefinition bd = new BuildDefinition(); bd.setArguments("-Pdev"); bd.setGoals("deploy"); bd.setId(99); // je mets l'Id en dûr ! bd.setSchedule(getDefaultSchedule()); return bd; } public static Schedule getDefaultSchedule(){ Schedule sc = new Schedule(); sc.setCronExpression("0 15 10 15 * ?"); sc.setId(66); sc.setActive(true); sc.setName("Default_SC"); return sc; }
le BuildDefinition s'ajoute correctement le temps que l'état de ps passe de "Checking out" à "New", puis il n'y est plus !
quelqu'un peut m'aider?
Merci.
Partager