-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Tmp * Extract the Attempt API from the V1 API * Add comments * Move Connection API out of configuration API * format * format * Rename to Controller * Rename to Controller * Add values to the factory * Change the constructor to use hadler instead of objects needed by the handler * Update with new tags. * tmp * Fix PMD errors * Extract DB migrator * Add something that I forgot * extract destination definition api * restore destination factory initialization * extract destination definition specification api * format * format * format * extract health check api * fix test * format
- Loading branch information
1 parent
c5d5ef3
commit e39f882
Showing
8 changed files
with
140 additions
and
64 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
24 changes: 24 additions & 0 deletions
24
airbyte-server/src/main/java/io/airbyte/server/apis/HealthApiController.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,24 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis; | ||
|
||
import io.airbyte.api.generated.HealthApi; | ||
import io.airbyte.api.model.generated.HealthCheckRead; | ||
import io.airbyte.server.handlers.HealthCheckHandler; | ||
import javax.ws.rs.Path; | ||
import lombok.AllArgsConstructor; | ||
|
||
@Path("/v1/health") | ||
@AllArgsConstructor | ||
public class HealthApiController implements HealthApi { | ||
|
||
private final HealthCheckHandler healthCheckHandler; | ||
|
||
@Override | ||
public HealthCheckRead getHealthCheck() { | ||
return healthCheckHandler.health(); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
airbyte-server/src/main/java/io/airbyte/server/apis/binders/HealthApiBinder.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,21 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis.binders; | ||
|
||
import io.airbyte.server.apis.HealthApiController; | ||
import io.airbyte.server.apis.factories.HealthApiFactory; | ||
import org.glassfish.hk2.utilities.binding.AbstractBinder; | ||
import org.glassfish.jersey.process.internal.RequestScoped; | ||
|
||
public class HealthApiBinder extends AbstractBinder { | ||
|
||
@Override | ||
protected void configure() { | ||
bindFactory(HealthApiFactory.class) | ||
.to(HealthApiController.class) | ||
.in(RequestScoped.class); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
airbyte-server/src/main/java/io/airbyte/server/apis/factories/HealthApiFactory.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,29 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis.factories; | ||
|
||
import io.airbyte.server.apis.HealthApiController; | ||
import io.airbyte.server.handlers.HealthCheckHandler; | ||
import org.glassfish.hk2.api.Factory; | ||
|
||
public class HealthApiFactory implements Factory<HealthApiController> { | ||
|
||
private static HealthCheckHandler healthCheckHandler; | ||
|
||
public static void setValues(final HealthCheckHandler healthCheckHandler) { | ||
HealthApiFactory.healthCheckHandler = healthCheckHandler; | ||
} | ||
|
||
@Override | ||
public HealthApiController provide() { | ||
return new HealthApiController(healthCheckHandler); | ||
} | ||
|
||
@Override | ||
public void dispose(final HealthApiController instance) { | ||
/* no op */ | ||
} | ||
|
||
} |
53 changes: 0 additions & 53 deletions
53
airbyte-server/src/test/java/io/airbyte/server/apis/ConfigurationApiTest.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
airbyte-server/src/test/java/io/airbyte/server/apis/HealthCheckApiTest.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,29 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import io.airbyte.api.model.generated.HealthCheckRead; | ||
import io.airbyte.server.handlers.HealthCheckHandler; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class HealthCheckApiTest { | ||
|
||
@Test | ||
void testImportDefinitions() { | ||
final HealthCheckHandler healthCheckHandler = mock(HealthCheckHandler.class); | ||
when(healthCheckHandler.health()) | ||
.thenReturn(new HealthCheckRead().available( | ||
false)); | ||
|
||
final HealthApiController configurationApi = new HealthApiController(healthCheckHandler); | ||
|
||
assertFalse(configurationApi.getHealthCheck().getAvailable()); | ||
} | ||
|
||
} |