You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2020/09/15 10:44:46 UTC

[james-project] 20/25: JAMES-3373 Session object: update download endpoint

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 3d4d1f0ef642365a7a5fa193f6d128f0f5bd4719
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Sep 10 17:39:47 2020 +0700

    JAMES-3373 Session object: update download endpoint
---
 .../apache/james/jmap/rfc8621/contract/SessionRoutesContract.scala    | 2 +-
 .../scala/org/apache/james/jmap/model/JmapRfc8621Configuration.scala  | 3 +--
 .../src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala | 3 ++-
 .../org/apache/james/jmap/model/JmapRfc8621ConfigurationTest.scala    | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/SessionRoutesContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/SessionRoutesContract.scala
index 3ad54f4..292a50a 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/SessionRoutesContract.scala
+++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/SessionRoutesContract.scala
@@ -102,7 +102,7 @@ object SessionRoutesContract {
                          |  },
                          |  "username" : "bob@domain.tld",
                          |  "apiUrl" : "http://domain.com/jmap",
-                         |  "downloadUrl" : "http://domain.com/download",
+                         |  "downloadUrl" : "http://domain.com/download/$accountId/$blobId/?type=$type&name=$name",
                          |  "uploadUrl" : "http://domain.com/upload",
                          |  "eventSourceUrl" : "http://domain.com/eventSource",
                          |  "state" : "000001"
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/JmapRfc8621Configuration.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/JmapRfc8621Configuration.scala
index dbd5654..8865d05 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/JmapRfc8621Configuration.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/JmapRfc8621Configuration.scala
@@ -21,7 +21,6 @@ package org.apache.james.jmap.model
 
 import java.net.URL
 
-import eu.timepit.refined.api.Refined
 import org.apache.commons.configuration2.Configuration
 
 object JmapRfc8621Configuration {
@@ -37,7 +36,7 @@ object JmapRfc8621Configuration {
 case class JmapRfc8621Configuration(urlPrefixString: String) {
   val urlPrefix: URL = new URL(urlPrefixString)
   val apiUrl: URL = new URL(s"$urlPrefixString/jmap")
-  val downloadUrl: URL = new URL(s"$urlPrefixString/download")
+  val downloadUrl: URL = new URL(urlPrefixString + "/download/$accountId/$blobId/?type=$type&name=$name")
   val uploadUrl: URL = new URL(s"$urlPrefixString/upload")
   val eventSourceUrl: URL = new URL(s"$urlPrefixString/eventSource")
 }
diff --git a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala
index e908b22..6d9cdf1 100644
--- a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala
+++ b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/SessionRoutesTest.scala
@@ -98,6 +98,7 @@ class SessionRoutesTest extends AnyFlatSpec with BeforeAndAfter with Matchers {
       .thenReturn
         .getBody
         .asString()
+    val downloadPath: String = "download/$accountId/$blobId/?type=$type&name=$name"
     val expectedJson = s"""{
                          |  "capabilities" : {
                          |    "urn:ietf:params:jmap:core" : {
@@ -161,7 +162,7 @@ class SessionRoutesTest extends AnyFlatSpec with BeforeAndAfter with Matchers {
                          |  },
                          |  "username" : "bob@james.org",
                          |  "apiUrl" : "${JmapRfc8621Configuration.LOCALHOST_URL_PREFIX}/jmap",
-                         |  "downloadUrl" : "${JmapRfc8621Configuration.LOCALHOST_URL_PREFIX}/download",
+                         |  "downloadUrl" : "${JmapRfc8621Configuration.LOCALHOST_URL_PREFIX}/$downloadPath",
                          |  "uploadUrl" : "${JmapRfc8621Configuration.LOCALHOST_URL_PREFIX}/upload",
                          |  "eventSourceUrl" : "${JmapRfc8621Configuration.LOCALHOST_URL_PREFIX}/eventSource",
                          |  "state" : "000001"
diff --git a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/model/JmapRfc8621ConfigurationTest.scala b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/model/JmapRfc8621ConfigurationTest.scala
index 16af554..d483d80 100644
--- a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/model/JmapRfc8621ConfigurationTest.scala
+++ b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/model/JmapRfc8621ConfigurationTest.scala
@@ -42,7 +42,7 @@ class JmapRfc8621ConfigurationTest extends AnyWordSpec with Matchers {
       val jmapRfc8621Configuration: JmapRfc8621Configuration = JmapRfc8621Configuration.from(providedConfiguration())
 
       jmapRfc8621Configuration.apiUrl must be(new URL("http://random-domain.com/jmap"))
-      jmapRfc8621Configuration.downloadUrl must be(new URL("http://random-domain.com/download"))
+      jmapRfc8621Configuration.downloadUrl must be(new URL("http://random-domain.com/download/$accountId/$blobId/?type=$type&name=$name "))
       jmapRfc8621Configuration.uploadUrl must be(new URL("http://random-domain.com/upload"))
       jmapRfc8621Configuration.eventSourceUrl must be(new URL("http://random-domain.com/eventSource"))
     }
@@ -51,7 +51,7 @@ class JmapRfc8621ConfigurationTest extends AnyWordSpec with Matchers {
       val jmapRfc8621Configuration: JmapRfc8621Configuration = JmapRfc8621Configuration.from(emptyConfiguration)
 
       jmapRfc8621Configuration.apiUrl must be(new URL("http://localhost/jmap"))
-      jmapRfc8621Configuration.downloadUrl must be(new URL("http://localhost/download"))
+      jmapRfc8621Configuration.downloadUrl must be(new URL("http://localhost/download/$accountId/$blobId/?type=$type&name=$name"))
       jmapRfc8621Configuration.uploadUrl must be(new URL("http://localhost/upload"))
       jmapRfc8621Configuration.eventSourceUrl must be(new URL("http://localhost/eventSource"))
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org