Skip to content

Commit

Permalink
Merge pull request #136 from orkes-io/remove_gson
Browse files Browse the repository at this point in the history
Remove Gson, Jersey Dependencies and Usability fixes
  • Loading branch information
v1r3n authored Jun 28, 2023
2 parents 816d272 + 04190ec commit 59eaa12
Show file tree
Hide file tree
Showing 67 changed files with 2,516 additions and 1,032 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/intgtest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Integration Tests
name: CI

on: workflow_dispatch
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
integration-test:
Expand All @@ -18,7 +25,7 @@ jobs:
run: |
hostname
echo "host is $HOSTNAME"
./gradlew clean test -x check
./gradlew clean test
env:
SDK_INTEGRATION_TESTS_SERVER_API_URL: ${{ secrets.SDK_INTEGRATION_TESTS_SERVER_API_URL }}
SDK_INTEGRATION_TESTS_SERVER_KEY_ID: ${{ secrets.SDK_INTEGRATION_TESTS_SERVER_KEY_ID }}
Expand Down
45 changes: 29 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ ext {
versions = [
awaitility : '4.2.0',
commonsLang : '3.12.0',
conductor : '3.9.0-orkes-o',
conductor : '3.9.12-orkes',
jackson : '2.11.4!!',
jersey : '1.19.4',
junit : '5.9.0',
slf4j : '1.7.36',
spectator : '1.3.7',
Expand All @@ -33,10 +32,10 @@ ext {
wiremock : '2.33.2',
ioGRPC : '1.49.0',
ioGRPC : '1.49.0',
protoBuf : '3.19.4',
protoBuf : '3.19.4',
lombok : '1.18.24',
revJAXRS : '2.1.1',
revJerseyCommon : '2.22.2',
revJAXRS : '2.1.1',
log4j : '2.17.1',
netty : '4.1.77.Final'

]
Expand All @@ -46,20 +45,13 @@ group = 'io.orkes.conductor'

dependencies {

api ("io.orkes.conductor:conductor-client:${versions.conductor}")
api ("io.orkes.conductor:conductor-client-spring:${versions.conductor}")
api ("io.orkes.conductor:conductor-common:${versions.conductor}")
api ("io.orkes.conductor:conductor-grpc:${versions.conductor}")
api ("io.orkes.conductor:conductor-java-sdk:${versions.conductor}")
implementation "com.sun.jersey:jersey-client:${versions.jersey}"
implementation 'javax.annotation:javax.annotation-api:1.3.2'

implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:${versions.jackson}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${versions.jackson}"

implementation "javax.ws.rs:javax.ws.rs-api:${versions.revJAXRS}"
implementation "org.glassfish.jersey.core:jersey-common:${versions.revJerseyCommon}"

implementation "org.slf4j:slf4j-api:${versions.slf4j}"

api 'io.orkes.conductor:orkes-conductor-common-protos:0.9.2'
Expand Down Expand Up @@ -89,9 +81,6 @@ dependencies {
implementation 'com.squareup.okhttp:okhttp:2.7.5'
implementation 'com.squareup.okhttp:logging-interceptor:2.7.5'

implementation 'com.google.code.gson:gson:2.9.0'
implementation 'io.gsonfire:gson-fire:1.8.5'

implementation 'io.swagger.core.v3:swagger-annotations:2.2.2'

implementation "org.apache.commons:commons-lang3:${versions.commonsLang}"
Expand All @@ -103,6 +92,17 @@ dependencies {
implementation "com.azure:azure-security-keyvault-secrets:${versions.azureSsm}"
implementation "com.azure:azure-identity:${versions.azureIdentity}"

//logging
implementation "org.apache.logging.log4j:log4j-core:${versions.log4j}!!"
implementation "org.apache.logging.log4j:log4j-api:${versions.log4j}!!"
implementation "org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}!!"
implementation "org.apache.logging.log4j:log4j-jul:${versions.log4j}!!"
implementation "org.apache.logging.log4j:log4j-web:${versions.log4j}!!"
//implementation "org.apache.logging.log4j:log4j-to-slf4j:${versions.log4j}!!"

//spring
implementation "org.springframework:spring-context:5.3.24"

annotationProcessor "org.projectlombok:lombok:${versions.lombok}"
testAnnotationProcessor "org.projectlombok:lombok:${versions.lombok}"

Expand All @@ -114,6 +114,11 @@ dependencies {
testImplementation 'org.testcontainers:testcontainers:1.17.1'
testImplementation 'com.amazonaws:aws-java-sdk-core:1.12.138'
testCompileOnly "org.projectlombok:lombok:${versions.lombok}"

//Spring
testImplementation 'org.springframework.boot:spring-boot-starters:2.2.13.RELEASE'
testImplementation 'org.springframework.boot:spring-boot-autoconfigure:2.7.8'
testImplementation 'org.springframework.boot:spring-boot-test:2.7.8'
}

repositories {
Expand Down Expand Up @@ -206,6 +211,14 @@ configurations.implementation {
exclude(group : "com.netflix.conductor")
}

configurations {
all {
//exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'com.netflix.conductor'
exclude group: 'javax.ws.rs', module: 'javax.ws.rs-api'
}
}

spotless {
java {
Expand All @@ -231,7 +244,7 @@ signing {
}
}
tasks.withType(Test) {
maxParallelForks = 1
maxParallelForks = 10
}
sourceSets.main.java.srcDirs += ['example/java', 'example/resources']

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=3.0.45
version=2.0.0
17 changes: 17 additions & 0 deletions src/main/java/com/google/gson/annotations/SerializedName.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2023 Orkes, Inc.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
package com.google.gson.annotations;

public @interface SerializedName {
String value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2018 Orkes, Inc.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
package com.netflix.conductor.client.config;

public interface ConductorClientConfiguration {

/**
* @return the workflow input payload size threshold in KB, beyond which the payload will be
* processed based on {@link
* ConductorClientConfiguration#isExternalPayloadStorageEnabled()}.
*/
int getWorkflowInputPayloadThresholdKB();

/**
* @return the max value of workflow input payload size threshold in KB, beyond which the
* payload will be rejected regardless external payload storage is enabled.
*/
int getWorkflowInputMaxPayloadThresholdKB();

/**
* @return the task output payload size threshold in KB, beyond which the payload will be
* processed based on {@link
* ConductorClientConfiguration#isExternalPayloadStorageEnabled()}.
*/
int getTaskOutputPayloadThresholdKB();

/**
* @return the max value of task output payload size threshold in KB, beyond which the payload
* will be rejected regardless external payload storage is enabled.
*/
int getTaskOutputMaxPayloadThresholdKB();

/**
* @return the flag which controls the use of external storage for storing workflow/task input
* and output JSON payloads with size greater than threshold. If it is set to true, the
* payload is stored in external location. If it is set to false, the payload is rejected
* and the task/workflow execution fails.
*/
boolean isExternalPayloadStorageEnabled();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Copyright 2020 Orkes, Inc.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
package com.netflix.conductor.client.config;

import java.util.concurrent.ConcurrentHashMap;

import com.netflix.config.DynamicProperty;

/** Used to configure the Conductor workers using properties. */
public class PropertyFactory {

private final DynamicProperty global;
private final DynamicProperty local;

private static final String PROPERTY_PREFIX = "conductor.worker";

private static final ConcurrentHashMap<String, PropertyFactory> PROPERTY_FACTORY_MAP =
new ConcurrentHashMap<>();

private PropertyFactory(String prefix, String propName, String workerName) {
this.global = DynamicProperty.getInstance(prefix + "." + propName);
this.local = DynamicProperty.getInstance(prefix + "." + workerName + "." + propName);
}

/**
* @param defaultValue Default Value
* @return Returns the value as integer. If not value is set (either global or worker specific),
* then returns the default value.
*/
public Integer getInteger(int defaultValue) {
Integer value = local.getInteger();
if (value == null) {
value = global.getInteger(defaultValue);
}
return value;
}

/**
* @param defaultValue Default Value
* @return Returns the value as String. If not value is set (either global or worker specific),
* then returns the default value.
*/
public String getString(String defaultValue) {
String value = local.getString();
if (value == null) {
value = global.getString(defaultValue);
}
return value;
}

/**
* @param defaultValue Default Value
* @return Returns the value as Boolean. If not value is set (either global or worker specific),
* then returns the default value.
*/
public Boolean getBoolean(Boolean defaultValue) {
Boolean value = local.getBoolean();
if (value == null) {
value = global.getBoolean(defaultValue);
}
return value;
}

public static Integer getInteger(String workerName, String property, Integer defaultValue) {
return getPropertyFactory(workerName, property).getInteger(defaultValue);
}

public static Boolean getBoolean(String workerName, String property, Boolean defaultValue) {
return getPropertyFactory(workerName, property).getBoolean(defaultValue);
}

public static String getString(String workerName, String property, String defaultValue) {
return getPropertyFactory(workerName, property).getString(defaultValue);
}

private static PropertyFactory getPropertyFactory(String workerName, String property) {
String key = property + "." + workerName;
return PROPERTY_FACTORY_MAP.computeIfAbsent(
key, t -> new PropertyFactory(PROPERTY_PREFIX, property, workerName));
}
}
Loading

0 comments on commit 59eaa12

Please sign in to comment.