Add top level /config REST API
/config/server/ part is hard coded for now, but we may add more config specific resource names later. /config/server/capabilities retrieves the known server wide capabilities list. The list has to be loaded dynamically from the server to permit plugins to declare their own capabilities. Change-Id: I83692bd021925d37659bfbc88b3e3b67b92c18c1
This commit is contained in:
committed by
Shawn Pearce
parent
665c2a88d3
commit
28b8ea6f9e
@@ -0,0 +1,39 @@
|
||||
// Copyright (C) 2013 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.google.gerrit.common.data.GlobalCapability;
|
||||
import com.google.gerrit.server.config.ListCapabilities.CapabilityInfo;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ListCapabilitiesTest {
|
||||
@Test
|
||||
public void testList() throws Exception {
|
||||
Map<String, CapabilityInfo> m =
|
||||
new ListCapabilities().apply(new ConfigResource());
|
||||
for (String id : GlobalCapability.getAllNames()) {
|
||||
assertTrue("contains " + id, m.containsKey(id));
|
||||
assertEquals(id, m.get(id).id);
|
||||
assertNotNull(id + " has name", m.get(id).name);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user