Skip to content

Commit

Permalink
chore(cts): update dependency on cts generation for java
Browse files Browse the repository at this point in the history
  • Loading branch information
eunjae-lee committed May 16, 2022
1 parent 27f5e4a commit f1681b7
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/generation.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
'!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/**',
'!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/**',

'tests/output/java/build.gradle',
'tests/output/java/src/test/java/com/algolia/methods/**', // this could be added automatically by the script, but with overhead
'tests/output/java/src/test/java/com/algolia/client/**',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public abstract class CtsManager {

public abstract void addSupportingFiles(List<SupportingFile> supportingFiles);

public List<Object> getPackageDependencies() {
protected List<Object> getPackageDependencies() {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
package com.algolia.codegen.cts.manager;

import com.algolia.codegen.Utils;
import java.util.*;
import org.openapitools.codegen.SupportingFile;

public class JavaCtsManager extends CtsManager {

public void addSupportingFiles(List<SupportingFile> supportingFiles) {}
public void addSupportingFiles(List<SupportingFile> supportingFiles) {
supportingFiles.add(
new SupportingFile("build.mustache", ".", "build.gradle")
);
}

protected void addExtraToBundle(Map<String, Object> bundle) {
bundle.put(
"packageVersion",
Utils
.readJsonFile("config/clients.config.json")
.get("java")
.get("packageVersion")
.asText()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void addSupportingFiles(List<SupportingFile> supportingFiles) {
);
}

public List<Object> getPackageDependencies() {
protected List<Object> getPackageDependencies() {
List<Object> result = new ArrayList<Object>();

JsonNode openApiToolsConfig = Utils.readJsonFile(
Expand Down
31 changes: 31 additions & 0 deletions tests/CTS/methods/requests/templates/java/build.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
plugins {
id 'java'
}

repositories {
mavenCentral()
}

dependencies {
testImplementation 'com.algolia:algoliasearch-client-java:{{packageVersion}}-SNAPSHOT'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
testImplementation 'org.skyscreamer:jsonassert:1.5.0'
testImplementation 'com.google.code.gson:gson:2.8.9'
}

group = 'com.algolia'
version = '1.0'
description = 'java-tests'
java.sourceCompatibility = JavaVersion.VERSION_1_8

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

test() {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
}
}

0 comments on commit f1681b7

Please sign in to comment.