-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
171 additions
and
59 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
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
29 changes: 0 additions & 29 deletions
29
frontend/src/components/company-survey-v2/time-series/interval-dropdown.tsx
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
# This verifies that the latest version of Ztor works with older versions of Vallum. | ||
# Probably there is a more flexible way of testing this using different ClassLoaders instead of | ||
|
||
CURRENT=$(git branch --show-current) | ||
|
||
if [[ -z $CURRENT ]]; then | ||
CURRENT=$(git rev-parse HEAD) | ||
fi | ||
|
||
mkdir -p shadowJar | ||
gradle vallum:shadowJar | ||
mv vallum/build/libs/vallum-dev-all.jar shadowJar/vallum-current-all.jar | ||
|
||
git switch --detach 14c1cb1 | ||
gradle vallum:shadowJar | ||
mv vallum/build/libs/vallum-dev-all.jar shadowJar/vallum-14c1cb1-all.jar | ||
|
||
git switch production | ||
gradle vallum:shadowJar | ||
mv vallum/build/libs/vallum-dev-all.jar shadowJar/vallum-production-all.jar | ||
|
||
git switch --detach $CURRENT | ||
gradle vallum:test |
54 changes: 54 additions & 0 deletions
54
vallum/src/test/java/com/zenmo/vallum/BackwardCompatibilityTest.java
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,54 @@ | ||
package com.zenmo.vallum; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.lang.reflect.InvocationTargetException; | ||
import java.net.URL; | ||
import java.net.URLClassLoader; | ||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class BackwardCompatibilityTest { | ||
@Test | ||
public void test() throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { | ||
String[] shadowJarPaths = { | ||
"../shadowJar/vallum-14c1cb1-all.jar", | ||
"../shadowJar/vallum-production-all.jar", | ||
"../shadowJar/vallum-current-all.jar", | ||
}; | ||
|
||
var stopZtor = InitKt.initZtor(8082); | ||
|
||
for (var shadowJarPath: shadowJarPaths) { | ||
testVallumVersion(shadowJarPath); | ||
} | ||
|
||
stopZtor.stop(); | ||
} | ||
|
||
public void testVallumVersion(String shadowJarPath) throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { | ||
File jarFile = new File(shadowJarPath).getCanonicalFile(); | ||
System.out.println(jarFile.getPath()); | ||
if (!jarFile.exists()) { | ||
throw new RuntimeException("Jarfile doesnt exist"); | ||
} | ||
URL jarUrl = jarFile.toURI().toURL(); | ||
URL[] urls = {jarUrl}; | ||
var loader = new URLClassLoader(urls, null); | ||
|
||
var vallumClass = loader.loadClass("com.zenmo.vallum.Vallum"); | ||
var constructor = vallumClass.getDeclaredConstructor(String.class, String.class, String.class, String.class); | ||
var oldVallum = constructor.newInstance(System.getenv("CLIENT_ID"), System.getenv("CLIENT_SECRET"), "http://localhost:8082", "https://keycloak.zenmo.com/realms/testrealm/protocol/openid-connect/token"); | ||
|
||
/* | ||
* TODO: write the code like normal java rather then reflection. | ||
* I don't know how to do this with this class loader stuff | ||
*/ | ||
var getSurveysByProject = vallumClass.getMethod("getSurveysByProject", String.class); | ||
var surveys = (List) getSurveysByProject.invoke(oldVallum, "Waardkwartier"); | ||
assertEquals(1, surveys.size()); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.zenmo.ztor | ||
|
||
import com.zenmo.ztor.plugins.* | ||
import io.ktor.server.application.* | ||
import io.ktor.server.engine.* | ||
import io.ktor.server.netty.* | ||
|
||
fun interface StopZtor { | ||
fun stop(): Unit | ||
} | ||
|
||
@JvmOverloads | ||
fun startTestServer(port: Int = 8082): StopZtor { | ||
val server = embeddedServer(Netty, port = port, host = "0.0.0.0", module = Application::vallumMinimal) | ||
.start(wait = false) | ||
|
||
return StopZtor { server.stop(1000, 1000) } | ||
} | ||
|
||
fun Application.vallumMinimal() { | ||
configureHTTP() | ||
configureMonitoring() | ||
configureSerialization() | ||
configureAuthentication() | ||
val db = configureDatabases() | ||
configureRouting() | ||
configureStatusPages() | ||
} |