Skip to content

Commit

Permalink
Merge pull request #16 from murdos/fix/update-all-config
Browse files Browse the repository at this point in the history
Update all config
  • Loading branch information
murdos authored Jun 13, 2024
2 parents c3d9ae2 + 298b781 commit 1357a0b
Show file tree
Hide file tree
Showing 66 changed files with 206 additions and 198 deletions.
54 changes: 27 additions & 27 deletions .jhipster/modules/history.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"module": "init",
"date": "2024-06-04T14:50:37.819463965Z",
"properties": {
"packageName": "com.mycompany.myapp",
"projectName": "JHipster Sample Application",
"baseName": "jhipsterSampleApplication",
"packageName": "tech.jhipster.lite.extension",
"projectName": "JHLite Extension Sample",
"baseName": "jhliteExtensionSample",
"serverPort": 8080,
"endOfLine": "lf",
"indentSize": 2,
Expand All @@ -17,9 +17,9 @@
"module": "maven-java",
"date": "2024-06-04T14:50:37.902634737Z",
"properties": {
"packageName": "com.mycompany.myapp",
"projectName": "JHipster Sample Application",
"baseName": "jhipsterSampleApplication",
"packageName": "tech.jhipster.lite.extension",
"projectName": "JHLite Extension Sample",
"baseName": "jhliteExtensionSample",
"serverPort": 8080,
"endOfLine": "lf",
"indentSize": 2,
Expand All @@ -30,9 +30,9 @@
"module": "java-base",
"date": "2024-06-04T14:50:38.009320716Z",
"properties": {
"packageName": "com.mycompany.myapp",
"projectName": "JHipster Sample Application",
"baseName": "jhipsterSampleApplication",
"packageName": "tech.jhipster.lite.extension",
"projectName": "JHLite Extension Sample",
"baseName": "jhliteExtensionSample",
"serverPort": 8080,
"endOfLine": "lf",
"indentSize": 2,
Expand All @@ -43,9 +43,9 @@
"module": "maven-wrapper",
"date": "2024-06-04T14:50:38.131151735Z",
"properties": {
"packageName": "com.mycompany.myapp",
"projectName": "JHipster Sample Application",
"baseName": "jhipsterSampleApplication",
"packageName": "tech.jhipster.lite.extension",
"projectName": "JHLite Extension Sample",
"baseName": "jhliteExtensionSample",
"serverPort": 8080,
"endOfLine": "lf",
"indentSize": 2,
Expand All @@ -56,9 +56,9 @@
"module": "spring-boot",
"date": "2024-06-04T14:50:38.249816266Z",
"properties": {
"packageName": "com.mycompany.myapp",
"projectName": "JHipster Sample Application",
"baseName": "jhipsterSampleApplication",
"packageName": "tech.jhipster.lite.extension",
"projectName": "JHLite Extension Sample",
"baseName": "jhliteExtensionSample",
"serverPort": 8080,
"endOfLine": "lf",
"indentSize": 2,
Expand All @@ -69,9 +69,9 @@
"module": "custom-jhlite",
"date": "2024-06-04T14:50:38.415852411Z",
"properties": {
"packageName": "com.mycompany.myapp",
"projectName": "JHipster Sample Application",
"baseName": "jhipsterSampleApplication",
"packageName": "tech.jhipster.lite.extension",
"projectName": "JHLite Extension Sample",
"baseName": "jhliteExtensionSample",
"serverPort": 8080,
"endOfLine": "lf",
"indentSize": 2,
Expand All @@ -84,11 +84,11 @@
"properties": {
"endOfLine": "lf",
"springConfigurationFormat": "yaml",
"packageName": "com.mycompany.myapp",
"projectName": "JHipster Sample Application",
"packageName": "tech.jhipster.lite.extension",
"projectName": "JHLite Extension Sample",
"serverPort": 8080,
"indentSize": 2,
"baseName": "jhipsterSampleApplication"
"baseName": "jhliteExtensionSample"
}
},
{
Expand All @@ -97,11 +97,11 @@
"properties": {
"endOfLine": "lf",
"springConfigurationFormat": "yaml",
"packageName": "com.mycompany.myapp",
"projectName": "JHipster Sample Application",
"packageName": "tech.jhipster.lite.extension",
"projectName": "JHLite Extension Sample",
"serverPort": 8080,
"indentSize": 2,
"baseName": "jhipsterSampleApplication"
"baseName": "jhliteExtensionSample"
}
},
{
Expand All @@ -110,11 +110,11 @@
"properties": {
"endOfLine": "lf",
"springConfigurationFormat": "yaml",
"packageName": "com.mycompany.myapp",
"projectName": "JHipster Sample Application",
"packageName": "tech.jhipster.lite.extension",
"projectName": "JHLite Extension Sample",
"serverPort": 8080,
"indentSize": 2,
"baseName": "jhipsterSampleApplication"
"baseName": "jhliteExtensionSample"
}
}
]
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# JHipster Sample Application
# JHLite Extension Sample

## Prerequisites

### Java

You need to have Java 21:

- [JDK 21](https://openjdk.java.net/projects/jdk/21/)

### Node.js and NPM
Expand All @@ -23,16 +24,14 @@ npm install

## Local environment


<!-- jhipster-needle-localEnvironment -->

## Start up

```bash
./mvnw
./mvnw
```


<!-- jhipster-needle-startupCommand -->

## Documentation
Expand Down
18 changes: 8 additions & 10 deletions documentation/cucumber.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ Feature: Simple WebService test
You'll then have to define the glue code:

```java
import static com.mycompany.myapp.cucumber.rest.CucumberRestAssertions.*;
import static tech.jhipster.lite.extension.cucumber.rest.CucumberRestAssertions.*;

import com.mycompany.myapp.cucumber.CucumberRestTemplate;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.web.client.TestRestTemplate;
import tech.jhipster.lite.extension.cucumber.CucumberRestTemplate;

public class SimpleSteps {

@Autowired
private CucumberRestTemplate rest;

Expand All @@ -34,15 +35,10 @@ public class SimpleSteps {

@Then("I get simple response with name {string} and age {int}")
public void shouldGetResponse(String name, int age) {
assertThatLastResponse()
.hasOkStatus()
.hasElement("$.name")
.withValue(name)
.and()
.hasElement("$.age")
.withValue(age);
assertThatLastResponse().hasOkStatus().hasElement("$.name").withValue(name).and().hasElement("$.age").withValue(age);
}
}

```

Use a `TestRestTemplate` to make your rest calls, so you'll have the `context` management: the stuff allowing easier assertions in the `Then` steps.
Expand Down Expand Up @@ -79,6 +75,7 @@ public void shouldGetResponseContent(Map<String, Object> response) {
public void shouldGetResponseContent(List<Map<String, Object>> responses) {
assertThatLastResponse().hasElement("$.users").containingExactly(responses);
}

```

## Reading responses content
Expand Down Expand Up @@ -114,7 +111,7 @@ You may need to mock beans for your component tests, but you won't be able to do
```java
@ActiveProfiles("test")
@CucumberContextConfiguration
@SpringBootTest(classes = { JhipsterSampleApplicationApp.class, CucumberMocksConfiguration.class }, webEnvironment = WebEnvironment.RANDOM_PORT)
@SpringBootTest(classes = { JhliteExtensionSampleApp.class, CucumberMocksConfiguration.class }, webEnvironment = WebEnvironment.RANDOM_PORT)
public class CucumberConfiguration {

// other code omitted
Expand All @@ -129,6 +126,7 @@ public class CucumberConfiguration {
}
}
}

```

**Careful: the mock bean names (by default the method name) must be different from the real one or else they may just be ignored**
26 changes: 12 additions & 14 deletions documentation/module-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You can start by the element you prefer but to create a `JHipsterModuleResource`

In fact, you don't just need to create one `JHipsterModule`, you'll need a factory able to create them since each instance depends on the properties chosen by the users.

So, as this is the business of JHLite you probably want to create a `com.mycompany.myapp.my_module.domain` package. And you can start with a simple test:
So, as this is the business of JHLite you probably want to create a `tech.jhipster.lite.extension.my_module.domain` package. And you can start with a simple test:

```java
import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.*;
Expand All @@ -32,8 +32,7 @@ class MyModuleFactoryTest {

@Test
void shouldBuildModule() {
JHipsterModuleProperties properties = JHipsterModulesFixture
.propertiesBuilder(TestFileUtils.tmpDirForTest())
JHipsterModuleProperties properties = JHipsterModulesFixture.propertiesBuilder(TestFileUtils.tmpDirForTest())
.basePackage("com.jhipster.test")
.build();

Expand Down Expand Up @@ -78,7 +77,7 @@ This implementation will take a file from `src/main/resources/generator/my-modul
The file is a template named `Dummy.java.mustache` and can contain some mustache placeholders:

```java
package com.mycompany.myapp.my_package;
package tech.jhipster.lite.extension.my_package;

public class Dummy {
// ...
Expand Down Expand Up @@ -119,14 +118,14 @@ You can now run `CucumberTest` and ensure that it is failing as expected:
}
```

To be used by JHLite, the `JHipsterModuleResource` needs to be a Spring bean so, let's create a configuration in `com.mycompany.myapp.my_module.infrastructure.primary`:
To be used by JHLite, the `JHipsterModuleResource` needs to be a Spring bean so, let's create a configuration in `tech.jhipster.lite.extension.my_module.infrastructure.primary`:

```java
import static com.mycompany.myapp.slug.domain.MyAppModuleSlug.*;
import static tech.jhipster.lite.extension.slug.domain.MyAppModuleSlug.*;

import com.mycompany.myapp.my_module.application.MyModuleApplicationService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.extension.my_module.application.MyModuleApplicationService;
import tech.jhipster.lite.module.domain.resource.JHipsterModulePropertiesDefinition;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleResource;

Expand All @@ -135,8 +134,7 @@ class MyModuleModuleConfiguration {

@Bean
JHipsterModuleResource myModule(MyModuleApplicationService myModules) {
return JHipsterModuleResource
.builder()
return JHipsterModuleResource.builder()
.slug(MY_MODULE)
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addBasePackage().build())
.apiDoc("Group", "This is my module")
Expand All @@ -150,7 +148,7 @@ class MyModuleModuleConfiguration {

In fact, you don't really have choices here, the `JHipsterModuleResource.builder()` is fluent and will only let you go to the next possible step. The most confusing one may be the last one `.factory(myModules::buildModule)` which is, in fact, a method called to build the module.

You'll need to create the MyAppModuleSlug.MY_MODULE enum, which was mentioned earlier. Let's create it in the `com.mycompany.myapp.slug.domain` package:
You'll need to create the MyAppModuleSlug.MY_MODULE enum, which was mentioned earlier. Let's create it in the `tech.jhipster.lite.extension.slug.domain` package:

```java
import java.util.Map;
Expand All @@ -163,9 +161,9 @@ import tech.jhipster.lite.module.domain.resource.JHipsterModuleSlugFactory;
public enum MyAppModuleSlug implements JHipsterModuleSlugFactory {
MY_MODULE("my-module");

private static final Map<String, MyAppModuleSlug> moduleSlugMap = Stream
.of(values())
.collect(Collectors.toMap(MyAppModuleSlug::get, Function.identity()));
private static final Map<String, MyAppModuleSlug> moduleSlugMap = Stream.of(values()).collect(
Collectors.toMap(MyAppModuleSlug::get, Function.identity())
);
private final String slug;

MyAppModuleSlug(String slug) {
Expand All @@ -184,7 +182,7 @@ public enum MyAppModuleSlug implements JHipsterModuleSlugFactory {

```

For this to work, we'll need to add a simple orchestration class in `com.mycompany.myapp.my_module.application`:
For this to work, we'll need to add a simple orchestration class in `tech.jhipster.lite.extension.my_module.application`:

```java
@Service
Expand Down
14 changes: 8 additions & 6 deletions documentation/package-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@

This application comes with two package level annotations:

* `SharedKernel` used to mark packages containing classes shared between multiple contexts;
* `BusinessContext` used to mark packages containing classes to answer a specific business need. Classes in this package can't be used in another package.
- `SharedKernel` used to mark packages containing classes shared between multiple contexts;
- `BusinessContext` used to mark packages containing classes to answer a specific business need. Classes in this package can't be used in another package.

To mark a package, you have to add a `package-info.java` file at the package root with:

```java
@com.mycompany.myapp.SharedKernel
package com.mycompany.myapp;
@tech.jhipster.lite.extension.SharedKernel
package tech.jhipster.lite.extension;

```

or:

```java
@com.mycompany.myapp.BusinessContext
package com.mycompany.myapp;
@tech.jhipster.lite.extension.BusinessContext
package tech.jhipster.lite.extension;

```
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "jhipster-sample-application",
"name": "jhlite-extension-sample",
"version": "0.0.0",
"private": true,
"description": "JHipster Sample Application",
"description": "JHLite Extension Sample",
"license": "UNLICENSED",
"scripts": {
"prepare": "husky",
Expand Down
18 changes: 11 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<?xml version="1.0" encoding="UTF-8" ?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>

<groupId>com.mycompany.myapp</groupId>
<artifactId>jhipster-sample-application</artifactId>
<groupId>tech.jhipster.lite.extension</groupId>
<artifactId>jhlite-extension-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>jhipsterSampleApplication</name>
<description>JHipster Sample Application</description>
<name>jhliteExtensionSample</name>
<description>JHLite Extension Sample</description>
<packaging>jar</packaging>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -162,7 +166,7 @@
</execution>
</executions>
<configuration>
<mainClass>com.mycompany.myapp.JhipsterSampleApplicationApp</mainClass>
<mainClass>tech.jhipster.lite.extension.JhliteExtensionSampleApp</mainClass>
</configuration>
</plugin>
</plugins>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1357a0b

Please sign in to comment.