-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle
More file actions
197 lines (160 loc) · 5.27 KB
/
build.gradle
File metadata and controls
197 lines (160 loc) · 5.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.3'
}
group = 'org.cassandrasql'
version = '0.1.0-SNAPSHOT'
sourceCompatibility = '17'
repositories {
mavenCentral()
}
dependencies {
// Spring Boot Web
implementation 'org.springframework.boot:spring-boot-starter-web'
// Apache Calcite (for SQL parsing)
implementation 'org.apache.calcite:calcite-core:1.35.0'
// Apache Calcite Server (for DDL support - CREATE TABLE, etc.)
implementation 'org.apache.calcite:calcite-server:1.35.0'
// Cassandra Driver
implementation 'com.datastax.oss:java-driver-core:4.17.0'
// Jakarta Annotations (for @PostConstruct, @PreDestroy)
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
// Netty (for PostgreSQL wire protocol)
implementation 'io.netty:netty-all:4.1.100.Final'
// Testing
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
testImplementation 'org.mockito:mockito-core:5.5.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.5.0'
// PostgreSQL JDBC driver for testing PostgreSQL protocol
testImplementation 'org.postgresql:postgresql:42.6.0'
}
// Configure test task
tasks.named('test') {
useJUnitPlatform()
// Fail build on test failures
ignoreFailures = false
// Show test results
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showStandardStreams = false
showCauses = true
showStackTraces = true
}
// Set test timeout (increased to 20 minutes for comprehensive test suites)
timeout = Duration.ofMinutes(20)
// JVM args for tests
jvmArgs = [
'-Xmx2g',
'-XX:+UseG1GC'
]
// System properties for tests
systemProperty 'spring.profiles.active', 'test'
// Separate unit tests from integration tests
filter {
// Run all tests by default
includeTestsMatching "*Test"
}
}
// Separate integration test task
task integrationTest(type: Test) {
description = 'Runs integration tests that require Cassandra'
group = 'verification'
useJUnitPlatform()
// Only run integration tests
filter {
includeTestsMatching "*IntegrationTest"
}
// Fail build on test failures
ignoreFailures = false
// Show test results
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showStandardStreams = true // Show output for integration tests
showCauses = true
showStackTraces = true
}
// Longer timeout for integration tests
timeout = Duration.ofMinutes(15)
// More memory for integration tests
jvmArgs = [
'-Xmx4g',
'-XX:+UseG1GC'
]
systemProperty 'spring.profiles.active', 'test'
// Ensure Cassandra is running
doFirst {
println "=" * 80
println "Running Integration Tests"
println "=" * 80
println "NOTE: Cassandra must be running on localhost:9042"
println "Start with: ./bin/start-cassandra.sh"
println "=" * 80
}
doLast {
println "=" * 80
println "Integration Tests Complete"
println "=" * 80
}
}
// Make build depend on integration tests (only for CI/CD, not for bootRun)
// Commented out to allow fast development iteration
// Uncomment for CI/CD pipelines or run explicitly with: ./gradlew build
// build.dependsOn integrationTest
// Custom task to display project info
task info {
doLast {
println "Project: ${project.name}"
println "Version: ${project.version}"
println "Java: ${sourceCompatibility}"
println "Spring Boot: 3.1.5"
println "Calcite: 1.35.0"
println "Cassandra Driver: 4.17.0"
}
}
// Task to run only unit tests (no integration tests)
task unitTest(type: Test) {
description = 'Runs only unit tests (no integration tests)'
group = 'verification'
useJUnitPlatform()
filter {
excludeTestsMatching "*IntegrationTest"
}
ignoreFailures = false
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showCauses = true
showStackTraces = true
}
}
// Task to run application without tests (fast development)
task runDev {
description = 'Runs the application without running tests (fast development)'
group = 'application'
dependsOn 'bootRun'
doFirst {
println "=" * 80
println "Starting Application (skipping tests for fast iteration)"
println "=" * 80
println "To run tests manually:"
println " Unit tests: ./gradlew unitTest"
println " Integration tests: ./gradlew integrationTest"
println " All tests: ./gradlew test"
println "=" * 80
}
}
// Task to run full build with all tests (for CI/CD)
task buildWithTests {
description = 'Builds the application and runs all tests (for CI/CD)'
group = 'build'
dependsOn 'build', 'integrationTest'
doFirst {
println "=" * 80
println "Running Full Build with All Tests"
println "=" * 80
}
}