Skip to content

Commit

Permalink
Merge branch 'Cucumberjwtvue' into JWTVueSecondary
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieuRioual committed Jun 2, 2022
2 parents 24949e1 + bb83921 commit 2475994
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 72 deletions.
46 changes: 46 additions & 0 deletions src/test/features/vue.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Feature: Vue

Scenario: Should initialize Vue application
When I generate vue application
Then I should have files in "src/main/webapp"
| index.html |
And I should have files in "src/main/webapp/app"
| env.d.ts |
| main.ts |
And I should have files in "src/main/webapp/app/router"
| router.ts |
And I should have files in "src/main/webapp/app/http"
| AxiosHttp.ts |
And I should have files in "src/main/webapp/app/common/domain"
| Logger.ts |
| Message.ts |
And I should have files in "src/main/webapp/app/common/secondary"
| ConsoleLogger.ts |
And I should have files in "src/main/webapp/app/common/primary/app"
| App.component.ts |
| App.html |
| App.vue |
| index.ts |

Scenario: Should add jwt authentication to Vue application
When I add jwt to vue application
Then I should have files in "src/main/webapp/app/common/domain"
| AuthenticationService.ts |
| JWTStoreService.ts |
| Login.ts |
| User.ts |
And I should have files in "src/main/webapp/app/common/primary/homepage"
| Homepage.component.ts |
| Homepage.html |
| Homepage.vue |
| index.ts |
And I should have files in "src/main/webapp/app/common/primary/login"
| Login.component.ts |
| Login.html |
| Login.vue |
| index.ts |
And I should have files in "src/main/webapp/app/common/secondary"
| AuthenticationRepository.ts |
| ConsoleLogger.ts |
| RestLogin.ts |
| UserDTO.ts |
22 changes: 20 additions & 2 deletions src/test/java/tech/jhipster/lite/generator/ModulesSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ public abstract class ModulesSteps {
@Autowired
private TestRestTemplate rest;

protected void applyModuleForDefaultProject(String moduleUrl) {
protected void applyModuleForDefaultProject(String... moduleUrl) {
ProjectDTO project = newDefaultProjectDto();

post(moduleUrl, JsonHelper.writeAsString(project));
for (String url : moduleUrl) {
post(url, JsonHelper.writeAsString(project));
}
}

protected void applyModuleForDefaultProjectWithMavenFile(String moduleUrl) {
Expand All @@ -51,6 +53,22 @@ private static void addPomToproject(String folder) {
}
}

private static void addPackageToproject(String folder) {
Path folderPath = Paths.get(folder);
try {
Files.createDirectories(folderPath);
} catch (IOException e) {
throw new AssertionError(e);
}

Path pomPath = folderPath.resolve("pom.xml");
try {
Files.copy(Paths.get("src/test/resources/projects/maven/pom.xml"), pomPath);
} catch (IOException e) {
throw new AssertionError(e);
}
}

private void post(String uri, String content) {
rest.exchange(uri, HttpMethod.POST, new HttpEntity<>(content, jsonHeaders()), Void.class);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package tech.jhipster.lite.generator.client.vue.core.infrastructure.primary.rest;

import io.cucumber.java.en.When;
import tech.jhipster.lite.generator.ModulesSteps;

public class VueSteps extends ModulesSteps {

@When("I generate vue application")
public void addVue() {
applyModuleForDefaultProject("/api/inits/full", "/api/clients/vue");
}

@When("I add jwt to vue application")
public void addVueJwt() {
applyModuleForDefaultProject("/api/inits/full", "/api/clients/vue", "/api/clients/vue/stores/pinia", "/api/clients/vue/jwt");
}
}

0 comments on commit 2475994

Please sign in to comment.