Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
08d1291
refactor to consistent flow for both import and export bulk with syncjob
basejump Apr 30, 2025
f173150
spotless
snimavat May 1, 2025
4564016
cleanup
snimavat May 1, 2025
babca69
remove session=true
snimavat May 1, 2025
4bd5ff8
compile
snimavat May 1, 2025
0647134
fix flow
basejump May 1, 2025
e2e4caf
Merge branch 'syncJob_submit_josh' into syncJob_submit
basejump May 1, 2025
e2adf39
comments
basejump May 2, 2025
30dc5ba
Hazel poc (#893)
basejump May 6, 2025
fb4c01c
Merge branch 'dev' into syncJob_submit
snimavat May 6, 2025
276d939
wip
snimavat May 6, 2025
924d9c7
Merge pull request #894 from yakworks/syncjob_submit_sn
basejump May 6, 2025
5307dda
test passing
basejump May 6, 2025
8c27439
queue job
basejump May 6, 2025
31b9d1d
refactor
basejump May 7, 2025
3f5cda0
start on the BulkImport service
basejump May 7, 2025
1188e40
Merge branch 'dev' into syncJob_submit
basejump May 8, 2025
7d9a90a
Syncjob SN (#898)
snimavat May 8, 2025
c37c619
start moving bulk logic
basejump May 9, 2025
2513368
Merge branch 'syncJob-_bulk_move' into syncJob_submit
basejump May 9, 2025
27bd10f
WIP
basejump May 10, 2025
5757aee
refactor to BulkImporter
basejump May 10, 2025
717cdbf
clean up
basejump May 12, 2025
b803b82
Merge branch 'dev' into syncJob_submit
basejump May 12, 2025
6f794f2
Merge branch 'dev' into syncJob_submit
basejump May 12, 2025
f55f345
isolate the bulk into BulkApiSupport
basejump May 12, 2025
3a2cfaf
refactor
basejump May 12, 2025
9c469bd
test and gearing up for the queue
basejump May 14, 2025
589d2e7
get rid of findBy in tests as its loosing session
basejump May 15, 2025
f88b4c4
Merge branch 'dev' into syncJob_submit
basejump May 15, 2025
77cbb2e
Sync job ignite (#901)
basejump May 19, 2025
f3d8a9c
add job service
basejump May 19, 2025
15dd1bf
refactor and profile for either ignite or hazel
basejump May 20, 2025
52705ff
rename
basejump May 20, 2025
94a16cb
centralize lookup
basejump May 20, 2025
bcacdd3
get export working
basejump May 20, 2025
b499004
fix
basejump May 20, 2025
c7627b4
clean up
basejump May 20, 2025
8551761
fix session error
basejump May 21, 2025
fc9542f
Merge branch 'dev' into syncJob_submit
basejump May 22, 2025
8f13b5c
clean up and remove bulk from repo
basejump May 27, 2025
754d293
move all bulk into yakworks.gorm.api.bulk
basejump May 27, 2025
8c3cd88
use a params object instead of a map
basejump May 28, 2025
3631db8
move params
basejump May 28, 2025
8139153
lint
basejump May 28, 2025
dd43ee2
clean up
basejump May 28, 2025
59016d7
compile fix
basejump May 28, 2025
67079c2
more refactoring
basejump May 28, 2025
da92f32
reorg the bulk params
basejump May 29, 2025
f3e858d
more cleanup
basejump May 30, 2025
01b8a90
fix
basejump May 30, 2025
b376409
add trip X
basejump May 30, 2025
fec0e50
refactor BulkExport so its sets saveDataAsFile properly
basejump May 30, 2025
b4ef652
fix so the hydrate is inside transaction
basejump May 30, 2025
771c372
Fix tests
snimavat Jun 2, 2025
7ead37f
tests
snimavat Jun 2, 2025
e084c39
clean up so payload not in multiple spots
basejump Jun 2, 2025
4c7b38e
Merge branch 'syncJob_submit-josh' into syncJob_submit
basejump Jun 2, 2025
42bee0f
add exportPageSize and exportMax
basejump Jun 2, 2025
747d84a
Fix tests
snimavat Jun 3, 2025
3612b2c
Syncjob sn (#903)
snimavat Jun 3, 2025
728a7ad
test fix
basejump Jun 3, 2025
25881b6
Merge branch 'syncJob-fix-test' into syncJob_submit
basejump Jun 3, 2025
e41ace5
standardize
basejump Jun 4, 2025
7b8bd9a
fix
basejump Jun 4, 2025
8ea339a
add bad CSV test
basejump Jun 9, 2025
c15b665
rename dataFormat to dataLayout and add dataFormat for export
basejump Jun 9, 2025
c058fc3
catch clean up
basejump Jun 9, 2025
7542069
Merge branch 'dev' into syncJob_submit
basejump Jun 9, 2025
ba6837c
move CSV to gorm-tools for now
basejump Jun 9, 2025
a76da87
CSV is working for BulkExport, just need to figure out how to render it
basejump Jun 9, 2025
0eb4264
clean up use of data and payload, add dataFormat and centralize on Jo…
basejump Jun 10, 2025
d865596
Merge branch 'dev' into syncJob_submit
basejump Jun 13, 2025
d4c944d
Merge branch 'dev' into syncJob_submit
basejump Jun 16, 2025
dd86484
Syncjob : Tests (#913)
snimavat Jun 19, 2025
ebc30f2
Merge branch 'dev' into syncJob_submit
snimavat Jun 20, 2025
ec20500
Merge branch 'dev' into syncJob_submit
basejump Jul 8, 2025
bc67baf
Merge branch 'dev' into syncJob_submit
basejump Jul 8, 2025
3455d60
fix compile problem
basejump Jul 8, 2025
59c86f5
Merge branch 'dev' into syncJob_submit
basejump Jul 10, 2025
29f5617
remove trip x
basejump Jul 12, 2025
aed5b62
refactor to try and get common props for SyncJobParams (#921)
basejump Jul 14, 2025
30b93b3
beef up example to grab multiple jobs at a time
basejump Jul 14, 2025
2d6ae3c
codenarc
basejump Jul 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ executors:
GRADLE_OPTS: "-Dorg.gradle.caching=true -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2 -Dorg.gradle.console=plain"
docker:
- image: yakworks/bullseye:jdk11
builder-small: # 1cpus 2gb ram, cheapest, used for timeout
resource_class: 'small'
docker:
- image: yakworks/bullseye:jdk11

commands:
restore_gradle_cache:
Expand Down Expand Up @@ -87,6 +91,17 @@ jobs:
- save_workspace
- save_build_cache

timeout-check:
executor: builder-small
steps:
- run:
name: Cancel build after set time
background: true
command: |
sleep 600 # 10min
echo "Canceling workflow as too much time has elapsed"
curl -X POST --header "Content-Type: application/json" "https://circleci.com/api/v2/workflow/${CIRCLE_WORKFLOW_ID}/cancel?circle-token=${CIRCLE_TOKEN}"

gorm-tools:
executor: builder-large
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,5 @@ Session.vim
api-docs/dist
api-docs/node_modules
.build-cache
/examples/rally-api/ignite
/ignite
65 changes: 62 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ test.benchmarks:
cd examples/benchmarks
java -server -Xmx3g -XX:MaxMetaspaceSize=256m \
-DmultiplyData=3 -Dgorm.tools.async.poolSize=4 -Djava.awt.headless=true \
-Dgrails.env=prod -jar build/libs/benchmarks.jar
-Dgrails.env=prod -jar build/libs/benchmarks.jar

# -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap \
# -XX:+UseConcMarkSweepGC -XX:+UseCMSInitiatingOccupancyOnly \
Expand All @@ -159,11 +159,70 @@ test.benchmarks:
# -XX:SurvivorRatio=8 \

## start the rally-api example jar
start.rally-api: # start.db
start.rally-api.ignite: # start.db
${gradlew} rally-api:assemble
cd examples/rally-api
java -server -Xmx2g -jar build/libs/rally-api.jar
java \
--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED \
--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED \
--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED \
--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED \
--illegal-access=permit \
-server -Dserver.port=8083 \
-Dspring.profiles.active=production,local,server,ignite \
-Djava.net.preferIPv4Stack=true \
-Xmx2g -jar build/libs/rally-api.jar

start.rally-api2.ignite: # start.db
cd examples/rally-api
java \
--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED \
--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED \
--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED \
--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED \
--illegal-access=permit \
-server -Dserver.port=8084 \
-Dspring.profiles.active=production,local,client,ignite \
-Djava.net.preferIPv4Stack=true \
-Xmx2g -jar build/libs/rally-api.jar

## start the rally-api example jar with hazel cast
start.rally-api: # start.db
${gradlew} rally-api:assemble
java \
-server -Dserver.port=8083 \
-Dspring.profiles.active=production,local,server,hazel \
-Djava.net.preferIPv4Stack=true \
-Xmx2g -jar examples/rally-api/build/libs/rally-api.jar

start.rally-api2:
java \
-server -Dserver.port=8084 \
-Dspring.profiles.active=production,local,client,hazel \
-Djava.net.preferIPv4Stack=true \
-Xmx2g -jar examples/rally-api/build/libs/rally-api.jar

start.rally-api3:
java \
-server -Dserver.port=8085 \
-Dspring.profiles.active=production,local,client,hazel \
-Djava.net.preferIPv4Stack=true \
-Xmx2g -jar examples/rally-api/build/libs/rally-api.jar

## start rcm-jobs, gradle rcm-jobs:bootRun
run.rally-api: # start.db
${gradlew} rally-api:assemble
${gradlew} rally-api:bootRun -Dgrails.env=server -Dspring.profiles.active=local,server --args='--server.port=8083'

run.rally-api2: # start.db
${gradlew} rally-api:bootRun --args='--server.port=8084 --spring.profiles.active=local,client -Dgrails.env=client'

run.rally-api3: # start.db
${gradlew} rally-api:bootRun --args='--server.port=8085 --spring.profiles.active=local,client'

# clones the api-docs branch or this project where we will publish/push
# oapi.docs-clone:
Expand Down
9 changes: 9 additions & 0 deletions examples/rally-api/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Rally API

App to prove out veious functionality

## Multiple Cluster Nodes

Simulate by running `make start.rally-api`, `make start.rally-api2` and `make start.rally-api3` im 3 different terminal sessions


18 changes: 17 additions & 1 deletion examples/rally-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ dependencies {
// implementation "com.github.jknack:handlebars-springmvc:$vHandlebars"
// implementation "com.github.jknack:handlebars-guava-cache:$vHandlebars"

//SHIRO, not used yet
['aspectj', 'core', 'spring', 'web'].each {
implementation "org.apache.shiro:shiro-$it:$vShiro"
}

//APACHE IGNITE
implementation("org.apache.ignite:ignite-core:2.17.0")
//implementation("org.apache.ignite:ignite-kubernetes:2.17.0")
//implementation("org.apache.ignite:ignite-indexing:2.17.0")
implementation("org.apache.ignite:ignite-spring:2.17.0")
implementation("org.apache.ignite:ignite-spring-cache-ext:1.0.0")
implementation("org.apache.ignite:ignite-slf4j:2.17.0")
//implementation("org.apache.ignite:ignite-spring-boot-autoconfigure-ext:1.0.0")

// === Spring Sec ===
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
Expand Down Expand Up @@ -61,7 +75,7 @@ dependencies {
implementation "com.hazelcast:hazelcast-spring:$vHazelcast"
implementation "com.github.ben-manes.caffeine:caffeine:$vCaffeine"

runtimeOnly "com.h2database:h2:$vH2"
implementation "com.h2database:h2:$vH2"
runtimeOnly "javax.xml.bind:jaxb-api:2.3.1"
runtimeOnly "com.zaxxer:HikariCP:$vHikari"

Expand Down Expand Up @@ -98,6 +112,8 @@ bootRun {
//set the sys properties so BuildSupport statics can see them. Should not really be used or needed in prod
systemProperty "project.rootProjectDir", rootProject.projectDir.absolutePath
systemProperty "project.projectDir", project.projectDir.absolutePath
//fixes the hazelcast when running offline
systemProperty "java.net.preferIPv4Stack", true
}

bootJar.enabled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import yakworks.api.problem.data.DataProblem
import yakworks.rally.orgs.model.Org
import yakworks.rest.gorm.controller.CrudApiController

import static org.springframework.http.HttpStatus.CREATED
import static org.springframework.http.HttpStatus.OK

@SuppressWarnings(['ThrowRuntimeException'])
@CompileStatic
class ExceptionTestController implements CrudApiController<Org> {
static String namespace = 'rally'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ package yakworks.rally.api.rally

import groovy.transform.CompileStatic

import yakworks.api.problem.data.DataProblem
import yakworks.rally.orgs.model.Org
import yakworks.rest.gorm.controller.CrudApiController

import static org.springframework.http.HttpStatus.CREATED
import static org.springframework.http.HttpStatus.OK

@CompileStatic
class OrgController implements CrudApiController<Org> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,26 @@
*/
package yakworks.rally.api

import yakworks.rally.orgs.model.Contact
import yakworks.rally.seed.RallySeed
import yakworks.security.gorm.model.AppUser

class BootStrap {

def init = { servletContext ->
RallySeed.fullMonty()
addOktaUser()
def contacts
AppUser.withTransaction {
contacts = Contact.list()
}
println "************************ contacts size : $contacts.size()"
if(!contacts) {
RallySeed.fullMonty()
addOktaUser()
}
AppUser.withTransaction {
contacts = Contact.list()
}
println "************************ after contacts size : $contacts.size()"
}

//add the [email protected] so saml works
Expand Down
4 changes: 4 additions & 0 deletions examples/rally-api/httpyac/hazel.http
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
### cluster state
GET {{base_url}}/health/cluster-state

### check ize
GET {{base_url}}/health/cluster-size

### node state
GET {{base_url}}/health/node-state

### maps
GET {{base_url}}/rest/cluster

### maps
GET {{base_url}}/rest/maps/
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package yakworks

import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.HttpStatus
import org.springframework.web.bind.support.DefaultDataBinderFactory

import grails.gorm.transactions.Rollback
import grails.testing.mixin.integration.Integration
Expand All @@ -12,6 +14,8 @@ import yakworks.rest.client.OkHttpRestTrait
@Rollback
class SmokeRestApiSpec extends Specification implements OkHttpRestTrait {

//@Autowired DefaultDataBinderFactory defaultDataBinderFactory

String path = "/api/rally"

void setup(){
Expand Down Expand Up @@ -43,6 +47,7 @@ class SmokeRestApiSpec extends Specification implements OkHttpRestTrait {

void "get smoke test model"() {
when:
//assert defaultDataBinderFactory
Response resp = get("$path/smoke/model?foo=buzz&bar=baz")

then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BulkControllerSpec extends RestIntTest implements SecuritySpecHelper {
request.method = "POST"
//sourceId is built from these so pop to test
request.requestURI = '/api/rally/org/bulk'
request.queryString = 'jobSource=Oracle'
request.queryString = 'jobSource=Oracle&async=false'

controller.params.jobSource = "Oracle"
controller.bulkCreate()
Expand Down Expand Up @@ -76,7 +76,7 @@ class BulkControllerSpec extends RestIntTest implements SecuritySpecHelper {

then:
job.id
job.data != null
job.dataToString()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,36 @@ class BulkCsvSpec extends RestIntTest implements SecuritySpecHelper {
if(body.id) SyncJob.repo.removeById(body.id as Long) //syncjob is created in new transaction
}
}

void "test bad CSV"() {

when: "create attachment"
def csvFile = BuildSupport.rootProjectPath.resolve("examples/resources/csv/contact-bad.csv")
Attachment attachment
Attachment.withNewTransaction {
attachment = Attachment.create([name: csvFile.fileName.toString(), sourcePath: csvFile])
}
TrxUtils.flush()
controller.params.attachmentId = attachment.id
controller.params['async'] = false //disable promise for test
controller.params['saveDataAsFile'] = true //write to file

controller.bulkCreate()
Map body = response.bodyToMap()

then:
response.status == 400

body.ok == false
body.code == 'error.data.csv'
body.title == "CSV Data Problem"
body.detail.contains "Error on record number 2"

cleanup: "cleanup db"
//attachmentRepo.removeById(attachment.id)
Attachment.withNewTransaction {
if(attachment) attachment.remove()
//if(body.id) SyncJob.repo.removeById(body.id as Long) //syncjob is created in new transaction
}
}
}
Loading