1
1
package com .offbytwo .jenkins .model .credentials ;
2
2
3
+ import com .offbytwo .jenkins .client .FormBinaryField ;
3
4
import net .sf .json .JSONObject ;
4
5
5
6
import java .util .HashMap ;
@@ -17,6 +18,9 @@ public class AppleDeveloperProfileCredential extends Credential {
17
18
private static final String FILE_ZERO_FIELD_NAME = "file0" ;
18
19
private static final String FILE_ONE_FIELD_NAME = "file1" ;
19
20
21
+ private static final String DEFAULT_DEV_PROFILE_NAME = "developerProfile.zip" ;
22
+ private static final String DEFAULT_DEV_PROFULE_CONTENT_TYPE = "application/zip" ;
23
+
20
24
private String password ;
21
25
private byte [] developerProfileContent ;
22
26
@@ -72,14 +76,14 @@ public Map<String, Object> dataForCreate() {
72
76
jsonData .put ("credentials" , credentialMap );
73
77
74
78
Map <String , Object > formFields = new HashMap <String , Object >();
75
- formFields .put (FILE_ZERO_FIELD_NAME , this .getDeveloperProfileContent ());
79
+ formFields .put (FILE_ZERO_FIELD_NAME , new FormBinaryField ( DEFAULT_DEV_PROFILE_NAME , DEFAULT_DEV_PROFULE_CONTENT_TYPE , this .getDeveloperProfileContent () ));
76
80
formFields .put ("_.scope" , SCOPE_GLOBAL );
77
81
formFields .put ("_.password" , this .getPassword ());
78
82
formFields .put ("_.id" , this .getId ());
79
83
formFields .put ("_.description" , this .getDescription ());
80
84
formFields .put ("stapler-class" , BASECLASS );
81
85
formFields .put ("$class" , BASECLASS );
82
- formFields .put ("json" , JSONObject . fromObject ( jsonData ). toString () );
86
+ formFields .put ("json" , jsonData );
83
87
return formFields ;
84
88
}
85
89
@@ -95,7 +99,7 @@ public Map<String, Object> dataForUpdate() {
95
99
96
100
97
101
Map <String , Object > formFields = new HashMap <String , Object >();
98
- formFields .put (FILE_ONE_FIELD_NAME , this .getDeveloperProfileContent ());
102
+ formFields .put (FILE_ONE_FIELD_NAME , new FormBinaryField ( DEFAULT_DEV_PROFILE_NAME , DEFAULT_DEV_PROFULE_CONTENT_TYPE , this .getDeveloperProfileContent () ));
99
103
formFields .put ("_." , "on" );
100
104
formFields .put ("_.password" , this .getPassword ());
101
105
formFields .put ("_.id" , this .getId ());
0 commit comments