MAILBOX-318 Merge SetMailboxes stepdefs together
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/30483cf1 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/30483cf1 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/30483cf1 Branch: refs/heads/master Commit: 30483cf18fe1075b0ec9bb934200e8877fdbbde2 Parents: b3262f5 Author: Antoine Duprat <[email protected]> Authored: Fri Nov 3 10:59:01 2017 +0100 Committer: Antoine Duprat <[email protected]> Committed: Tue Nov 7 15:33:42 2017 +0100 ---------------------------------------------------------------------- .../integration/cucumber/MailboxStepdefs.java | 61 -------------------- .../cucumber/SetMailboxesMethodStepdefs.java | 23 ++++++++ 2 files changed, 23 insertions(+), 61 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/30483cf1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MailboxStepdefs.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MailboxStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MailboxStepdefs.java deleted file mode 100644 index fca2cb9..0000000 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MailboxStepdefs.java +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you 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 org.apache.james.jmap.methods.integration.cucumber; - -import javax.inject.Inject; - -import org.apache.james.mailbox.model.MailboxACL; -import org.apache.james.mailbox.model.MailboxConstants; -import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.modules.ACLProbeImpl; - -import cucumber.api.java.en.Given; -import cucumber.runtime.java.guice.ScenarioScoped; - -@ScenarioScoped -public class MailboxStepdefs { - - private final MainStepdefs mainStepdefs; - - @Inject - private MailboxStepdefs(MainStepdefs mainStepdefs) { - this.mainStepdefs = mainStepdefs; - } - - @Given("^\"([^\"]*)\" has a mailbox \"([^\"]*)\"$") - public void createMailbox(String username, String mailbox) throws Throwable { - mainStepdefs.mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, mailbox); - } - - @Given("^\"([^\"]*)\" shares its mailbox \"([^\"]*)\" with rights \"([^\"]*)\" with \"([^\"]*)\"$") - public void shareMailboxWithRight(String owner, String mailbox, String rights, String shareTo) throws Throwable { - MailboxPath mailboxPath = MailboxPath.forUser(owner, mailbox); - - mainStepdefs.aclProbe.replaceRights(mailboxPath, shareTo, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights(rights)); - } - - @Given("^\"([^\"]*)\" shares (?:his|her) mailbox \"([^\"]*)\" with \"([^\"]*)\" with \"([^\"]*)\" rights$") - public void shareMailbox(String owner, String mailbox, String shareTo, String rights) throws Throwable { - mainStepdefs.jmapServer.getProbe(ACLProbeImpl.class) - .replaceRights(MailboxPath.forUser(owner, mailbox), - shareTo, - MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights(rights)); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/30483cf1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java index f01e325..449a407 100644 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java @@ -30,8 +30,11 @@ import javax.inject.Inject; import javax.mail.Flags; import org.apache.james.mailbox.exception.MailboxException; +import org.apache.james.mailbox.model.MailboxACL; +import org.apache.james.mailbox.model.MailboxConstants; import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.store.mail.model.Mailbox; +import org.apache.james.modules.ACLProbeImpl; import com.github.fge.lambdas.Throwing; import com.jayway.awaitility.Awaitility; @@ -78,6 +81,26 @@ public class SetMailboxesMethodStepdefs { new ByteArrayInputStream(content.getBytes()), new Date(), false, new Flags()); } + @Given("^\"([^\"]*)\" has a mailbox \"([^\"]*)\"$") + public void createMailbox(String username, String mailbox) throws Throwable { + mainStepdefs.mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, mailbox); + } + + @Given("^\"([^\"]*)\" shares its mailbox \"([^\"]*)\" with rights \"([^\"]*)\" with \"([^\"]*)\"$") + public void shareMailboxWithRight(String owner, String mailbox, String rights, String shareTo) throws Throwable { + MailboxPath mailboxPath = MailboxPath.forUser(owner, mailbox); + + mainStepdefs.aclProbe.replaceRights(mailboxPath, shareTo, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights(rights)); + } + + @Given("^\"([^\"]*)\" shares (?:his|her) mailbox \"([^\"]*)\" with \"([^\"]*)\" with \"([^\"]*)\" rights$") + public void shareMailbox(String owner, String mailbox, String shareTo, String rights) throws Throwable { + mainStepdefs.jmapServer.getProbe(ACLProbeImpl.class) + .replaceRights(MailboxPath.forUser(owner, mailbox), + shareTo, + MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights(rights)); + } + @When("^renaming mailbox \"([^\"]*)\" to \"([^\"]*)\"") public void renamingMailbox(String actualMailboxName, String newMailboxName) throws Throwable { Mailbox mailbox = mainStepdefs.mailboxProbe.getMailbox("#private", userStepdefs.getConnectedUser(), actualMailboxName); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
