-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24955 from mshima/nested-generators
Add support to nested generators and split Kafka/pulsar generators.
- Loading branch information
Showing
27 changed files
with
299 additions
and
161 deletions.
There are no files selected for viewing
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
File renamed without changes.
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
99 changes: 99 additions & 0 deletions
99
generators/spring-cloud-stream/generators/kafka/generator.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,99 @@ | ||
/** | ||
* Copyright 2013-2024 the original author or authors from the JHipster project. | ||
* | ||
* This file is part of the JHipster project, see https://www.jhipster.tech/ | ||
* for more information. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import BaseApplicationGenerator from '../../../base-application/index.js'; | ||
import cleanupKafkaFilesTask from './cleanup.js'; | ||
import { kafkaFiles } from './files.js'; | ||
|
||
export default class KafkaGenerator extends BaseApplicationGenerator { | ||
get writing() { | ||
return this.asWritingTaskGroup({ | ||
cleanupKafkaFilesTask, | ||
async writing({ application }) { | ||
await this.writeFiles({ | ||
sections: kafkaFiles, | ||
context: application, | ||
}); | ||
}, | ||
}); | ||
} | ||
|
||
get [BaseApplicationGenerator.WRITING]() { | ||
return this.delegateTasksToBlueprint(() => this.writing); | ||
} | ||
|
||
get postWriting() { | ||
return this.asPostWritingTaskGroup({ | ||
customizeApplicationForKafka({ source, application }) { | ||
source.addLogbackMainLog?.({ name: 'org.apache.kafka', level: 'INFO' }); | ||
source.addLogbackTestLog?.({ name: 'kafka', level: 'WARN' }); | ||
source.addLogbackTestLog?.({ name: 'org.I0Itec', level: 'WARN' }); | ||
source.addIntegrationTestAnnotation?.({ package: `${application.packageName}.config`, annotation: 'EmbeddedKafka' }); | ||
|
||
source.addTestSpringFactory?.({ | ||
key: 'org.springframework.test.context.ContextCustomizerFactory', | ||
value: `${application.packageName}.config.KafkaTestContainersSpringContextCustomizerFactory`, | ||
}); | ||
}, | ||
applyKafkaGradleConventionPlugin({ source, application }) { | ||
if (application.buildToolGradle) { | ||
source.addGradlePlugin?.({ id: 'jhipster.kafka-conventions' }); | ||
} | ||
}, | ||
addKafkaMavenDependencies({ application, source }) { | ||
if (application.buildToolMaven) { | ||
source.addMavenDependency?.([ | ||
{ | ||
groupId: 'org.springframework.cloud', | ||
artifactId: 'spring-cloud-stream', | ||
}, | ||
{ | ||
groupId: 'org.springframework.cloud', | ||
artifactId: 'spring-cloud-starter-stream-kafka', | ||
}, | ||
{ | ||
groupId: 'org.springframework.cloud', | ||
artifactId: 'spring-cloud-stream-test-binder', | ||
scope: 'test', | ||
}, | ||
{ | ||
groupId: 'org.testcontainers', | ||
artifactId: 'junit-jupiter', | ||
scope: 'test', | ||
}, | ||
{ | ||
groupId: 'org.testcontainers', | ||
artifactId: 'testcontainers', | ||
scope: 'test', | ||
}, | ||
{ | ||
groupId: 'org.testcontainers', | ||
artifactId: 'kafka', | ||
scope: 'test', | ||
}, | ||
]); | ||
} | ||
}, | ||
}); | ||
} | ||
|
||
get [BaseApplicationGenerator.POST_WRITING]() { | ||
return this.asPostWritingTaskGroup(this.delegateTasksToBlueprint(() => this.postWriting)); | ||
} | ||
} |
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,19 @@ | ||
/** | ||
* Copyright 2013-2024 the original author or authors from the JHipster project. | ||
* | ||
* This file is part of the JHipster project, see https://www.jhipster.tech/ | ||
* for more information. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
export { default } from './generator.js'; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.