Skip to content

Commit

Permalink
Merge pull request #684 from aml-org/publish-6.7.0
Browse files Browse the repository at this point in the history
W-17312785: Publish 6.7.0
  • Loading branch information
damianpedra authored Dec 11, 2024
2 parents 41e0d49 + cf1f91f commit 98c1b82
Show file tree
Hide file tree
Showing 47 changed files with 453 additions and 537 deletions.
4 changes: 2 additions & 2 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=17.0.10-tem
scala=2.12.15
sbt=1.7.3
scala=2.12.20
sbt=1.10.4
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM ghcr.io/aml-org/amf-ci-tools-base-image:1.3.2
FROM ghcr.io/aml-org/amf-ci-tools-base-image:1.4.0
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pipeline {
}
}
steps {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sonarqube-official', passwordVariable: 'SONAR_SERVER_TOKEN', usernameVariable: 'SONAR_SERVER_URL']]) {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sf-sonarqube-official', passwordVariable: 'SONAR_SERVER_TOKEN', usernameVariable: 'SONAR_SERVER_URL']]) {
script {
lastStage = env.STAGE_NAME
sh 'sbt -Dsonar.host.url=${SONAR_SERVER_URL} -Dsonar.login=${SONAR_SERVER_TOKEN} sonarScan'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import amf.core.client.platform.model.StrField
import amf.aml.client.platform.model.domain.{DocumentsModel, External, SemanticExtension}
import amf.core.client.platform.model.document.{BaseUnit, DeclaresModel, EncodesModel}
import amf.aml.client.scala.model.document.{Dialect => InternalDialect}
import com.github.ghik.silencer.silent

import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel}

Expand All @@ -21,22 +22,28 @@ case class Dialect(private[amf] val _internal: InternalDialect) extends BaseUnit
def documents(): DocumentsModel = DocumentsModel(_internal.documents())
def extensions(): ClientList[SemanticExtension] = _internal.extensions().asClient

@deprecated("Useless functionality", "AML 6.0.3")
// @deprecated("Useless functionality", "AML 6.0.3")
@silent
def header: String = _internal.header

@deprecated("Useless functionality", "AML 6.0.3")
// @deprecated("Useless functionality", "AML 6.0.3")
@silent
def isLibraryHeader(header: String): Boolean = _internal.isLibraryHeader(header)

@deprecated("Useless functionality", "AML 6.0.3")
// @deprecated("Useless functionality", "AML 6.0.3")
@silent
def isFragmentHeader(header: String): Boolean = _internal.isFragmentHeader(header)

@deprecated("Useless functionality", "AML 6.0.3")
// @deprecated("Useless functionality", "AML 6.0.3")
@silent
def libraryHeader: ClientOption[String] = _internal.libraryHeader.asClient

@deprecated("Useless functionality", "AML 6.0.3")
// @deprecated("Useless functionality", "AML 6.0.3")
@silent
def fragmentHeaders: ClientList[String] = _internal.fragmentHeaders.asClient

@deprecated("Useless functionality", "AML 6.0.3")
// @deprecated("Useless functionality", "AML 6.0.3")
@silent
def allHeaders: ClientList[String] = _internal.allHeaders.asClient

def withName(name: String): Dialect = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import amf.aml.internal.convert.VocabulariesClientConverter._
import amf.aml.internal.convert.VocabulariesClientConverter.ClientList
import amf.core.client.platform.model.StrField
import amf.core.client.platform.model.document.BaseUnit
import com.github.ghik.silencer.silent

import scala.scalajs.js.annotation.JSExportAll

Expand All @@ -18,19 +19,23 @@ trait DialectInstanceUnit extends BaseUnit {
this
}

@deprecated("Use processingData.definedBy instead", "AML 6.0.0")
// @deprecated("Use processingData.definedBy instead", "AML 6.0.0")
@silent
def definedBy(): StrField = _internal.definedBy()

@deprecated("Use processingData.graphDependencies instead", "AML 6.0.0")
// @deprecated("Use processingData.graphDependencies instead", "AML 6.0.0")
@silent
def graphDependencies(): ClientList[StrField] = _internal.graphDependencies.asClient

@deprecated("Use processingData.withDefinedBy instead", "AML 6.0.0")
// @deprecated("Use processingData.withDefinedBy instead", "AML 6.0.0")
@silent
def withDefinedBy(dialectId: String): this.type = {
_internal.withDefinedBy(dialectId)
this
}

@deprecated("Use processingData.withGraphDependencies instead", "AML 6.0.0")
// @deprecated("Use processingData.withGraphDependencies instead", "AML 6.0.0")
@silent
def withGraphDependencies(ids: ClientList[String]): this.type = {
_internal.withGraphDependencies(ids.asInternal)
this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import amf.core.internal.metamodel.Type
import amf.core.internal.metamodel.document.DocumentModel.Encodes
import amf.core.internal.metamodel.document.ModuleModel.{Declares, References}
import amf.core.internal.parser.domain.{Annotations, Fields}
import org.mulesoft.common.collections._
import org.mulesoft.common.core._

case class Dialect(fields: Fields, annotations: Annotations)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package amf.core.common

import amf.core.internal.unsafe.PlatformSecrets
import org.scalatest.funsuite.AsyncFunSuite

import scala.concurrent.ExecutionContext

trait AsyncFunSuiteWithPlatformGlobalExecutionContext extends AsyncFunSuite with PlatformSecrets {
override implicit def executionContext: ExecutionContext = platform.globalExecutionContext
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package amf.core.io

import amf.core.internal.unsafe.PlatformSecrets
import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext
import org.mulesoft.common.io.{AsyncFile, FileSystem}
import org.mulesoft.common.test.Tests.checkDiff
import org.scalatest.Assertion

import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.Future

trait FileAssertionTest extends PlatformSecrets {

private implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global
trait FileAssertionTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext {

protected val fs: FileSystem = platform.fs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import amf.core.internal.remote.Syntax.Syntax
import amf.core.io.FileAssertionTest
import amf.testing.common.utils.AMFRenderer

import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.Future

trait BuildCycleTestCommon extends FileAssertionTest {

implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global

def basePath: String

case class CycleConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@ package amf.testing.common.cycling

import amf.testing.common.jsonld.MultiJsonLDAsyncFunSuite

import scala.concurrent.ExecutionContext

abstract class FunSuiteCycleTests extends MultiJsonLDAsyncFunSuite with BuildCycleTests {
override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global
}
abstract class FunSuiteCycleTests extends MultiJsonLDAsyncFunSuite with BuildCycleTests {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@ package amf.testing.common.cycling

import amf.testing.common.jsonld.MultiJsonLDAsyncFunSuite

import scala.concurrent.ExecutionContext

abstract class FunSuiteRdfCycleTests extends MultiJsonLDAsyncFunSuite with BuildCycleRdfTests {
override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global
}
abstract class FunSuiteRdfCycleTests extends MultiJsonLDAsyncFunSuite with BuildCycleRdfTests {}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package amf.testing.common.jsonld

import amf.core.client.scala.config.RenderOptions
import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext
import amf.core.internal.plugins.document.graph.{EmbeddedForm, FlattenedForm, JsonLdDocumentForm}
import amf.testing.common.jsonld
import org.scalactic.Fail
import org.scalatest.Assertion
import org.scalatest.funsuite.AsyncFunSuite

import scala.concurrent.Future

/** Cycle tests using temporary file and directory creator
*/
abstract class MultiJsonLDAsyncFunSuite extends AsyncFunSuite {
abstract class MultiJsonLDAsyncFunSuite extends AsyncFunSuiteWithPlatformGlobalExecutionContext {
def testedForms: Seq[JsonLdDocumentForm] = Seq(FlattenedForm, EmbeddedForm)

def defaultRenderOptions: RenderOptions = RenderOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package amf.testing.common.utils

import amf.aml.client.scala.AMLConfiguration
import amf.core.client.scala.validation.AMFValidationReport
import amf.core.internal.unsafe.PlatformSecrets
import org.scalatest.funsuite.AsyncFunSuite
import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext

import scala.concurrent.Future

trait DialectInstanceValidation
extends AsyncFunSuite
with PlatformSecrets
extends AsyncFunSuiteWithPlatformGlobalExecutionContext
with DialectRegistrationHelper
with AMLParsingHelper {

Expand All @@ -25,7 +23,7 @@ trait DialectInstanceValidation
val instancePath = s"$path/$instance"
val client = config.baseUnitClient()
for {
dialectResult <- client.parseDialect(s"$path/$dialect")
dialectResult <- client.parseDialect(dialectPath)
nextConfig = config.withDialect(dialectResult.dialect)
instanceResult <- nextConfig.baseUnitClient().parseDialectInstance(instancePath)
report <- {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package amf.testing.common.utils

import amf.aml.client.scala.AMLConfiguration
import amf.core.client.scala.validation.AMFValidationReport
import amf.core.internal.unsafe.PlatformSecrets
import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext
import org.scalatest.Assertion
import org.scalatest.funsuite.AsyncFunSuite

import scala.concurrent.Future

trait DialectValidation extends AsyncFunSuite with PlatformSecrets {
trait DialectValidation extends AsyncFunSuiteWithPlatformGlobalExecutionContext {

protected val path: String
protected val reportComparator: ReportComparator = UniquePlatformReportComparator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ import amf.core.internal.remote.Hint
import amf.core.internal.remote.Mimes._
import amf.core.io.FileAssertionTest
import org.scalatest.Assertion
import org.scalatest.funsuite.AsyncFunSuite
import org.yaml.model.{YDocument, YNode}

import java.io.StringWriter
import scala.concurrent.Future

trait DomainElementCycleTests
extends AsyncFunSuite
with FileAssertionTest
with AMLParsingHelper
with DialectRegistrationHelper {
trait DomainElementCycleTests extends FileAssertionTest with AMLParsingHelper with DialectRegistrationHelper {

val basePath: String
val baseHint: Hint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import amf.validation.internal.emitters.ValidationReportJSONLDEmitter
import org.scalatest.Assertion
import org.scalatest.matchers.should.Matchers

import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.Future

trait ReportComparator extends FileAssertionTest with Matchers {

implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global

def assertReport(
report: AMFValidationReport,
goldenOption: Option[String] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ import amf.aml.client.scala.AMLConfiguration
import amf.aml.client.scala.model.domain.NodeMapping
import amf.aml.internal.parse.plugin.AMLDialectInstanceParsingPlugin
import amf.aml.internal.render.plugin.AMLDialectInstanceRenderingPlugin
import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext
import amf.core.internal.resource.AMFResolvers.platform.fs
import org.scalatest.Assertion
import org.scalatest.funsuite.AsyncFunSuite
import org.scalatest.matchers.should.Matchers

import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.Future

class AMLConfigurationPluginTest extends AsyncFunSuite with Matchers {
class AMLConfigurationPluginTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext with Matchers {

override implicit def executionContext: ExecutionContext = ExecutionContext.Implicits.global
val basePath = "amf-aml/shared/src/test/resources/vocabularies2/config/"
val movieDialect0 = s"$basePath/movie_dialect_0.yaml"
val movieDialect1 = s"$basePath/movie_dialect_1.yaml"
val personDialect0 = s"$basePath/person_dialect_0.yaml"
val basePath = "amf-aml/shared/src/test/resources/vocabularies2/config/"
val movieDialect0 = s"$basePath/movie_dialect_0.yaml"
val movieDialect1 = s"$basePath/movie_dialect_1.yaml"
val personDialect0 = s"$basePath/person_dialect_0.yaml"

test("Loading dialects with same name and version should update plugins") {
withLoadedConfig(path = s"file://$movieDialect0") { config =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@ package amf.testing.jsonldcycle

import amf.aml.client.scala.AMLConfiguration
import amf.aml.client.scala.model.document.DialectInstance
import amf.core.client.scala.model.document.Document
import amf.core.internal.remote.Mimes
import amf.core.io.FileAssertionTest
import amf.testing.common.utils.DialectValidation
import org.scalatest.funsuite.AsyncFunSuite
import org.scalatest.matchers.should.Matchers

import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.Future

class ToAndFromJsonLDInstanceTest extends AsyncFunSuite with FileAssertionTest with Matchers {
class ToAndFromJsonLDInstanceTest extends FileAssertionTest with Matchers {

private val basePath = "amf-aml/shared/src/test/resources/vocabularies2/jsonldcycle/"

override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global

test("Test cycle for any-seq(ValidationProfile)") {
val current = basePath + "any-seq/"
for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,25 @@ package amf.testing.parsing

import amf.testing.common.utils.{DialectValidation, MultiPlatformReportComparator, ReportComparator}

import scala.concurrent.ExecutionContext

class AmlSyamlConversionExceptionTest extends DialectValidation {

override implicit def executionContext: ExecutionContext = ExecutionContext.Implicits.global
override protected val path: String =
"amf-aml/shared/src/test/resources/vocabularies2/validations/conversion-exceptions/"
override protected val reportComparator: ReportComparator = MultiPlatformReportComparator

test("Invalid uses entry key is not string") {
validate(
"invalid-uses-entry-key-is-not-string.yaml",
Some("reports/invalid-uses-entry-key-is-not-string.report"),
false
"invalid-uses-entry-key-is-not-string.yaml",
Some("reports/invalid-uses-entry-key-is-not-string.report"),
false
)
}

test("Invalid uses entry value is not string") {
validate(
"invalid-uses-entry-value-is-not-string.yaml",
Some("reports/invalid-uses-entry-value-is-not-string.report"),
false
"invalid-uses-entry-value-is-not-string.yaml",
Some("reports/invalid-uses-entry-value-is-not-string.report"),
false
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package amf.testing.parsing
import amf.aml.client.scala.model.document.DialectInstance
import amf.aml.client.scala.{AMLConfiguration, AMLDialectInstanceResult}
import amf.core.client.scala.model.domain.AmfArray
import amf.core.common.AsyncFunSuiteWithPlatformGlobalExecutionContext
import org.mulesoft.common.client.lexical.PositionRange
import org.scalatest.funsuite.AsyncFunSuite
import org.scalatest.matchers.should.Matchers

import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.Future

class DialectInstanceAssertionTest extends AsyncFunSuiteWithPlatformGlobalExecutionContext with Matchers {

class DialectInstanceAssertionTest extends AsyncFunSuite with Matchers {
override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global
val basePath = "file://amf-aml/shared/src/test/resources/vocabularies2/instances/"

def parseDialectInstance(dialectPath: String, instancePath: String): Future[AMLDialectInstanceResult] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import amf.core.internal.remote._
import amf.testing.common.utils.DialectTests
import org.scalatest.Assertion

import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.Future

trait DialectInstancesParsingTest extends DialectTests {

override implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global

val basePath = "amf-aml/shared/src/test/resources/vocabularies2/instances/"

if (platform.name == "jvm") {
Expand Down
Loading

0 comments on commit 98c1b82

Please sign in to comment.