Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
token: ${{ secrets.MACHINES_SWU_TOKEN }}
ref: master
- name: Run api setup action
id: setup_action
uses: ./
with:
email: ${{ secrets.QA_USERNAME }}
Expand All @@ -37,7 +38,9 @@ jobs:
with:
java-version: 13

- name: Build with Gradle
- name: Build and Test with Gradle
run: ./gradlew build
env:
DYSPATCH_API_KEY: ${{ secrets.DYSPATCH_API_KEY }}
DYSPATCH_TEMPLATE_ID: ${{ steps.setup_action.outputs.templateId }}
DYSPATCH_DRAFT_ID: ${{ steps.setup_action.outputs.draftId }}
19 changes: 10 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,16 @@ if(hasProperty('target') && target == 'android') {
}

dependencies {
compile 'io.swagger:swagger-annotations:1.5.24'
compile "com.google.code.findbugs:jsr305:3.0.2"
compile 'com.squareup.okhttp3:okhttp:4.7.2'
compile 'com.squareup.okhttp3:logging-interceptor:4.7.2'
compile 'com.google.code.gson:gson:2.8.6'
compile 'io.gsonfire:gson-fire:1.8.4'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
compile 'javax.annotation:javax.annotation-api:1.3.2'
testCompile 'junit:junit:4.13'
implementation 'io.swagger:swagger-annotations:1.5.24'
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation 'com.squareup.okhttp3:okhttp:4.7.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'io.gsonfire:gson-fire:1.8.4'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
implementation 'javax.annotation:javax.annotation-api:1.3.2'
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
}

javadoc {
Expand Down
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Fri Dec 11 12:53:21 PST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
47 changes: 40 additions & 7 deletions src/test/java/io/dyspatch/client/api/IntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,34 @@
import io.dyspatch.client.ApiClient;
import io.dyspatch.client.ApiException;
import io.dyspatch.client.Configuration;
import io.dyspatch.client.auth.*;
import io.dyspatch.client.api.DraftsApi;
import io.dyspatch.client.api.TemplatesApi;

import io.dyspatch.client.auth.ApiKeyAuth;
import io.dyspatch.client.model.InlineObject;
import io.dyspatch.client.model.LocalizationKeyRead;
import io.dyspatch.client.model.LocalizationMetaRead;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;

import java.util.HashMap;
import java.util.List;

/**
* Integration tests.
* THESE ARE HAND BUILT AND NOT GENERATED, DO NOT DELETE
*/
public class IntegrationTest {
String version = "application/vnd.dyspatch.2020.04+json";
String version = "application/vnd.dyspatch.2020.11+json";
ApiClient client;
DraftsApi drafts;
TemplatesApi templates;
ApiKeyAuth auth;

public IntegrationTest() {
client = Configuration.getDefaultApiClient();
String basePath = System.getenv("DYSPATCH_BASE_PATH");
if (basePath != null && basePath.length() > 0) {
client.setBasePath(basePath);
}
client.setApiKey(System.getenv("DYSPATCH_API_KEY"));
client.setApiKeyPrefix("Bearer");

Expand All @@ -33,15 +42,39 @@ public IntegrationTest() {
public void getTemplates() throws ApiException {
templates.getTemplates(version, "");

String templateId = "tem_01de5teh6k59kya8q92mb01qzq";
String templateId = System.getenv("DYSPATCH_TEMPLATE_ID");
templates.getTemplateById(templateId, "handlebars", version);
}

@Test
public void getDrafts() throws ApiException {
drafts.getDrafts(version, "", "");

String draftId = "tdft_01dxkwr0nevs5h2baa3n3dgktp";
String draftId = System.getenv("DYSPATCH_DRAFT_ID");
drafts.getDraftById(draftId, "handlebars", version);
}

@Test
public void localizations() throws ApiException {
String draftId = System.getenv("DYSPATCH_DRAFT_ID");
InlineObject io = new InlineObject();
io.name("moonbeam");
drafts.saveLocalization(draftId, "en-CA", version, io);
List<LocalizationMetaRead> localizations = drafts.getLocalizationForDraft(draftId, version);
assertThat(localizations, hasSize(1));
assertThat(localizations.get(0).getName(), equalTo("moonbeam"));

HashMap<String, String> values = new HashMap<>();
values.put("test", "value");
drafts.setTranslation(draftId, "en-CA", version, values);

List<LocalizationKeyRead> keys = drafts.getDraftLocalizationKeys(draftId, version);
assertThat(keys, hasSize(0));

drafts.deleteLocalization(draftId, "en-CA", version);
localizations = drafts.getLocalizationForDraft(draftId, version);
assertThat(localizations, hasSize(0));

drafts.submitDraftForApproval(draftId, version);
}
}