Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt B Krystof committed Oct 1, 2024
2 parents 1432845 + 9bf81a9 commit f8a69b8
Show file tree
Hide file tree
Showing 90 changed files with 4,515 additions and 606 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/graphql-service-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Run Gradle Test
run: ./gradlew test
run: ./gradlew test
35 changes: 31 additions & 4 deletions pstatus-graphql-ktor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ dependencies {
testImplementation "io.ktor:ktor-server-tests-jvm:$ktor_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"

// testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
// testImplementation 'org.mockito:mockito-core:4.6.1'
// testImplementation 'org.mockito:mockito-junit-jupiter:4.6.1'

testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.1"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.8.1"
testImplementation "org.mockito:mockito-core:4.5.1"
Expand Down Expand Up @@ -108,4 +104,35 @@ jib {
}
}

test {

// Discover and execute JUnit Platform-based (JUnit 5, JUnit Jupiter) tests
// JUnit 5 has the ability to execute JUnit 4 tests as well
useJUnitPlatform()

//Change this to "true" if we want to execute unit tests
systemProperty("isTestEnvironment", "false")

// Set the test classpath, if required
}

sourceSets {
main {
java {
srcDir 'src/kotlin'
}
resources {
srcDir 'src/resources'
}
}
test {
java {
srcDir 'src/kotlin'
}
resources {
srcDir 'src/resources'
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fun KoinApplication.loadKoinModules(environment: ApplicationEnvironment): KoinAp
// Create a CosmosDB config that can be dependency injected (for health checks)
single(createdAtStart = true) { CosmosConfiguration(uri, authKey) }
}

return modules(listOf(cosmosModule))
}

Expand All @@ -34,15 +35,20 @@ fun main(args: Array<String>) {
}

fun Application.module() {
graphQLModule()
configureRouting()

install(Koin) {
loadKoinModules(environment)
}
graphQLModule()
configureRouting()

install(ContentNegotiation) {
jackson()
}




// See https://opensource.expediagroup.com/graphql-kotlin/docs/schema-generator/writing-schemas/scalars
RuntimeWiring.newRuntimeWiring().scalar(ExtendedScalars.Date)
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package gov.cdc.ocio.processingstatusapi.models

/**
* Enumeration of the possible sort orders for queries.
*/
enum class ReportContentType (val type: String){
JSON("application/json"),
JSON_SHORT("json"),
BASE64("base64");

companion object {
fun fromString(type: String): ReportContentType {
return values().find { it.type.equals(type, ignoreCase = true) }
?: throw IllegalArgumentException("Unsupported content type: $type")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gov.cdc.ocio.processingstatusapi.models.query

import com.expediagroup.graphql.generator.annotations.GraphQLDescription

@GraphQLDescription("Collection of undelivered uploads found")
data class PendingUploadCounts(

@GraphQLDescription("Total number of undelivered uploads.")
var totalCount: Long = 0,

@GraphQLDescription("Provides a list of all the uploads that have not been delivered. This means, the upload started, but according to the upload status reports we did not receive 100% of the expected chunks.")
var pendingUploads: List<UnDeliveredUpload> = listOf()
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gov.cdc.ocio.processingstatusapi.models.query

import com.expediagroup.graphql.generator.annotations.GraphQLDescription

@GraphQLDescription("Collection of undelivered found")
data class UnDeliveredUpload(

@GraphQLDescription("UploadId of the file that is not delivered.")
var uploadId: String? = null,

@GraphQLDescription("Filename of the file that is not delivered.")
var filename: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gov.cdc.ocio.processingstatusapi.models.query

import com.expediagroup.graphql.generator.annotations.GraphQLDescription

@GraphQLDescription("Collection of undelivered uploads found")
data class UnDeliveredUploadCounts(

@GraphQLDescription("Total number of undelivered uploads.")
var totalCount: Long = 0,

@GraphQLDescription("Provides a list of all the uploads that have not been delivered. This means, the upload started, but according to the upload status reports we did not receive 100% of the expected chunks.")
var unDeliveredUploads: List<UnDeliveredUpload> = listOf()
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@ data class UploadStats(
var completedUploadsCount: Long = 0,

@GraphQLDescription("Provides a list of all the duplicate filenames that were uploaded and how many.")
var duplicateFilenames: List<DuplicateFilenameCounts> = listOf()
var duplicateFilenames: List<DuplicateFilenameCounts> = listOf(),

@GraphQLDescription("Provides a list of all the uploads that have not been delivered. This means, the upload started, but according to the upload status reports we did not receive 100% of the expected chunks.")
var unDeliveredUploads: UnDeliveredUploadCounts = UnDeliveredUploadCounts(),

@GraphQLDescription("Provides a list of all the uploads that are pending. This means, the upload started, but according to the upload status reports we did not receive 100% of the expected chunks.")
var pendingUploads: PendingUploadCounts = PendingUploadCounts()
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package gov.cdc.ocio.processingstatusapi.models.reports.inputs

import com.expediagroup.graphql.generator.annotations.GraphQLDescription

@GraphQLDescription("Input type for tags")
data class DataInput(
@GraphQLDescription("Tag key")
val key: String,

@GraphQLDescription("Tag value")
val value: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package gov.cdc.ocio.processingstatusapi.models.reports.inputs

import com.expediagroup.graphql.generator.annotations.GraphQLDescription

@GraphQLDescription("Input type for issues")
data class IssueInput(
@GraphQLDescription("Issue code")
val code: String? = null,

@GraphQLDescription("Issue description")
val description: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package gov.cdc.ocio.processingstatusapi.models.reports.inputs

import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import gov.cdc.ocio.processingstatusapi.models.submission.Aggregation

@GraphQLDescription("Input type for message metadata")
data class MessageMetadataInput(
@GraphQLDescription("Unique Identifier for that message")
val messageUUID: String? = null,

@GraphQLDescription("MessageHash value")
val messageHash: String? = null,

@GraphQLDescription("Single or Batch message")
val aggregation: Aggregation? = null,

@GraphQLDescription("Message Index")
val messageIndex: Int? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package gov.cdc.ocio.processingstatusapi.models.reports.inputs

import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import java.time.OffsetDateTime

@GraphQLDescription("Input type for creating or updating a report")
data class ReportInput(
@GraphQLDescription("Identifier of the report recorded by the database")
val id: String? = null,

@GraphQLDescription("Upload identifier this report belongs to")
val uploadId: String? = null,

@GraphQLDescription("Unique report identifier")
val reportId: String? = null,

@GraphQLDescription("Data stream ID")
val dataStreamId: String? = null,

@GraphQLDescription("Data stream route")
val dataStreamRoute: String? = null,

@GraphQLDescription("Date/time of when the upload was first ingested into the data-exchange")
val dexIngestDateTime: OffsetDateTime? = null,

@GraphQLDescription("Message metadata")
val messageMetadata: MessageMetadataInput? = null,

@GraphQLDescription("Stage info")
val stageInfo: StageInfoInput? = null,

@GraphQLDescription("Tags")
val tags: List<TagInput>? = null,

@GraphQLDescription("Data")
val data: List<DataInput>? = null,

@GraphQLDescription("Indicates the content type of the content; e.g. JSON, XML")
val contentType: String? = null,

@GraphQLDescription("Jurisdiction report belongs to; set to null if not applicable")
val jurisdiction: String? = null,

@GraphQLDescription("Sender ID this report belongs to; set to null if not applicable")
val senderId: String? = null,

@GraphQLDescription("Data Producer ID stated in the report; set to null if not applicable")
val dataProducerId: String? = null,

@GraphQLDescription("Content of the report. If the report is JSON then the content will be a map, otherwise, it will be a string")
var content : String? = null,

@GraphQLDescription("Timestamp when the report was recorded in the database")
val timestamp: OffsetDateTime? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package gov.cdc.ocio.processingstatusapi.models.reports.inputs

import com.expediagroup.graphql.generator.annotations.GraphQLDescription
import gov.cdc.ocio.processingstatusapi.models.submission.Status
import java.time.OffsetDateTime

@GraphQLDescription("Input type for stage info")
data class StageInfoInput(
@GraphQLDescription("Service")
val service: String? = null,

@GraphQLDescription("Stage name a.k.a action")
val action: String? = null,

@GraphQLDescription("Version")
val version: String? = null,

@GraphQLDescription("Status- SUCCESS OR FAILURE")
val status: Status? = null,

@GraphQLDescription("Issues array")
val issues: List<IssueInput>? = null,

@GraphQLDescription("Start processing time")
val startProcessingTime: OffsetDateTime? = null,

@GraphQLDescription("End processing time")
val endProcessingTime: OffsetDateTime? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package gov.cdc.ocio.processingstatusapi.models.reports.inputs

import com.expediagroup.graphql.generator.annotations.GraphQLDescription

@GraphQLDescription("Input type for tags")
data class TagInput(
@GraphQLDescription("Tag key")
val key: String,

@GraphQLDescription("Tag value")
val value: String
)
Loading

0 comments on commit f8a69b8

Please sign in to comment.