5
5
import static org .junit .Assert .assertTrue ;
6
6
import static org .junit .Assert .fail ;
7
7
8
- import hudson .util .VersionNumber ;
9
- import java .io .IOException ;
10
8
import java .util .ArrayList ;
11
9
import java .util .Arrays ;
12
10
import java .util .Collections ;
15
13
import java .util .Map ;
16
14
import java .util .logging .Level ;
17
15
import java .util .logging .Logger ;
18
-
19
16
import jenkins .model .Jenkins ;
20
- import org .htmlunit .ElementNotFoundException ;
21
- import org .htmlunit .html .DomElement ;
22
- import org .htmlunit .html .DomNodeList ;
23
- import org .htmlunit .html .HtmlAnchor ;
24
- import org .htmlunit .html .HtmlButton ;
25
- import org .htmlunit .html .HtmlElement ;
26
- import org .htmlunit .html .HtmlForm ;
27
- import org .htmlunit .html .HtmlFormUtil ;
28
- import org .htmlunit .html .HtmlInput ;
29
- import org .htmlunit .html .HtmlPage ;
17
+ import jenkins .model .JenkinsLocationConfiguration ;
30
18
import org .apache .commons .beanutils .PropertyUtils ;
31
19
import org .apache .commons .lang3 .RandomStringUtils ;
32
20
import org .apache .commons .lang3 .RandomUtils ;
36
24
import org .csanchez .jenkins .plugins .kubernetes .volumes .EmptyDirVolume ;
37
25
import org .csanchez .jenkins .plugins .kubernetes .volumes .PodVolume ;
38
26
import org .csanchez .jenkins .plugins .kubernetes .volumes .workspace .WorkspaceVolume ;
27
+ import org .htmlunit .html .DomElement ;
28
+ import org .htmlunit .html .DomNodeList ;
29
+ import org .htmlunit .html .HtmlElement ;
30
+ import org .htmlunit .html .HtmlForm ;
31
+ import org .htmlunit .html .HtmlInput ;
32
+ import org .htmlunit .html .HtmlPage ;
39
33
import org .junit .After ;
40
34
import org .junit .Rule ;
41
35
import org .junit .Test ;
42
36
import org .jvnet .hudson .test .JenkinsRule ;
43
37
import org .jvnet .hudson .test .LoggerRule ;
44
38
import org .jvnet .hudson .test .recipes .LocalData ;
45
39
46
- import jenkins .model .JenkinsLocationConfiguration ;
47
- import org .xml .sax .SAXException ;
48
-
49
40
public class KubernetesCloudTest {
50
41
51
42
@ Rule
@@ -62,18 +53,16 @@ public void tearDown() {
62
53
63
54
@ Test
64
55
public void configRoundTrip () throws Exception {
65
- KubernetesCloud cloud = new KubernetesCloud ("kubernetes" );
66
- PodTemplate podTemplate = new PodTemplate ();
56
+ var cloud = new KubernetesCloud ("kubernetes" );
57
+ var podTemplate = new PodTemplate ();
67
58
podTemplate .setName ("test-template" );
68
59
podTemplate .setLabel ("test" );
69
60
cloud .addTemplate (podTemplate );
70
- j .jenkins .clouds .add (cloud );
71
- j .jenkins .save ();
72
- JenkinsRule .WebClient wc = j .createWebClient ();
73
- HtmlPage p = wc .goTo ("cloud/kubernetes/configure" );
74
- HtmlForm f = p .getFormByName ("config" );
75
- j .submit (f );
76
- assertEquals ("PodTemplate{id='" +podTemplate .getId ()+"', name='test-template', label='test'}" , podTemplate .toString ());
61
+ var jenkins = j .jenkins ;
62
+ jenkins .clouds .add (cloud );
63
+ jenkins .save ();
64
+ j .submit (j .createWebClient ().goTo ("cloud/kubernetes/configure" ).getFormByName ("config" ));
65
+ assertEquals (cloud , jenkins .clouds .get (KubernetesCloud .class ));
77
66
}
78
67
79
68
@ Test
0 commit comments