Example usage for java.util Collections enumeration

List of usage examples for java.util Collections enumeration

Introduction

In this page you can find the example usage for java.util Collections enumeration.

Prototype

public static <T> Enumeration<T> enumeration(final Collection<T> c) 

Source Link

Document

Returns an enumeration over the specified collection.

Usage

From source file:com.hp.alm.ali.idea.entity.tree.EntityNode.java

public Enumeration children() {
    initChildren();
    return Collections.enumeration(getFiltered());
}

From source file:com.adobe.acs.commons.http.headers.impl.AbstractExpiresHeaderFilterTest.java

@Test
public void testAcceptsHasExpiresHeader() throws Exception {

    expires.add("Some Expires Header");

    when(request.getHeaders(AbstractExpiresHeaderFilter.EXPIRES_NAME))
            .thenReturn(Collections.enumeration(expires));

    boolean result = filter.accepts(request);
    assertFalse(result);/*from   w  w  w.  j  ava 2s . c  o  m*/

    verify(request).getHeaders(AbstractExpiresHeaderFilter.EXPIRES_NAME);
}

From source file:com.enonic.cms.server.service.dwr.DwrServletWrapper.java

@Override
public void init(final ServletConfig config) throws ServletException {
    final ConfigProperties configProperties = getConfigProperties(config.getServletContext());

    final Map<String, String> params = new HashMap<String, String>();
    params.put("debug", configProperties.getProperty("cms.admin.dwr.debug", "false"));
    params.put("crossDomainSessionSecurity",
            configProperties.getProperty("cms.admin.dwr.crossDomainSessionSecurity", "false"));
    params.put("classes", this.classes.toString());

    final ServletConfig wrapper = new ServletConfig() {
        public String getServletName() {
            return config.getServletName();
        }//from   w  ww. ja v  a2s.c  o  m

        public ServletContext getServletContext() {
            return config.getServletContext();
        }

        public String getInitParameter(final String name) {
            return params.get(name);
        }

        public Enumeration getInitParameterNames() {
            return Collections.enumeration(params.keySet());
        }
    };

    super.init(wrapper);
}

From source file:com.github.achatain.nopasswordauthentication.utils.FakeHttpServletRequest.java

public Enumeration<String> getParameterNames() {
    return Collections.enumeration(this.parameters.keySet());
}

From source file:io.wcm.caravan.io.http.impl.servletclient.HttpServletRequestMapper.java

@Override
public Enumeration<String> getParameterNames() {
    return Collections.enumeration(getParameterMap().keySet());
}

From source file:org.kawanfw.sql.tomcat.util.LinkedProperties.java

@Override
public Enumeration<?> propertyNames() {

    Set<String> orderedPropNamesNew = new LinkedHashSet<String>();

    for (Iterator<String> iterator = orderedPropNames.iterator(); iterator.hasNext();) {
        String propertyName = (String) iterator.next();

        if (super.containsKey(propertyName)) {
            orderedPropNamesNew.add(propertyName);
        }// w  ww . j  ava2  s .  co  m
    }

    return Collections.enumeration(orderedPropNamesNew);

}

From source file:com.google.gerrit.util.http.testutil.FakeHttpServletRequest.java

@Override
public Enumeration<Locale> getLocales() {
    return Collections.enumeration(Collections.singleton(Locale.US));
}

From source file:org.dspace.statistics.util.DummyHttpServletRequest.java

@Override
public Enumeration getHeaderNames() {
    return Collections.enumeration(headers.keySet());
}

From source file:org.jasig.portal.security.provider.PersonImpl.java

/**
 * Returns an enumeration of all of the attribute names associated with the user
 * @return enumeration of all of the attribute names associated with the user
 */// w  ww .  ja v  a2s  .c  o  m
public Enumeration<String> getAttributeNames() {
    if (this.userAttributes == null) {
        return null;
    }

    final Set<String> names = this.userAttributes.keySet();
    return Collections.enumeration(names);
}

From source file:spring.travel.site.request.RequestInfoInterceptorTest.java

@Test
public void shouldSetRequestInfoAttributeIfSessionCookieIsPresent() throws Exception {
    String cookieValue = "90348039864-id=111";
    List<String> cookies = Arrays.asList(cookieName + "=\"" + cookieValue + "\"");
    when(request.getHeaders("Cookie")).thenReturn(Collections.enumeration(cookies));

    assertTrue(interceptor.preHandle(request, response, new Object()));

    verify(request, times(1)).setAttribute(eq(attributeName), requestCaptor.capture());
    Request requestInfo = requestCaptor.getValue();

    assertEquals(Optional.of(cookieValue), requestInfo.getCookieValue());
    assertEquals(ipAddress, requestInfo.getRemoteAddress());
    assertEquals(Optional.empty(), requestInfo.getUser());
}