Skip to content

Commit

Permalink
Merge pull request #117 from NTNU-IHB/fix-fmi1-linux
Browse files Browse the repository at this point in the history
Update fmi4j and picocli, bump version, remove shadow
  • Loading branch information
markaren authored Aug 11, 2020
2 parents e59ac69 + ba5d983 commit bc139f4
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
- name: Build on Windows
if: startsWith(runner.os, 'Windows')
run: ./gradlew clean build shadowJar
run: ./gradlew clean build installDist

- name: Build on Linux
if: startsWith(runner.os, 'Linux')
run: sudo chmod +x gradlew && ./gradlew clean build shadowJar
run: sudo chmod +x gradlew && ./gradlew clean build installDist

- uses: actions/upload-artifact@master
with:
name: fmu-proxy
path: fmu-proxy/build/libs
path: fmu-proxy/build/install
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ println "Gradle version is ${gradle.getGradleVersion()}"

ext.grpc_version = '1.25.0'
ext.slf4j_version = '1.7.25'
ext.fmi4j_version = '0.31.2'
ext.fmi4j_version = '0.31.4'

wrapper {
distributionType = Wrapper.DistributionType.ALL
Expand Down
9 changes: 1 addition & 8 deletions fmu-proxy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
plugins {
id "kotlin"
id "application"
id "com.github.johnrengelman.shadow" version "4.0.4"
}

apply from: rootProject.file("gradle/junit.gradle")
Expand All @@ -13,7 +12,7 @@ dependencies {

implementation project(":rpc-gen")

implementation group: 'info.picocli', name: 'picocli', version: '3.9.2'
implementation group: 'info.picocli', name: 'picocli', version: '4.5.0'

implementation group: 'io.grpc', name: 'grpc-netty', version: grpc_version

Expand All @@ -36,9 +35,3 @@ run {
}
standardInput = System.in
}

shadowJar {
archiveBaseName = 'fmu-proxy'
archiveClassifier = null
archiveVersion = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ import java.io.File
import java.util.*
import java.util.concurrent.Callable

private const val VERSION = "0.6.1"
private const val VERSION = "0.6.2"

object CommandLineParser {

fun parse(args: Array<String>): FmuProxy? {
return CommandLine.call(Args(), System.out, *args)
return CommandLine(Args()).apply {
execute(*args)
}.getExecutionResult()
}

}
Expand Down
31 changes: 31 additions & 0 deletions fmu-proxy/src/test/kotlin/no/ntnu/ihb/fmuproxy/Test.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package no.ntnu.ihb.fmuproxy

import no.ntnu.ihb.fmuproxy.thrift.ThriftFmuClient
import org.junit.jupiter.api.Assertions
import java.time.Duration


fun main() {

Assertions.assertTimeout(Duration.ofSeconds(10)) {

ThriftFmuClient.socketClient("localhost", 9090).load("ae713a03-634c-5da4-802e-9ea653e11f42")
.use { client ->

val md = client.modelDescription
println(md.modelName)

client.newInstance().use { instance ->

runSlave(instance, 1e-2, 5.0).also {
println("Thrift (socket) duration: ${it}ms")
}

}

}
}

}


Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class LoadFmuTest {
assert(it)
}
}

}

@Test
Expand Down
27 changes: 27 additions & 0 deletions fmu-proxy/src/test/kotlin/no/ntnu/ihb/fmuproxy/thrift/TestFmi1.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package no.ntnu.ihb.fmuproxy.thrift

import no.ntnu.ihb.fmi4j.importer.fmi1.Fmu
import no.ntnu.sfi.fmuproxy.TestUtils
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import java.io.File

internal class TestFmi1 {

@Test
fun testFmi1() {
val fmu = Fmu.from(File(TestUtils.getTEST_FMUs(), "1.0/identity.fmu"))
val md = fmu.modelDescription
ThriftFmuSocketServer().apply { addFmu(fmu) }.use { server ->
ThriftFmuClient.socketClient("localhost", server.start()).load(md.guid).use {

Assertions.assertEquals(md.modelName, it.modelDescription.modelName)

}
}
fmu.close()
}

}


Binary file added test/fmus/1.0/identity.fmu
Binary file not shown.

0 comments on commit bc139f4

Please sign in to comment.