Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(emx2): spark to javalin migration #4165

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

harmbrugge
Copy link
Member

@harmbrugge harmbrugge commented Aug 26, 2024

What are the main changes you did:

  • Migrated the API code from Spark to Javalin

how to test:
Please test all features of emx2 to see if everything behaves as expected. Everything should work as before.

todo:

  • migrate api code to javalin
  • add proxy test

@harmbrugge harmbrugge marked this pull request as draft August 26, 2024 19:58
# Conflicts:
#	backend/molgenis-emx2-fairdatapoint/src/main/java/org/molgenis/emx2/fairdatapoint/FAIRDataPointCatalog.java
#	backend/molgenis-emx2-fairdatapoint/src/main/java/org/molgenis/emx2/fairdatapoint/FAIRDataPointDistribution.java
#	backend/molgenis-emx2-webapi/src/main/java/org/molgenis/emx2/web/CsvApi.java
#	backend/molgenis-emx2-webapi/src/main/java/org/molgenis/emx2/web/ExcelApi.java
#	backend/molgenis-emx2-webapi/src/main/java/org/molgenis/emx2/web/GroupPathMapper.java
#	backend/molgenis-emx2-webapi/src/main/java/org/molgenis/emx2/web/MolgenisWebservice.java
#	backend/molgenis-emx2-webapi/src/main/java/org/molgenis/emx2/web/RDFApi.java
#	backend/molgenis-emx2-webapi/src/main/java/org/molgenis/emx2/web/TaskApi.java
#	backend/molgenis-emx2-webapi/src/main/java/org/molgenis/emx2/web/ZipApi.java
when(request.url()).thenReturn("http://localhost:8080/api/beacon");
when(request.attribute("specification")).thenReturn("beacon");

return request;
}

@Test
public void testEntryTypes() {
Request request = mockRequest();
@Disabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it disabled ? ( i think a annotation allows to add a reason )

when(request.url()).thenReturn("http://localhost:8080/api/beacon");
when(request.attribute("specification")).thenReturn("beacon");

return request;
}

@Test
public void testMap() {
@Disabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why

when(request.url()).thenReturn("http://localhost:8080/api/beacon_vp");
when(request.attribute("specification")).thenReturn("beacon_vp");

return request;
}

@Test
public void testMap() {
@Disabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why


private AnalyticsApi() {
// hide constructor
}

public static void create() {
public static void create(Javalin app) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general it's bad practice modify the param passed in a method, guess the same thing sort of happend via the static post/get/.. imports, so i guess the is sort of a step in the right direction, is this the recommended way to configure the routes in javlin ?

response.type("application/json");
MolgenisSession session = sessionManager.getSession(request);
String schemaName = sanitize(request.params(SCHEMA));
private static void listSchemaTriggers(Context ctx) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change form function to method, makes hard to test , reuse compose

actionTransformer.transform(request.body(), CreateTriggerAction.class);
MolgenisSession session = sessionManager.getSession(request);
String schemaName = sanitize(request.params(SCHEMA));
private static void addTrigger(Context ctx) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keeps a function

var action = actionTransformer.transform(request.body(), UpdateTriggerAction.class);
MolgenisSession session = sessionManager.getSession(request);
String schemaName = sanitize(request.params(SCHEMA));
private static void updateTrigger(Context ctx) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Contributor

@dtroelofsprins dtroelofsprins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some functional tests:
Successful:

  • Create Directory schema from template including demo data
  • Schema editor
  • DataCatalogueTemplate
  • Fair data hub template
  • Data upload (zipfile with several csv's) using UI
  • Other templates STILL NEED TO BE TESTED

Not working properly:

  • Create ERN Dashboard from template when going to the schema a white screen is shown, should go to /tables/#
  • Directory App => footer is broken, pictures not shown (f.e. logo)
  • Manually adding data => FAILS WITH ERROR: Parsing of graphql variables failed. Should be an object with each graphql variable a key. argument "content" is null: argument "content" is null
  • Manually updating data => FAILS WITH ERROR Parsing of graphql variables failed. Should be an object with each graphql variable a key. argument "content" is null: argument "content" is null
  • Run a script on the server => Cannot create a script due to saving error (Running the hello world script works)
  • Run a script locally using the EMX2-pyclient =>
    • create schema using template WORKS
    • downloading real BBMRI-ERIC biobanks fails with error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 8688: invalid continuation byte => using the same script, with the same data on emx2.dev.molgenis.org works fine.

@harmbrugge harmbrugge marked this pull request as ready for review September 19, 2024 12:24
Copy link
Contributor

@dtroelofsprins dtroelofsprins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some functional tests:
Successful:

  • Create Directory schema from template including demo data
  • Schema editor
  • Use DataCatalogueTemplate
  • Fair data hub template
  • Data upload (zipfile with several csv's) using UI
  • Other templates => tested several, but not all
  • Schedule a script
  • Failure email when script fails => NOT POSSIBLE on preview server

Fixed:

  • Directory App => footer is broken, pictures not shown (f.e. logo)
  • Manually adding data
  • Manually updating data
  • Create ERN Dashboard from template when going to the schema a white screen is shown, should go to /tables/#
  • Run a script on the server
  • Run a script locally using the EMX2-pyclient =>
    • create schema using template WORKS
    • downloading real BBMRI-ERIC biobanks

New issues (probably not tested before):

  • Directory App => Load json settings does not have the proper layout
  • CatalogueTemplate => SSR Catalogue shows white screen => Might also be due to recent changes to the catalogue that it's not working properly

Copy link

sonarcloud bot commented Sep 25, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
72.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants