-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
44 changed files
with
261 additions
and
44 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...main/java/tech/jhipster/lite/generator/project/infrastructure/primary/dto/ProjectDTO.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
29 changes: 29 additions & 0 deletions
29
...h/jhipster/lite/generator/project/infrastructure/primary/rest/ProjectFoldersResource.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,29 @@ | ||
package tech.jhipster.lite.generator.project.infrastructure.primary.rest; | ||
|
||
import java.util.UUID; | ||
import org.apache.commons.lang3.SystemUtils; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api/project-folders") | ||
class ProjectFoldersResource { | ||
|
||
@Value("${application.forced-project-folder:}") | ||
private String forcedProjectFolder; | ||
|
||
@GetMapping | ||
public String getAvailableFolderName() { | ||
return rootFolder().replaceAll("([^/])$", "$1/") + UUID.randomUUID(); | ||
} | ||
|
||
private String rootFolder() { | ||
if (forcedProjectFolder.isBlank()) { | ||
return SystemUtils.JAVA_IO_TMPDIR; | ||
} | ||
|
||
return forcedProjectFolder; | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
...jhipster/lite/technical/infrastructure/primary/jackson/InvalidProjectFolderException.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,10 @@ | ||
package tech.jhipster.lite.technical.infrastructure.primary.jackson; | ||
|
||
import tech.jhipster.lite.error.domain.GeneratorException; | ||
|
||
public class InvalidProjectFolderException extends GeneratorException { | ||
|
||
public InvalidProjectFolderException(String fixedFolderPath) { | ||
super("Should start with " + fixedFolderPath); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...pster/lite/technical/infrastructure/primary/jackson/JacksonProjectFolderDeserializer.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,26 @@ | ||
package tech.jhipster.lite.technical.infrastructure.primary.jackson; | ||
|
||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.databind.DeserializationContext; | ||
import com.fasterxml.jackson.databind.JsonDeserializer; | ||
import java.io.IOException; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
import tech.jhipster.lite.error.domain.GeneratorException; | ||
import tech.jhipster.lite.technical.infrastructure.primary.exception.BadRequestAlertException; | ||
|
||
@Component | ||
public class JacksonProjectFolderDeserializer extends JsonDeserializer<String> { | ||
|
||
@Value("${application.forced-project-folder:}") | ||
private String forcedProjectFolder; | ||
|
||
@Override | ||
public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { | ||
String text = jsonParser.getText(); | ||
if (!text.startsWith(forcedProjectFolder) || text.contains("..")) { | ||
throw new InvalidProjectFolderException(forcedProjectFolder); | ||
} | ||
return text; | ||
} | ||
} |
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 @@ | ||
export type FolderName = string; |
5 changes: 5 additions & 0 deletions
5
src/main/webapp/app/springboot/domain/ProjectFolderService.ts
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,5 @@ | ||
import { FolderName } from '@/springboot/domain/FolderName'; | ||
|
||
export interface ProjectFolderService { | ||
get(): Promise<FolderName>; | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/webapp/app/springboot/secondary/ProjectFolderRepository.ts
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,11 @@ | ||
import { AxiosHttp } from '@/http/AxiosHttp'; | ||
import { ProjectFolderService } from '@/springboot/domain/ProjectFolderService'; | ||
import { FolderName } from '@/springboot/domain/FolderName'; | ||
|
||
export default class ProjectFolderRepository implements ProjectFolderService { | ||
constructor(private axiosHttp: AxiosHttp) {} | ||
|
||
async get(): Promise<FolderName> { | ||
return await this.axiosHttp.get<FolderName>('api/project-folders').then(res => res.data); | ||
} | ||
} |
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
1 change: 0 additions & 1 deletion
1
...st/java/tech/jhipster/lite/generator/buildtool/gradle/domain/GradleDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...tech/jhipster/lite/generator/ci/github/actions/domain/GitHubActionsDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...ava/tech/jhipster/lite/generator/client/angular/core/domain/AngularDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...ipster/lite/generator/client/angular/security/jwt/domain/AngularJwtDomainServiceTest.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
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
1 change: 0 additions & 1 deletion
1
...st/java/tech/jhipster/lite/generator/client/react/core/domain/ReactDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
.../java/tech/jhipster/lite/generator/client/svelte/core/domain/SvelteDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...va/tech/jhipster/lite/generator/client/tools/cypress/domain/CypressDomainServiceTest.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
24 changes: 24 additions & 0 deletions
24
...jhipster/lite/generator/project/infrastructure/primary/rest/ProjectFoldersResourceIT.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,24 @@ | ||
package tech.jhipster.lite.generator.project.infrastructure.primary.rest; | ||
|
||
import static org.hamcrest.Matchers.matchesRegex; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; | ||
import org.springframework.test.web.servlet.MockMvc; | ||
import tech.jhipster.lite.IntegrationTest; | ||
|
||
@IntegrationTest | ||
@AutoConfigureMockMvc | ||
class ProjectFoldersResourceIT { | ||
|
||
@Autowired | ||
private MockMvc mockMvc; | ||
|
||
@Test | ||
void shouldGetProject() throws Exception { | ||
mockMvc.perform(get("/api/project-folders")).andExpect(content().string(matchesRegex("^/tmp/.{36}$"))); | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
.../jhipster/lite/generator/project/infrastructure/secondary/ProjectLocalRepositoryTest.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
1 change: 0 additions & 1 deletion
1
...r/lite/generator/server/javatool/frontendmaven/domain/FrontendMavenDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...jhipster/lite/generator/server/springboot/broker/kafka/domain/KafkaDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...ipster/lite/generator/server/springboot/broker/pulsar/domain/PulsarDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...ch/jhipster/lite/generator/server/springboot/core/domain/SpringBootDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...er/lite/generator/server/springboot/database/mongodb/domain/MongodbDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...er/lite/generator/server/springboot/database/mssql/domain/MssqlDomainServiceUnitTest.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
1 change: 0 additions & 1 deletion
1
...ite/generator/server/springboot/database/sqlcommon/domain/SQLCommonDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...r/lite/generator/server/springboot/dbmigration/flyway/domain/FlywayDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...ite/generator/server/springboot/mvc/security/jwt/domain/JwtSecurityDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...pster/lite/generator/server/springboot/mvc/web/domain/SpringBootMvcDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
...te/generator/server/springboot/webflux/web/domain/SpringBootWebfluxDomainServiceTest.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
1 change: 0 additions & 1 deletion
1
src/test/java/tech/jhipster/lite/history/infrastructure/primary/HistoryResourceTest.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
1 change: 0 additions & 1 deletion
1
...h/jhipster/lite/history/infrastructure/secondary/GeneratorHistoryLocalRepositoryTest.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
Oops, something went wrong.