@@ -21,28 +21,28 @@ public class Mktmpio extends SimpleBuildWrapper {
21
21
public static final String DEFAULT_SERVER = "https://mktmp.io" ;
22
22
23
23
// Job config
24
- private String instanceType ;
24
+ private String dbType ;
25
25
private boolean shutdownWithBuild = false ;
26
26
27
27
@ DataBoundConstructor
28
- public Mktmpio (String instanceType ) {
29
- this .instanceType = instanceType ;
28
+ public Mktmpio (String dbType ) {
29
+ this .dbType = dbType ;
30
30
}
31
31
32
32
static void dispose (final MktmpioEnvironment env , final Launcher launcher , final TaskListener listener ) throws IOException , InterruptedException {
33
33
final String instanceID = env .id ;
34
34
MktmpioInstance instance = new MktmpioInstance (env );
35
35
instance .destroy ();
36
- listener .getLogger ().printf ("mktmpio instance shutdown. type: %s, host: %s, port: %d\n " , env .type , env .host , env .port );
36
+ listener .getLogger ().printf ("mktmpio instance shutdown. type: %s, host: %s, port: %d\n " , env .dbType , env .host , env .port );
37
37
}
38
38
39
- public String getInstanceType () {
40
- return instanceType ;
39
+ public String getDbType () {
40
+ return dbType ;
41
41
}
42
42
43
43
@ DataBoundSetter
44
- public void setInstanceType (String instanceType ) {
45
- this .instanceType = instanceType ;
44
+ public void setDbType (String dbType ) {
45
+ this .dbType = dbType ;
46
46
}
47
47
48
48
public boolean isShutdownWithBuild () {
@@ -70,20 +70,20 @@ public void setUp(SimpleBuildWrapper.Context context,
70
70
final MktmpioDescriptor config = getDescriptor ();
71
71
final String token = config .getToken ();
72
72
final String baseUrl = config .getServer ();
73
- final String type = getInstanceType ();
73
+ final String dbType = getDbType ();
74
74
final MktmpioInstance instance ;
75
75
try {
76
76
listener .getLogger ().printf ("Attempting to create instance (server: %s, token: %s, type: %s)" ,
77
- baseUrl , token .replaceAll ("." , "*" ), type );
78
- instance = MktmpioInstance .create (baseUrl , token , type , isShutdownWithBuild ());
77
+ baseUrl , token .replaceAll ("." , "*" ), dbType );
78
+ instance = MktmpioInstance .create (baseUrl , token , dbType , isShutdownWithBuild ());
79
79
} catch (IOException ex ) {
80
80
listener .fatalError ("mktmpio: " + ex .getMessage ());
81
81
throw new InterruptedException (ex .getMessage ());
82
82
}
83
83
final MktmpioEnvironment env = instance .getEnv ();
84
84
final Map <String , String > envVars = env .envVars ();
85
- listener .hyperlink (baseUrl + "/i/" + env .id , env .type + " instance " + env .id );
86
- listener .getLogger ().printf ("mktmpio instance created: %s\n " , env .type );
85
+ listener .hyperlink (baseUrl + "/i/" + env .id , env .dbType + " instance " + env .id );
86
+ listener .getLogger ().printf ("mktmpio instance created: %s\n " , env .dbType );
87
87
for (Map .Entry <String , String > entry : envVars .entrySet ()) {
88
88
listener .getLogger ().printf ("setting %s=%s\n " , entry .getKey (), entry .getValue ());
89
89
}
@@ -92,7 +92,7 @@ public void setUp(SimpleBuildWrapper.Context context,
92
92
context .setDisposer (new MktmpioDisposer (env ));
93
93
}
94
94
95
- public static ListBoxModel instanceTypes () {
95
+ public static ListBoxModel supportedDbTypes () {
96
96
ListBoxModel items = new ListBoxModel ();
97
97
items .add ("MySQL" , "mysql" );
98
98
items .add ("PostgreSQL-9.4" , "postgres" );
@@ -121,7 +121,7 @@ public boolean configure(final StaplerRequest req, final JSONObject formData) {
121
121
}
122
122
123
123
@ Override
124
- public BuildWrapper newInstance (final StaplerRequest req , final JSONObject formData ) throws hudson .model .Descriptor .FormException {
124
+ public Mktmpio newInstance (final StaplerRequest req , final JSONObject formData ) throws hudson .model .Descriptor .FormException {
125
125
return req .bindJSON (Mktmpio .class , formData );
126
126
}
127
127
@@ -151,8 +151,8 @@ public String getDisplayName() {
151
151
return "Create temporary database server for build" ;
152
152
}
153
153
154
- public ListBoxModel doFillInstanceTypeItems () {
155
- return instanceTypes ();
154
+ public ListBoxModel doFillDbTypeItems () {
155
+ return supportedDbTypes ();
156
156
}
157
157
}
158
158
}
0 commit comments