Example usage for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY

List of usage examples for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.

Prototype

String[] EMPTY_STRING_ARRAY

To view the source code for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.

Click Source Link

Document

An empty immutable String array.

Usage

From source file:net.sourceforge.vulcan.web.struts.CreateProjectFromUrlActionTest.java

public void testImportUrl() throws Exception {
    addRequestParameter("url", "http://www.example.com");
    addRequestParameter("nameCollisionResolutionMode", NameCollisionResolutionMode.Abort.name());
    addRequestParameter("labels", "x");
    addRequestParameter("newLabel", "y");

    final Set<String> labels = new HashSet<String>(Arrays.asList("x", "y"));

    projectImporter.createProjectsForUrl("http://www.example.com", "", "", false,
            NameCollisionResolutionMode.Abort, ArrayUtils.EMPTY_STRING_ARRAY, labels, status);

    replay();/*from w  ww. j  av a  2  s  . c o m*/

    actionPerform();

    verify();

    verifyNoActionErrors();

    verifyForward("success");
}

From source file:net.sourceforge.vulcan.web.struts.CreateProjectFromUrlActionTest.java

public void testHandlesConfigException() throws Exception {
    addRequestParameter("url", "http://www.example.com");
    addRequestParameter("nameCollisionResolutionMode", NameCollisionResolutionMode.UseExisting.name());

    projectImporter.createProjectsForUrl("http://www.example.com", "", "", false,
            NameCollisionResolutionMode.UseExisting, ArrayUtils.EMPTY_STRING_ARRAY,
            Collections.<String>emptySet(), status);

    expectLastCall().andThrow(new ConfigException("foo.bar", new Object[] { "a", "b" }));

    replay();//w w  w .  jav a2s .  c  o m

    actionPerform();

    verify();

    verifyInputForward();

    assertPropertyHasError(ActionMessages.GLOBAL_MESSAGE, "foo.bar");
}

From source file:net.sourceforge.vulcan.web.struts.CreateProjectFromUrlActionTest.java

public void testHandlesAuthException() throws Exception {
    addRequestParameter("url", "http://www.example.com");
    addRequestParameter("nameCollisionResolutionMode", NameCollisionResolutionMode.UseExisting.name());

    projectImporter.createProjectsForUrl("http://www.example.com", "", "", false,
            NameCollisionResolutionMode.UseExisting, ArrayUtils.EMPTY_STRING_ARRAY,
            Collections.<String>emptySet(), status);

    expectLastCall().andThrow(new AuthenticationRequiredRepositoryException("teresa"));

    replay();/*w  w w . j  av a  2 s  .  c  om*/

    actionPerform();

    verify();

    verifyInputForward();

    assertPropertyHasError(ActionMessages.GLOBAL_MESSAGE, "messages.repository.authentication.required");
    ProjectImportForm form = (ProjectImportForm) request.getSession().getAttribute("projectImportForm");

    assertTrue(form.isAuthenticationRequired());
    assertEquals("teresa", form.getUsername());
}

From source file:net.sourceforge.vulcan.web.struts.CreateProjectFromUrlActionTest.java

public void testHandlesStoreException() throws Exception {
    addRequestParameter("url", "http://www.example.com");
    addRequestParameter("nameCollisionResolutionMode", NameCollisionResolutionMode.Overwrite.name());

    projectImporter.createProjectsForUrl("http://www.example.com", "", "", false,
            NameCollisionResolutionMode.Overwrite, ArrayUtils.EMPTY_STRING_ARRAY,
            Collections.<String>emptySet(), status);
    expectLastCall().andThrow(new StoreException("a message", null));

    replay();/*from   w  w  w . ja  v  a2  s.com*/

    actionPerform();

    verify();

    verifyForward("failure");

    assertPropertyHasError(ActionMessages.GLOBAL_MESSAGE, "messages.save.failure");
}

From source file:net.sourceforge.vulcan.web.struts.CreateProjectFromUrlActionTest.java

public void testHandlesDuplicateNameException() throws Exception {
    addRequestParameter("url", "http://www.example.com");
    addRequestParameter("nameCollisionResolutionMode", NameCollisionResolutionMode.Abort.name());

    projectImporter.createProjectsForUrl("http://www.example.com", "", "", false,
            NameCollisionResolutionMode.Abort, ArrayUtils.EMPTY_STRING_ARRAY, Collections.<String>emptySet(),
            status);/* w ww .java2  s  . co m*/

    expectLastCall().andThrow(new DuplicateNameException("scuba"));

    replay();

    actionPerform();

    verify();

    verifyInputForward();

    assertPropertyHasError(ActionMessages.GLOBAL_MESSAGE, "errors.duplicate.project.name");
}

From source file:net.sourceforge.vulcan.web.struts.forms.ManualBuildForm.java

public void populateTagChoices(List<String> projectNames, List<List<RepositoryTagDto>> availableTags,
        List<String> workDirOverrides, DependencyGroup dependencyGroup) {
    this.projectNames = projectNames;
    this.availableTags = availableTags;
    this.dependencyGroup = dependencyGroup;
    if (workDirOverrides != null) {
        this.workDirOverrides = workDirOverrides.toArray(new String[workDirOverrides.size()]);
    } else {/*from w  w  w  .  java2s  . co  m*/
        this.workDirOverrides = ArrayUtils.EMPTY_STRING_ARRAY;
    }
}

From source file:net.sourceforge.vulcan.web.struts.forms.MultipleProjectConfigForm.java

@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    projectNames = ArrayUtils.EMPTY_STRING_ARRAY;
}

From source file:net.sourceforge.vulcan.web.struts.forms.ProjectImportForm.java

@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    schedulerNames = ArrayUtils.EMPTY_STRING_ARRAY;
    labels = ArrayUtils.EMPTY_STRING_ARRAY;
    username = StringUtils.EMPTY;//  w w  w . j a v  a  2s  .  c  o m
    password = StringUtils.EMPTY;
    authenticationRequired = false;

    final HttpSession session = request.getSession(false);
    if (session != null) {
        session.removeAttribute("projectImportStatus");
    }
}

From source file:ome.services.blitz.test.utests.PreprocessorTest.java

/**
 * Test conversion of nothing to nothing.
 */
@Test
public void testNothingToNothing() {
    process();

    assertRequests(ArrayUtils.EMPTY_STRING_ARRAY);
}

From source file:org.alfresco.test.BaseTest.java

/**
 * Helper to open page
 */
protected <P extends SharePage> P openPage(P page) {
    return openPage(page, ArrayUtils.EMPTY_STRING_ARRAY);
}