-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #955 from aml-org/r/v6.0.1
R/v6.0.1 W-13999714
- Loading branch information
Showing
120 changed files
with
526 additions
and
496 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
als-common/shared/src/main/scala/org/mulesoft/als/common/DirectoryResolver.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
package org.mulesoft.als.common | ||
|
||
import amf.core.internal.remote.File | ||
import amf.core.internal.unsafe.PlatformSecrets | ||
import org.mulesoft.als.common.URIImplicits._ | ||
|
||
import scala.concurrent.Future | ||
|
||
trait DirectoryResolver { | ||
val FilePrefix = "file://" | ||
trait DirectoryResolver extends PlatformSecrets { | ||
def exists(path: String): Future[Boolean] | ||
|
||
def readDir(path: String): Future[Seq[String]] | ||
|
||
def isDirectory(path: String): Future[Boolean] | ||
|
||
def toPath(uri: String): String = | ||
File.unapply(uri).getOrElse(uri) | ||
uri.toPath(platform) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
als-common/shared/src/test/scala/org/mulesoft/als/common/DirectoryResolverTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.mulesoft.als.common | ||
|
||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
import scala.concurrent.Future | ||
|
||
class DirectoryResolverTest extends AnyFlatSpec with Matchers { | ||
|
||
private val dr = new DirectoryResolver { | ||
override def exists(path: String): Future[Boolean] = ??? | ||
|
||
override def readDir(path: String): Future[Seq[String]] = ??? | ||
|
||
override def isDirectory(path: String): Future[Boolean] = ??? | ||
} | ||
|
||
behavior of "Directory Resolver" | ||
|
||
it should "transform simple absolute URI to Path" in { | ||
dr.toPath("file:///my/path") shouldBe "/my/path" | ||
} | ||
|
||
it should "transform simple relative URI to Path" in { | ||
dr.toPath("file://my/path") shouldBe "my/path" | ||
} | ||
|
||
it should "transform URI with spaces to Path" in { | ||
dr.toPath("file:///my/path%20with%20spaces") shouldBe "/my/path with spaces" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.