-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract split the server into 2 modules (#21736)
* tmp * For diff * Extract common server * Format * Better way to get resources * Extract the old mapper * Move test as well * Format
- Loading branch information
1 parent
daa8eb1
commit 0b97ce3
Showing
185 changed files
with
389 additions
and
310 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
plugins { | ||
id "java-library" | ||
} | ||
|
||
dependencies { | ||
annotationProcessor platform(libs.micronaut.bom) | ||
annotationProcessor libs.bundles.micronaut.annotation.processor | ||
annotationProcessor libs.micronaut.jaxrs.processor | ||
|
||
implementation platform(libs.micronaut.bom) | ||
implementation libs.bundles.micronaut | ||
implementation libs.micronaut.jaxrs.server | ||
|
||
// Ensure that the versions defined in deps.toml are used | ||
// instead of versions from transitive dependencies | ||
implementation(libs.flyway.core) { | ||
force = true | ||
} | ||
implementation(libs.s3) { | ||
// Force to avoid updated version brought in transitively from Micronaut 3.8+ | ||
// that is incompatible with our current Helm setup | ||
force = true | ||
} | ||
implementation(libs.aws.java.sdk.s3) { | ||
// Force to avoid updated version brought in transitively from Micronaut 3.8+ | ||
// that is incompatible with our current Helm setup | ||
force = true | ||
} | ||
|
||
implementation project(':airbyte-analytics') | ||
implementation project(':airbyte-api') | ||
implementation project(':airbyte-commons-docker') | ||
implementation project(':airbyte-commons-temporal') | ||
implementation project(':airbyte-commons-worker') | ||
implementation project(':airbyte-config:init') | ||
implementation project(':airbyte-config:config-models') | ||
implementation project(':airbyte-config:config-persistence') | ||
implementation project(':airbyte-config:specs') | ||
implementation project(':airbyte-metrics:metrics-lib') | ||
implementation project(':airbyte-db:db-lib') | ||
implementation project(":airbyte-json-validation") | ||
implementation project(':airbyte-notification') | ||
implementation project(':airbyte-oauth') | ||
implementation project(':airbyte-protocol:protocol-models') | ||
implementation project(':airbyte-persistence:job-persistence') | ||
|
||
implementation 'com.github.slugify:slugify:2.4' | ||
implementation 'commons-cli:commons-cli:1.4' | ||
implementation libs.temporal.sdk | ||
implementation 'org.apache.cxf:cxf-core:3.4.2' | ||
implementation 'org.eclipse.jetty:jetty-server:9.4.31.v20200723' | ||
implementation 'org.eclipse.jetty:jetty-servlet:9.4.31.v20200723' | ||
implementation 'org.glassfish.jaxb:jaxb-runtime:3.0.2' | ||
implementation 'org.glassfish.jersey.containers:jersey-container-servlet' | ||
implementation 'org.glassfish.jersey.inject:jersey-hk2' | ||
implementation 'org.glassfish.jersey.media:jersey-media-json-jackson' | ||
implementation 'org.glassfish.jersey.ext:jersey-bean-validation' | ||
implementation 'org.quartz-scheduler:quartz:2.3.2' | ||
implementation 'io.sentry:sentry:6.3.1' | ||
implementation 'io.swagger:swagger-annotations:1.6.2' | ||
|
||
testImplementation project(':airbyte-test-utils') | ||
testImplementation libs.postgresql | ||
testImplementation libs.platform.testcontainers.postgresql | ||
testImplementation 'com.squareup.okhttp3:mockwebserver:4.9.1' | ||
testImplementation 'org.mockito:mockito-inline:4.7.0' | ||
} | ||
|
||
Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project) |
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
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
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
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
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
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
47 changes: 47 additions & 0 deletions
47
...ns-server/src/main/java/io/airbyte/commons/server/errors/InvalidInputExceptionMapper.java
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,47 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.commons.server.errors; | ||
|
||
import io.airbyte.api.model.generated.InvalidInputExceptionInfo; | ||
import io.airbyte.api.model.generated.InvalidInputProperty; | ||
import io.airbyte.commons.json.Jsons; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.validation.ConstraintViolation; | ||
import javax.validation.ConstraintViolationException; | ||
import javax.ws.rs.core.Response; | ||
import javax.ws.rs.ext.ExceptionMapper; | ||
import javax.ws.rs.ext.Provider; | ||
import org.apache.logging.log4j.core.util.Throwables; | ||
|
||
@Provider | ||
public class InvalidInputExceptionMapper implements ExceptionMapper<ConstraintViolationException> { | ||
|
||
public static InvalidInputExceptionInfo infoFromConstraints(final ConstraintViolationException cve) { | ||
final InvalidInputExceptionInfo exceptionInfo = new InvalidInputExceptionInfo() | ||
.exceptionClassName(cve.getClass().getName()) | ||
.message("Some properties contained invalid input.") | ||
.exceptionStack(Throwables.toStringList(cve)); | ||
|
||
final List<InvalidInputProperty> props = new ArrayList<InvalidInputProperty>(); | ||
for (final ConstraintViolation<?> cv : cve.getConstraintViolations()) { | ||
props.add(new InvalidInputProperty() | ||
.propertyPath(cv.getPropertyPath().toString()) | ||
.message(cv.getMessage()) | ||
.invalidValue(cv.getInvalidValue() != null ? cv.getInvalidValue().toString() : "null")); | ||
} | ||
exceptionInfo.validationErrors(props); | ||
return exceptionInfo; | ||
} | ||
|
||
@Override | ||
public Response toResponse(final ConstraintViolationException e) { | ||
return Response.status(Response.Status.BAD_REQUEST) | ||
.entity(Jsons.serialize(InvalidInputExceptionMapper.infoFromConstraints(e))) | ||
.type("application/json") | ||
.build(); | ||
} | ||
|
||
} |
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
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
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
Oops, something went wrong.