Search in sources :

Example 1 with DocumenterEntry

use of com.emc.storageos.svcs.errorhandling.utils.Documenter.DocumenterEntry in project coprhd-controller by CoprHD.

the class DocumenterTest method serviceCodeToStatus.

@Test
public void serviceCodeToStatus() {
    final Collection<DocumenterEntry> entries = Documenter.createEntries();
    final Map<ServiceCode, Set<StatusType>> serviceToStatus = new HashMap<ServiceCode, Set<StatusType>>();
    for (final DocumenterEntry entry : entries) {
        if (!serviceToStatus.containsKey(entry.getCode())) {
            serviceToStatus.put(entry.getCode(), new HashSet<StatusType>());
        }
        serviceToStatus.get(entry.getCode()).add(entry.getStatus());
    }
    final Map<ServiceCode, Set<StatusType>> failures = new HashMap<ServiceCode, Set<StatusType>>();
    for (final Entry<ServiceCode, Set<StatusType>> entry : serviceToStatus.entrySet()) {
        if (entry.getValue().size() > 1) {
            failures.put(entry.getKey(), entry.getValue());
        }
    }
    assertTrue("Some service codes map to more than one HTTP status code: " + failures, failures.isEmpty());
}
Also used : ServiceCode(com.emc.storageos.svcs.errorhandling.resources.ServiceCode) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) StatusType(javax.ws.rs.core.Response.StatusType) DocumenterEntry(com.emc.storageos.svcs.errorhandling.utils.Documenter.DocumenterEntry) Test(org.junit.Test)

Aggregations

ServiceCode (com.emc.storageos.svcs.errorhandling.resources.ServiceCode)1 DocumenterEntry (com.emc.storageos.svcs.errorhandling.utils.Documenter.DocumenterEntry)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 StatusType (javax.ws.rs.core.Response.StatusType)1 Test (org.junit.Test)1