Arsnael commented on code in PR #2177:
URL: https://github.com/apache/james-project/pull/2177#discussion_r1560408532


##########
server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/VacationIntegrationTest.scala:
##########
@@ -0,0 +1,447 @@
+/****************************************************************
+ * 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.rfc8621.contract
+
+import java.nio.charset.StandardCharsets
+import java.util.concurrent.TimeUnit
+
+import io.netty.handler.codec.http.HttpHeaderNames.ACCEPT
+import io.restassured.RestAssured
+import io.restassured.RestAssured.`given`
+import io.restassured.builder.ResponseSpecBuilder
+import io.restassured.http.ContentType.JSON
+import net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson
+import org.apache.http.HttpStatus.SC_OK
+import org.apache.james.GuiceJamesServer
+import org.apache.james.core.Username
+import org.apache.james.jmap.JMAPTestingConstants.DOMAIN
+import org.apache.james.jmap.JmapGuiceProbe
+import org.apache.james.jmap.api.model.AccountId
+import org.apache.james.jmap.http.UserCredential
+import 
org.apache.james.jmap.rfc8621.contract.Fixture.{ACCEPT_RFC8621_VERSION_HEADER, 
ACCOUNT_ID, ANDRE, ANDRE_ACCOUNT_ID, ANDRE_PASSWORD, BOB, BOB_PASSWORD, 
authScheme, baseRequestSpecBuilder}
+import 
org.apache.james.jmap.rfc8621.contract.VacationIntegrationTest.{andreDraftsPath,
 html_reason, original_message_text_body, reason}
+import org.apache.james.junit.categories.BasicFeature
+import org.apache.james.mailbox.DefaultMailboxes
+import org.apache.james.mailbox.MessageManager.AppendCommand
+import org.apache.james.mailbox.model.{MailboxConstants, MailboxId, 
MailboxPath, MessageId}
+import org.apache.james.mime4j.dom.Message
+import org.apache.james.modules.MailboxProbeImpl
+import org.apache.james.utils.DataProbeImpl
+import org.apache.james.vacation.api.VacationPatch
+import org.awaitility.Awaitility
+import org.awaitility.Durations.ONE_HUNDRED_MILLISECONDS
+import org.junit.experimental.categories.Category
+import org.junit.jupiter.api.{BeforeEach, Test}
+
+object VacationIntegrationTest {
+  private val reason = "Message explaining my wonderful vacations"
+  private val html_reason = "<b>" + reason + "</b>"
+  private val original_message_text_body = "Hello someone, and thank you for 
joining example.com!"
+  private val andreDraftsPath = MailboxPath.forUser(ANDRE, 
DefaultMailboxes.DRAFTS)
+}
+
+trait VacationIntegrationTest {
+  private lazy val slowPacedPollInterval = ONE_HUNDRED_MILLISECONDS
+  private lazy val calmlyAwait = Awaitility.`with`
+    .pollInterval(slowPacedPollInterval)
+    .and.`with`.pollDelay(slowPacedPollInterval)
+    .await
+  private lazy val awaitAtMostTenSeconds = calmlyAwait.atMost(10, 
TimeUnit.SECONDS)
+
+  @BeforeEach
+  def setUp(server: GuiceJamesServer): Unit = {
+    server.getProbe(classOf[DataProbeImpl])
+      .fluent
+      .addDomain(DOMAIN)
+      .addUser(BOB.asString, BOB_PASSWORD)
+      .addUser(ANDRE.asString, ANDRE_PASSWORD)
+
+    val mailboxProbe = server.getProbe(classOf[MailboxProbeImpl])
+    mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, BOB.asString, 
DefaultMailboxes.SENT)
+    mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, 
ANDRE.asString, DefaultMailboxes.SENT)
+
+    mailboxProbe.createMailbox(andreDraftsPath)
+
+    RestAssured.requestSpecification = baseRequestSpecBuilder(server)
+      .setAuth(authScheme(UserCredential(BOB, BOB_PASSWORD)))
+      .build
+  }
+
+  @Category(Array(classOf[BasicFeature]))
+  @Test
+  def jmapVacationShouldGenerateAReplyWhenActive(server: GuiceJamesServer): 
Unit = {
+    /* Test scenario :
+      - bob sets a Vacation on its account
+      - andre [email protected] sends bob a mail
+      - bob should well receive this mail
+      - andre should well receive a notification about bob vacation
+    */
+
+    val mailboxProbe = server.getProbe(classOf[MailboxProbeImpl])

Review Comment:
   I chose not to. For the simple reason that I need the mailbox ids and with 
scala if I add vars in the class for that, it asks me to override and implement 
them in the memory and distributed class of the contract, which I found 
particularly annoying and unecessary



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to