2
2
3
3
import com .googlecode .junittoolbox .ParallelRunner ;
4
4
import com .sun .org .apache .xml .internal .security .utils .Base64 ;
5
+ import com .walmartlabs .concord .server .api .GenericOperationResultResponse ;
5
6
import com .walmartlabs .concord .server .api .OperationResult ;
6
7
import com .walmartlabs .concord .server .api .PerformedActionType ;
7
- import com .walmartlabs .concord .server .api .inventory .*;
8
- import com .walmartlabs .concord .server .api .landing .CreateLandingResponse ;
9
- import com .walmartlabs .concord .server .api .landing .DeleteLandingResponse ;
10
- import com .walmartlabs .concord .server .api .landing .LandingEntry ;
11
- import com .walmartlabs .concord .server .api .landing .LandingPageResource ;
8
+ import com .walmartlabs .concord .server .api .org .inventory .*;
9
+ import com .walmartlabs .concord .server .api .org .landing .CreateLandingResponse ;
10
+ import com .walmartlabs .concord .server .api .org .landing .LandingEntry ;
11
+ import com .walmartlabs .concord .server .api .org .landing .LandingPageResource ;
12
12
import com .walmartlabs .concord .server .api .org .project .ProjectEntry ;
13
13
import com .walmartlabs .concord .server .api .org .project .RepositoryEntry ;
14
+ import com .walmartlabs .concord .server .api .org .secret .SecretEntry ;
14
15
import com .walmartlabs .concord .server .api .org .team .TeamEntry ;
15
16
import com .walmartlabs .concord .server .api .org .team .TeamUserEntry ;
16
- import com .walmartlabs .concord .server .api .org .secret .SecretEntry ;
17
17
import com .walmartlabs .concord .server .api .project .CreateProjectResponse ;
18
18
import com .walmartlabs .concord .server .api .project .DeleteProjectResponse ;
19
19
import com .walmartlabs .concord .server .api .project .ProjectResource ;
@@ -113,24 +113,24 @@ public void testLdapMappings() throws Exception {
113
113
public void testInventory () throws Exception {
114
114
InventoryResource inventoryResource = proxy (InventoryResource .class );
115
115
116
+ String orgName = OrganizationManager .DEFAULT_ORG_NAME ;
116
117
String inventoryName = "inventory_" + randomString ();
117
- String orgName = "Default" ;
118
118
119
119
// --- create
120
120
121
- CreateInventoryResponse cir = inventoryResource .createOrUpdate (new InventoryEntry (null , inventoryName , null , orgName , null ));
121
+ CreateInventoryResponse cir = inventoryResource .createOrUpdate (orgName , new InventoryEntry (inventoryName ));
122
122
assertTrue (cir .isOk ());
123
123
assertNotNull (cir .getId ());
124
124
125
125
// --- update
126
126
127
- CreateInventoryResponse uir = inventoryResource .createOrUpdate (new InventoryEntry (null , inventoryName , OrganizationManager . DEFAULT_ORG_ID , null , null ));
127
+ CreateInventoryResponse uir = inventoryResource .createOrUpdate (orgName , new InventoryEntry (inventoryName ));
128
128
assertTrue (uir .isOk ());
129
129
assertNotNull (uir .getId ());
130
130
131
131
// --- get
132
132
133
- InventoryEntry i1 = inventoryResource .get (inventoryName );
133
+ InventoryEntry i1 = inventoryResource .get (orgName , inventoryName );
134
134
assertNotNull (i1 );
135
135
assertNotNull (i1 .getId ());
136
136
assertEquals (uir .getId (), i1 .getId ());
@@ -140,38 +140,39 @@ public void testInventory() throws Exception {
140
140
141
141
// --- delete
142
142
143
- DeleteInventoryResponse dpr = inventoryResource .delete (inventoryName );
144
- assertTrue (dpr .isOk () );
143
+ GenericOperationResultResponse dpr = inventoryResource .delete (orgName , inventoryName );
144
+ assertTrue (dpr .getResult () == OperationResult . DELETED );
145
145
}
146
146
147
147
@ Test (timeout = 30000 )
148
148
public void testInventoryData () throws Exception {
149
149
InventoryDataResource resource = proxy (InventoryDataResource .class );
150
150
151
+ String orgName = OrganizationManager .DEFAULT_ORG_NAME ;
151
152
String inventoryName = "inventory_" + randomString ();
152
153
String itemPath = "/a" ;
153
154
Map <String , Object > data = Collections .singletonMap ("k" , "v" );
154
155
155
156
InventoryResource inventoryResource = proxy (InventoryResource .class );
156
- inventoryResource .createOrUpdate (new InventoryEntry (null , inventoryName , null , null , null ));
157
+ inventoryResource .createOrUpdate (orgName , new InventoryEntry (inventoryName ));
157
158
158
159
// --- create
159
160
160
161
@ SuppressWarnings ("unchecked" )
161
- Map <String , Object > result = (Map <String , Object >) resource .data (inventoryName , itemPath , data );
162
+ Map <String , Object > result = (Map <String , Object >) resource .data (orgName , inventoryName , itemPath , data );
162
163
assertNotNull (result );
163
164
assertEquals (Collections .singletonMap ("a" , data ), result );
164
165
165
166
// --- get
166
167
167
168
@ SuppressWarnings ("unchecked" )
168
- Map <String , Object > result2 = (Map <String , Object >) resource .get (inventoryName , itemPath );
169
+ Map <String , Object > result2 = (Map <String , Object >) resource .get (orgName , inventoryName , itemPath );
169
170
assertNotNull (result2 );
170
171
assertEquals (Collections .singletonMap ("a" , data ), result );
171
172
172
173
// --- delete
173
174
174
- DeleteInventoryDataResponse didr = resource .delete (inventoryName , itemPath );
175
+ DeleteInventoryDataResponse didr = resource .delete (orgName , inventoryName , itemPath );
175
176
assertNotNull (didr );
176
177
assertTrue (didr .isOk ());
177
178
}
@@ -180,28 +181,29 @@ public void testInventoryData() throws Exception {
180
181
public void testInventoryQuery () throws Exception {
181
182
InventoryQueryResource resource = proxy (InventoryQueryResource .class );
182
183
184
+ String orgName = OrganizationManager .DEFAULT_ORG_NAME ;
183
185
String inventoryName = "inventory_" + randomString ();
184
186
String queryName = "queryName_" + randomString ();
185
187
String text = "text_" + randomString ();
186
188
;
187
189
188
190
InventoryResource inventoryResource = proxy (InventoryResource .class );
189
- inventoryResource .createOrUpdate (new InventoryEntry (null , inventoryName , null , null , null ));
191
+ inventoryResource .createOrUpdate (orgName , new InventoryEntry (inventoryName ));
190
192
191
193
// --- create
192
194
193
- CreateInventoryQueryResponse cqr = resource .createOrUpdate (inventoryName , queryName , text );
195
+ CreateInventoryQueryResponse cqr = resource .createOrUpdate (orgName , inventoryName , queryName , text );
194
196
assertTrue (cqr .isOk ());
195
197
assertNotNull (cqr .getId ());
196
198
197
199
// --- update
198
200
String updatedText = "select cast(json_build_object('k', 'v') as varchar)" ;
199
- CreateInventoryQueryResponse uqr = resource .createOrUpdate (inventoryName , queryName , updatedText );
201
+ CreateInventoryQueryResponse uqr = resource .createOrUpdate (orgName , inventoryName , queryName , updatedText );
200
202
assertTrue (uqr .isOk ());
201
203
assertNotNull (uqr .getId ());
202
204
203
205
// --- get
204
- InventoryQueryEntry e1 = resource .get (inventoryName , queryName );
206
+ InventoryQueryEntry e1 = resource .get (orgName , inventoryName , queryName );
205
207
assertNotNull (e1 );
206
208
assertNotNull (e1 .getId ());
207
209
assertEquals (inventoryName , e1 .getInventoryName ());
@@ -210,13 +212,13 @@ public void testInventoryQuery() throws Exception {
210
212
211
213
// --- exec
212
214
@ SuppressWarnings ("unchecked" )
213
- List <Object > result = resource .exec (inventoryName , queryName , null );
215
+ List <Object > result = resource .exec (orgName , inventoryName , queryName , null );
214
216
assertNotNull (result );
215
217
Map <String , Object > m = (Map <String , Object >) result .get (0 );
216
218
assertEquals (Collections .singletonMap ("k" , "v" ), m );
217
219
218
220
// --- delete
219
- DeleteInventoryQueryResponse dqr = resource .delete (inventoryName , queryName );
221
+ DeleteInventoryQueryResponse dqr = resource .delete (orgName , inventoryName , queryName );
220
222
assertNotNull (dqr );
221
223
assertTrue (dqr .isOk ());
222
224
}
@@ -238,26 +240,22 @@ public void testLanding() throws Exception {
238
240
239
241
// --- create
240
242
LandingEntry entry = new LandingEntry (null , null , null , null , projectName , repositoryName , name , description , icon );
241
- CreateLandingResponse result = resource .createOrUpdate (entry );
243
+ CreateLandingResponse result = resource .createOrUpdate (OrganizationManager . DEFAULT_ORG_NAME , entry );
242
244
assertNotNull (result );
243
245
assertTrue (result .isOk ());
244
246
assertNotNull (result .getId ());
245
247
assertEquals (OperationResult .CREATED , result .getResult ());
246
248
247
249
// --- update
248
- result = resource .createOrUpdate (new LandingEntry (result .getId (), null , null , null , projectName , repositoryName , name , description , icon ));
250
+ result = resource .createOrUpdate (OrganizationManager . DEFAULT_ORG_NAME , new LandingEntry (result .getId (), null , null , null , projectName , repositoryName , name , description , icon ));
249
251
assertNotNull (result );
250
252
assertTrue (result .isOk ());
251
253
assertNotNull (result .getId ());
252
254
assertEquals (OperationResult .UPDATED , result .getResult ());
253
255
254
256
// --- list
255
- List <LandingEntry > listResult = resource .list ();
257
+ List <LandingEntry > listResult = resource .list (OrganizationManager . DEFAULT_ORG_NAME );
256
258
assertNotNull (listResult );
257
-
258
- // --- delete
259
- DeleteLandingResponse deleteResult = resource .delete (result .getId ());
260
- assertNotNull (deleteResult );
261
259
}
262
260
263
261
private static ProjectEntry findProject (List <ProjectEntry > l , String name ) {
0 commit comments