diff --git a/tests/karate/src/test/java/be/LAO/create.feature b/tests/karate/src/test/java/be/features/LAO/create.feature similarity index 95% rename from tests/karate/src/test/java/be/LAO/create.feature rename to tests/karate/src/test/java/be/features/LAO/create.feature index a7dc9343dd..5c2685b7b2 100644 --- a/tests/karate/src/test/java/be/LAO/create.feature +++ b/tests/karate/src/test/java/be/features/LAO/create.feature @@ -7,9 +7,9 @@ Feature: Create a pop LAO # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def organizer = call createMockClient * def validLao = organizer.createValidLao() diff --git a/tests/karate/src/test/java/be/LAO/update.feature b/tests/karate/src/test/java/be/features/LAO/update.feature similarity index 88% rename from tests/karate/src/test/java/be/LAO/update.feature rename to tests/karate/src/test/java/be/features/LAO/update.feature index f9f93fc4aa..7845868c36 100644 --- a/tests/karate/src/test/java/be/LAO/update.feature +++ b/tests/karate/src/test/java/be/features/LAO/update.feature @@ -6,15 +6,15 @@ Feature: Update a LAO # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def organizer = call createMockClient * def lao = organizer.createValidLao() # This call executes all the steps to create a valid lao on the server before every scenario # (lao creation, subscribe, catchup) - * call read('classpath:be/utils/simpleScenarios.feature@name=valid_lao') { organizer: '#(organizer)', lao: '#(lao)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=valid_lao') { organizer: '#(organizer)', lao: '#(lao)' } Scenario: Update Lao should succeed with a valid update request with new lao name Given def updateLaoRequest = diff --git a/tests/karate/src/test/java/be/decentralizedCom/getMessagesById.feature b/tests/karate/src/test/java/be/features/decentralizedCom/getMessagesById.feature similarity index 89% rename from tests/karate/src/test/java/be/decentralizedCom/getMessagesById.feature rename to tests/karate/src/test/java/be/features/decentralizedCom/getMessagesById.feature index 266899c3e3..dfdfab464d 100644 --- a/tests/karate/src/test/java/be/decentralizedCom/getMessagesById.feature +++ b/tests/karate/src/test/java/be/features/decentralizedCom/getMessagesById.feature @@ -6,9 +6,9 @@ Feature: Request messages by id from other servers # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def mockServer = call createMockClient * def lao = mockServer.createValidLao() @@ -24,7 +24,7 @@ Feature: Request messages by id from other servers # This call executes all the steps to create a valid lao on the server before every scenario # (lao creation, subscribe, catchup) - * call read('classpath:be/utils/simpleScenarios.feature@name=valid_lao') { organizer: '#(mockServer)', lao: '#(lao)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=valid_lao') { organizer: '#(mockServer)', lao: '#(lao)' } # Check that after sending a heartbeat message with unknown message id, the server responds with a # getMessagesByID requesting this message diff --git a/tests/karate/src/test/java/be/decentralizedCom/heartbeat.feature b/tests/karate/src/test/java/be/features/decentralizedCom/heartbeat.feature similarity index 85% rename from tests/karate/src/test/java/be/decentralizedCom/heartbeat.feature rename to tests/karate/src/test/java/be/features/decentralizedCom/heartbeat.feature index d3cf30d402..270791dc46 100644 --- a/tests/karate/src/test/java/be/decentralizedCom/heartbeat.feature +++ b/tests/karate/src/test/java/be/features/decentralizedCom/heartbeat.feature @@ -6,16 +6,16 @@ Feature: Send heartbeats to other servers # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def mockServer = call createMockClient * def lao = mockServer.createValidLao() * def validRollCall = mockServer.createValidRollCall(lao) # This call executes all the steps to create a valid lao on the server before every scenario # (lao creation, subscribe, catchup) - * call read('classpath:be/utils/simpleScenarios.feature@name=valid_lao') { organizer: '#(mockServer)', lao: '#(lao)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=valid_lao') { organizer: '#(mockServer)', lao: '#(lao)' } # After lao creation, wait and do nothing (30 seconds for now) and check that a heartbeat message was received Scenario: Server should send heartbeat messages automatically after a time interval diff --git a/tests/karate/src/test/java/be/digitalCash/transaction.feature b/tests/karate/src/test/java/be/features/digitalCash/transaction.feature similarity index 96% rename from tests/karate/src/test/java/be/digitalCash/transaction.feature rename to tests/karate/src/test/java/be/features/digitalCash/transaction.feature index 2ca9babeb4..4333c8eb63 100644 --- a/tests/karate/src/test/java/be/digitalCash/transaction.feature +++ b/tests/karate/src/test/java/be/features/digitalCash/transaction.feature @@ -5,16 +5,16 @@ Feature: Simple Transactions for digital cash # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def organizer = call createMockClient * def recipient = call createMockClient * def lao = organizer.createValidLao() * def rollCall = organizer.createValidRollCall(lao) # This call executes all the steps to set up a lao, complete a roll call and subscribe to the coin channel - * call read('classpath:be/utils/simpleScenarios.feature@name=setup_coin_channel') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=setup_coin_channel') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } Scenario: Valid transaction: issue 32 mini-Laos to an attendee Given def transaction = organizer.issueCoins(recipient, 32); diff --git a/tests/karate/src/test/java/be/election/castVote.feature b/tests/karate/src/test/java/be/features/election/castVote.feature similarity index 94% rename from tests/karate/src/test/java/be/election/castVote.feature rename to tests/karate/src/test/java/be/features/election/castVote.feature index c195c7f9e4..c65f9e5c8e 100644 --- a/tests/karate/src/test/java/be/election/castVote.feature +++ b/tests/karate/src/test/java/be/features/election/castVote.feature @@ -5,9 +5,9 @@ Feature: Cast a vote # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def organizer = call createMockClient * def lao = organizer.createValidLao() * def rollCall = organizer.createValidRollCall(lao) @@ -15,7 +15,7 @@ Feature: Cast a vote * def question = election.createQuestion() # This call executes all the steps to set up a lao, complete a roll call and open an election with one question - * call read('classpath:be/utils/simpleScenarios.feature@name=election_open') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)', election: '#(election)', question: '#(question)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=election_open') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)', election: '#(election)', question: '#(question)' } * def vote = question.createVote(0) * def castVote = election.castVote(vote) diff --git a/tests/karate/src/test/java/be/election/electionEnd.feature b/tests/karate/src/test/java/be/features/election/electionEnd.feature similarity index 92% rename from tests/karate/src/test/java/be/election/electionEnd.feature rename to tests/karate/src/test/java/be/features/election/electionEnd.feature index 5f14ab747f..d62ebe1ae3 100644 --- a/tests/karate/src/test/java/be/election/electionEnd.feature +++ b/tests/karate/src/test/java/be/features/election/electionEnd.feature @@ -5,9 +5,9 @@ Feature: Terminate an election # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def organizer = call createMockClient * def lao = organizer.createValidLao() * def rollCall = organizer.createValidRollCall(lao) @@ -15,7 +15,7 @@ Feature: Terminate an election * def question = election.createQuestion() # This call executes all the steps to set up a lao, complete a roll call, open an election and cast a vote - * call read('classpath:be/utils/simpleScenarios.feature@name=cast_vote') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)', election: '#(election)', question: '#(question)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=cast_vote') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)', election: '#(election)', question: '#(question)' } * def electionEnd = election.close() # After a successful election setup and cast vote sending a valid election end diff --git a/tests/karate/src/test/java/be/election/electionOpen.feature b/tests/karate/src/test/java/be/features/election/electionOpen.feature similarity index 92% rename from tests/karate/src/test/java/be/election/electionOpen.feature rename to tests/karate/src/test/java/be/features/election/electionOpen.feature index 97ae7e25be..b0e0042835 100644 --- a/tests/karate/src/test/java/be/election/electionOpen.feature +++ b/tests/karate/src/test/java/be/features/election/electionOpen.feature @@ -5,9 +5,9 @@ Feature: Open an Election # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def organizer = call createMockClient * def lao = organizer.createValidLao() * def rollCall = organizer.createValidRollCall(lao) @@ -15,7 +15,7 @@ Feature: Open an Election * def question = election.createQuestion() # This call executes all the steps to set up a lao, complete a roll call and create an election with one question - * call read('classpath:be/utils/simpleScenarios.feature@name=election_setup') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)', election: '#(election)', question: '#(question)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=election_setup') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)', election: '#(election)', question: '#(question)' } * def electionOpen = election.open() # Testing after creating an election, the backend returns an result diff --git a/tests/karate/src/test/java/be/election/electionSetup.feature b/tests/karate/src/test/java/be/features/election/electionSetup.feature similarity index 95% rename from tests/karate/src/test/java/be/election/electionSetup.feature rename to tests/karate/src/test/java/be/features/election/electionSetup.feature index 76ca39438f..471243e5ab 100644 --- a/tests/karate/src/test/java/be/election/electionSetup.feature +++ b/tests/karate/src/test/java/be/features/election/electionSetup.feature @@ -5,9 +5,9 @@ Feature: Setup an Election # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def organizer = call createMockClient * def lao = organizer.createValidLao() * def rollCall = organizer.createValidRollCall(lao) @@ -16,7 +16,7 @@ Feature: Setup an Election # This call executes all the steps to set up a lao and complete a roll call, to get a valid pop token # (lao creation, subscribe, catchup, roll call creation, roll call open, roll call close) - * call read('classpath:be/utils/simpleScenarios.feature@name=close_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=close_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } # Testing if after a successful roll call, sending a valid election # setup results in a valid response from the backend diff --git a/tests/karate/src/test/java/be/rollCall/closeRollCall.feature b/tests/karate/src/test/java/be/features/rollCall/closeRollCall.feature similarity index 92% rename from tests/karate/src/test/java/be/rollCall/closeRollCall.feature rename to tests/karate/src/test/java/be/features/rollCall/closeRollCall.feature index 2b31d2e69a..e6b67d513c 100644 --- a/tests/karate/src/test/java/be/rollCall/closeRollCall.feature +++ b/tests/karate/src/test/java/be/features/rollCall/closeRollCall.feature @@ -7,16 +7,16 @@ Feature: Close a Roll Call # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def organizer = call createMockClient * def lao = organizer.createValidLao() * def rollCall = organizer.createValidRollCall(lao) # This call executes all the steps to open a valid roll call on the server before every scenario # (lao creation, subscribe, catchup, roll call creation, roll call open) - * call read('classpath:be/utils/simpleScenarios.feature@name=open_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=open_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } * def closeRollCall = rollCall.close() # Testing if after setting up a valid lao, subscribing to it, sending a catchup diff --git a/tests/karate/src/test/java/be/rollCall/createRollCall.feature b/tests/karate/src/test/java/be/features/rollCall/createRollCall.feature similarity index 96% rename from tests/karate/src/test/java/be/rollCall/createRollCall.feature rename to tests/karate/src/test/java/be/features/rollCall/createRollCall.feature index 502fff2d54..52c9cd3875 100644 --- a/tests/karate/src/test/java/be/rollCall/createRollCall.feature +++ b/tests/karate/src/test/java/be/features/rollCall/createRollCall.feature @@ -7,16 +7,16 @@ Feature: Create a Roll Call # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def organizer = call createMockClient * def lao = organizer.createValidLao() * def validRollCall = organizer.createValidRollCall(lao) # This call executes all the steps to create a valid lao on the server before every scenario # (lao creation, subscribe, catchup) - * call read('classpath:be/utils/simpleScenarios.feature@name=valid_lao') { organizer: '#(organizer)', lao: '#(lao)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=valid_lao') { organizer: '#(organizer)', lao: '#(lao)' } # Testing if after setting up a valid lao, subscribing to it and sending a catchup # we send a valid roll call create request and expect to receive a valid response diff --git a/tests/karate/src/test/java/be/rollCall/openRollCall.feature b/tests/karate/src/test/java/be/features/rollCall/openRollCall.feature similarity index 92% rename from tests/karate/src/test/java/be/rollCall/openRollCall.feature rename to tests/karate/src/test/java/be/features/rollCall/openRollCall.feature index 472b12b5e8..35301f0ca8 100644 --- a/tests/karate/src/test/java/be/rollCall/openRollCall.feature +++ b/tests/karate/src/test/java/be/features/rollCall/openRollCall.feature @@ -7,16 +7,16 @@ Feature: Roll Call Open # Call read(...) makes this feature and the called feature share the same scope # Meaning they share def variables, configurations ... # Especially JS functions defined in the called features can be directly used here thanks to Karate shared scopes - * call read('classpath:be/utils/server.feature') - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/server.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') * def organizer = call createMockClient * def lao = organizer.createValidLao() * def rollCall = organizer.createValidRollCall(lao) # This call executes all the steps to create a valid roll call on the server before every scenario # (lao creation, subscribe, catchup, roll call creation) - * call read('classpath:be/utils/simpleScenarios.feature@name=valid_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=valid_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } * def openRollCall = rollCall.open() # This scenario tests a valid roll call open message. diff --git a/tests/karate/src/test/java/be/constants.feature b/tests/karate/src/test/java/be/features/utils/constants.feature similarity index 100% rename from tests/karate/src/test/java/be/constants.feature rename to tests/karate/src/test/java/be/features/utils/constants.feature diff --git a/tests/karate/src/test/java/be/mockClient.feature b/tests/karate/src/test/java/be/features/utils/mockClient.feature similarity index 100% rename from tests/karate/src/test/java/be/mockClient.feature rename to tests/karate/src/test/java/be/features/utils/mockClient.feature diff --git a/tests/karate/src/test/java/be/utils/server.feature b/tests/karate/src/test/java/be/features/utils/server.feature similarity index 92% rename from tests/karate/src/test/java/be/utils/server.feature rename to tests/karate/src/test/java/be/features/utils/server.feature index 9550a83c54..c3c560a2db 100644 --- a/tests/karate/src/test/java/be/utils/server.feature +++ b/tests/karate/src/test/java/be/features/utils/server.feature @@ -82,15 +82,6 @@ Feature: This feature starts a server and stops it after every scenario. * call waitForPort * karate.log('Executing tests') - * def convertData = - """ - function(){ - var JsonConverter = Java.type('be.utils.JsonConverter') - return new JsonConverter() - } - """ - * def converter = call convertData - # Shutdown server automatically after the end of a feature * configure afterFeature = """ diff --git a/tests/karate/src/test/java/be/utils/simpleScenarios.feature b/tests/karate/src/test/java/be/features/utils/simpleScenarios.feature similarity index 87% rename from tests/karate/src/test/java/be/utils/simpleScenarios.feature rename to tests/karate/src/test/java/be/features/utils/simpleScenarios.feature index 47733fe37c..8a0b72fd43 100644 --- a/tests/karate/src/test/java/be/utils/simpleScenarios.feature +++ b/tests/karate/src/test/java/be/features/utils/simpleScenarios.feature @@ -5,8 +5,8 @@ # This file contains a set of simple scenarios that can be used when # testing the validity of other features. By calling one scenario from # this file simply use the allocated name for the particular feature. - * call read('classpath:be/mockClient.feature') - * call read('classpath:be/constants.feature') + * call read('classpath:be/features/utils/mockClient.feature') + * call read('classpath:be/features/utils/constants.feature') # organizer and lao need to be passed as arguments when calling this scenario @name=valid_lao @@ -60,7 +60,7 @@ # organizer, lao and rollCall need to be passed as arguments when calling this scenario @name=valid_roll_call Scenario: Creates a valid Roll Call - * call read('classpath:be/utils/simpleScenarios.feature@name=valid_lao') { organizer: '#(organizer)', lao: '#(lao)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=valid_lao') { organizer: '#(organizer)', lao: '#(lao)' } * def validCreateRollCall = """ { @@ -82,7 +82,7 @@ # organizer, lao and rollCall need to be passed as arguments when calling this scenario @name=open_roll_call Scenario: Opens a valid Roll Call - * call read('classpath:be/utils/simpleScenarios.feature@name=valid_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=valid_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } * def openRollCall = rollCall.open() * def validOpenRollCall = """ @@ -101,7 +101,7 @@ # organizer, lao and rollCall need to be passed as arguments when calling this scenario @name=close_roll_call Scenario: Closes a valid Roll Call - * call read('classpath:be/utils/simpleScenarios.feature@name=open_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=open_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } * def closeRollCall = rollCall.close() * def validRollCallClose = """ @@ -121,7 +121,7 @@ # organizer, lao, rollCall, election and the question need to be passed as arguments when calling this scenario @name=election_setup Scenario: Sets up a valid election with one question - * call read('classpath:be/utils/simpleScenarios.feature@name=close_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=close_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } Given def validElectionSetup = """ { @@ -182,7 +182,7 @@ # organizer, lao, rollCall, election and the question need to be passed as arguments when calling this scenario @name=election_open Scenario: Opens an election with one question - * call read('classpath:be/utils/simpleScenarios.feature@name=election_setup') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)', election: '#(election)', question: '#(question)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=election_setup') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)', election: '#(election)', question: '#(question)' } * def electionOpen = election.open() * def validElectionOpen = """ @@ -201,7 +201,7 @@ # organizer, lao, rollCall, election and the question need to be passed as arguments when calling this scenario @name=cast_vote Scenario: Casts a valid vote - * call read('classpath:be/utils/simpleScenarios.feature@name=election_open') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)', election: '#(election)', question: '#(question)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=election_open') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)', election: '#(election)', question: '#(question)' } * def vote = question.createVote(0) * def castVote = election.castVote(vote) * def validCastVote = @@ -228,7 +228,7 @@ # organizer, lao and rollCall need to be passed as arguments when calling this scenario @name=setup_coin_channel Scenario: Sets up the coin channel and subscribes to it - * call read('classpath:be/utils/simpleScenarios.feature@name=close_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=close_roll_call') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } Given def subscribe = """ { @@ -262,7 +262,7 @@ # organizer, lao, rollCall, recipient and amount need to be passed as arguments when calling this scenario @name=valid_coin_issuance Scenario: Issues a certain amount of coins to an attendee - * call read('classpath:be/utils/simpleScenarios.feature@name=setup_coin_channel') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } + * call read('classpath:be/features/utils/simpleScenarios.feature@name=setup_coin_channel') { organizer: '#(organizer)', lao: '#(lao)', rollCall: '#(rollCall)' } * def transaction = organizer.issueCoins(recipient, amount); * def postTransaction = transaction.post() * def input = transaction.inputs[0] diff --git a/tests/karate/src/test/java/be/utils/JsonConverter.java b/tests/karate/src/test/java/be/utils/JsonConverter.java index 92f640f862..af86c92ded 100644 --- a/tests/karate/src/test/java/be/utils/JsonConverter.java +++ b/tests/karate/src/test/java/be/utils/JsonConverter.java @@ -19,11 +19,6 @@ public class JsonConverter { private boolean isSignatureForced = false; private String messageIdForced = ""; - // TODO: remove this constructor once all features are refactored - public JsonConverter(){ - this.publicKey = "J9fBzJV70Jk5c-i3277Uq4CmeL4t53WDfUghaK0HpeM="; - } - public JsonConverter(String publicKey, String privateKey){ this.publicKey = publicKey; this.privateKey = privateKey; diff --git a/tests/karate/src/test/java/be/utils/JsonConverterTest.java b/tests/karate/src/test/java/be/utils/JsonConverterTest.java index 9202e80042..02d678e7af 100644 --- a/tests/karate/src/test/java/be/utils/JsonConverterTest.java +++ b/tests/karate/src/test/java/be/utils/JsonConverterTest.java @@ -1,6 +1,5 @@ package be.utils; -import be.model.KeyPair; import com.intuit.karate.Json; import common.utils.Base64Utils; import org.junit.jupiter.api.Test; @@ -11,13 +10,18 @@ public class JsonConverterTest { + private static final String publicKey = "J9fBzJV70Jk5c-i3277Uq4CmeL4t53WDfUghaK0HpeM="; + private static final String privateKey = "0leCDBokllJXKXT72psnqF5UYFVRxnc1BNDShY05KHQ="; + private final JsonConverter jsonConverter = new JsonConverter(publicKey, privateKey); + + private Json constructJsonDataForValidLao() { Map laoData = new LinkedHashMap<>(); laoData.put("object", "lao"); laoData.put("action", "create"); laoData.put("name", "LAO"); laoData.put("creation", 1633035721); - laoData.put("organizer", "J9fBzJV70Jk5c-i3277Uq4CmeL4t53WDfUghaK0HpeM="); + laoData.put("organizer", publicKey); String[] witness = new String[0]; laoData.put("witnesses", witness); laoData.put("id", "p_EYbHyMv6sopI5QhEXBf40MO_eNoq7V_LygBd4c9RA="); @@ -26,14 +30,13 @@ private Json constructJsonDataForValidLao() { @Test public void testJsonDataToBase64PrintsInDesiredFormat() { - KeyPair keyPair = new KeyPair(); - JsonConverter jsonConverter = new JsonConverter(keyPair.getPublicKey(), keyPair.getPrivateKey()); Map testMap = new LinkedHashMap<>(); testMap.put("test1", "test2"); Json testJson = Json.of(testMap); Json testConverter = jsonConverter.publishMessageFromData(testJson.toString(), 2, "/root"); String jsonString = testConverter.toString(); - System.out.println(jsonString); + String result = "{\"method\":\"publish\",\"id\":2,\"params\":{\"channel\":\"/root\",\"message\":{\"data\":\"eyJ0ZXN0MSI6InRlc3QyIn0=\",\"sender\":\"J9fBzJV70Jk5c-i3277Uq4CmeL4t53WDfUghaK0HpeM=\",\"signature\":\"-waobQoP4TyXbTSXG0A8hZ2EPRB--p8G_F_NDerSoOhcBA1BE1JZux98ihvmP8-lG8WifZTx9gSVfWuN2dx2Bw==\",\"message_id\":\"Oj7kLJCLMvQrvBZmW0YyRUDbRX10p4mIg2gw0AuIu3E=\",\"witness_signatures\":[]}},\"jsonrpc\":\"2.0\"}"; + assert jsonString.equals(result); } @Test @@ -48,9 +51,7 @@ public void testIfMessageFromDataCorrespondsToTrueMessageForValidLao() { @Test public void constructJsonMessageFromDataCorrespondsToTrueJsonMessage() { - // TODO: refactor tests String laoDataJsonString = constructJsonDataForValidLao().toString(); - JsonConverter jsonConverter = new JsonConverter(); Json jsonValidLaoMessage = jsonConverter.publishMessageFromData(laoDataJsonString, 1, "/root"); Map validStringMessage = new LinkedHashMap<>(); validStringMessage.put("method", "publish");