22
22
import static org .junit .jupiter .api .Assertions .fail ;
23
23
24
24
@ Testcontainers
25
- class ManagementTest extends TorchServeTestSupport {
25
+ public class ManagementTest extends TorchServeTestSupport {
26
26
27
27
private static final String DEFAULT_MODEL = "squeezenet1_1" ;
28
28
private static final String DEFAULT_MODEL_VERSION = "1.0" ;
@@ -31,7 +31,7 @@ class ManagementTest extends TorchServeTestSupport {
31
31
private static final String TEST_DATA_DIR = "src/test/resources/data" ;
32
32
33
33
@ Test
34
- void testRegisterModel () throws Exception {
34
+ public void testRegisterModel () throws Exception {
35
35
var url = "https://torchserve.pytorch.org/mar_files/mnist_v2.mar" ;
36
36
try {
37
37
var response = client .management ().registerModel (url , RegisterModelOptions .empty ());
@@ -46,7 +46,7 @@ void testRegisterModel() throws Exception {
46
46
class AfterRegisteringModel {
47
47
48
48
@ BeforeEach
49
- void registerModel () throws Exception {
49
+ public void registerModel () throws Exception {
50
50
var url = "https://torchserve.pytorch.org/mar_files/mnist_v2.mar" ;
51
51
try {
52
52
client .management ().registerModel (url , RegisterModelOptions .empty ());
@@ -56,13 +56,13 @@ void registerModel() throws Exception {
56
56
}
57
57
58
58
@ Test
59
- void testUnregisterModel () throws Exception {
59
+ public void testUnregisterModel () throws Exception {
60
60
var response = client .management ().unregisterModel (ADDED_MODEL , UnregisterModelOptions .empty ());
61
61
assertTrue (response .getStatus ().contains ("unregistered" ));
62
62
}
63
63
64
64
@ Test
65
- void testUnregisterModel_version () throws Exception {
65
+ public void testUnregisterModel_version () throws Exception {
66
66
var response = client .management ().unregisterModel (ADDED_MODEL , ADDED_MODEL_VERSION , UnregisterModelOptions .empty ());
67
67
assertTrue (response .getStatus ().contains ("unregistered" ));
68
68
}
@@ -71,12 +71,12 @@ void testUnregisterModel_version() throws Exception {
71
71
class BeforeUnregisteringModel {
72
72
73
73
@ AfterEach
74
- void unregisterModel () throws Exception {
74
+ public void unregisterModel () throws Exception {
75
75
client .management ().unregisterModel (ADDED_MODEL , UnregisterModelOptions .empty ());
76
76
}
77
77
78
78
@ Test
79
- void testSetAutoScale () throws Exception {
79
+ public void testSetAutoScale () throws Exception {
80
80
var response1 = client .management ().setAutoScale (ADDED_MODEL ,
81
81
SetAutoScaleOptions .builder ()
82
82
.minWorker (1 )
@@ -92,7 +92,7 @@ void testSetAutoScale() throws Exception {
92
92
}
93
93
94
94
@ Test
95
- void testSetAutoScale_version () throws Exception {
95
+ public void testSetAutoScale_version () throws Exception {
96
96
var response1 = client .management ().setAutoScale (ADDED_MODEL , ADDED_MODEL_VERSION ,
97
97
SetAutoScaleOptions .builder ()
98
98
.minWorker (1 )
@@ -109,22 +109,22 @@ void testSetAutoScale_version() throws Exception {
109
109
}
110
110
111
111
@ Test
112
- void testDescribeModel () throws Exception {
112
+ public void testDescribeModel () throws Exception {
113
113
var response = client .management ().describeModel (DEFAULT_MODEL );
114
114
assertEquals (1 , response .size ());
115
115
assertEquals ("squeezenet1_1" , response .get (0 ).getModelName ());
116
116
}
117
117
118
118
@ Test
119
- void testDescribeModel_version () throws Exception {
119
+ public void testDescribeModel_version () throws Exception {
120
120
var response = client .management ().describeModel (DEFAULT_MODEL , DEFAULT_MODEL_VERSION );
121
121
assertEquals (1 , response .size ());
122
122
assertEquals ("squeezenet1_1" , response .get (0 ).getModelName ());
123
123
assertEquals ("1.0" , response .get (0 ).getModelVersion ());
124
124
}
125
125
126
126
@ Test
127
- void testListModels () throws Exception {
127
+ public void testListModels () throws Exception {
128
128
int limit = 10 ;
129
129
String nextPageToken = null ;
130
130
var response = client .management ().listModels (limit , nextPageToken );
@@ -134,19 +134,19 @@ void testListModels() throws Exception {
134
134
}
135
135
136
136
@ Test
137
- void testSetDefault () throws Exception {
137
+ public void testSetDefault () throws Exception {
138
138
var response = client .management ().setDefault (DEFAULT_MODEL , DEFAULT_MODEL_VERSION );
139
139
assertTrue (response .getStatus ().contains ("Default vesion succsesfully updated" ));
140
140
}
141
141
142
142
@ Test
143
- void testApiDescription () throws Exception {
143
+ public void testApiDescription () throws Exception {
144
144
var response = client .management ().apiDescription ();
145
145
assertEquals ("TorchServe APIs" , response .getInfo ().get ("title" ));
146
146
}
147
147
148
148
@ Test
149
- void testToken () throws Exception {
149
+ public void testToken () throws Exception {
150
150
assertThrows (UnsupportedOperationException .class , () -> client .management ().token ("management" ));
151
151
}
152
152
0 commit comments