Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
90 changes: 87 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,88 @@
.DS_Store
.vscode
##############################
## Java
##############################
.mtj.tmp/
*.class
*.jar
*.war
*.ear
*.nar
hs_err_pid*
replay_pid*

##############################
## Maven
##############################
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
pom.xml.bak
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar

##############################
## Gradle
##############################
bin/
build/
.gradle
.gradletasknamecache
gradle-app.setting
!gradle-wrapper.jar

##############################
## IntelliJ
##############################
out/
.idea/
.idea_modules/
*.iml
.idea
*.ipr
*.iws

##############################
## Eclipse
##############################
.settings/
tmp/
.metadata
.classpath
.project
*.tmp
*.bak
*.swp
*~.nib
local.properties
.loadpath
.factorypath

##############################
## NetBeans
##############################
nbproject/private/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

##############################
## Visual Studio Code
##############################
.vscode/
.code-workspace

##############################
## OS X
##############################
.DS_Store

##############################
## Miscellaneous
##############################
*.log
12 changes: 12 additions & 0 deletions backend/SOLUTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Build and Run
The solution can be built and started in two different ways:
1. Create a 'uber' jar with `gradle uberJar` and run with: `java -jar build/libs/dev-interview-materials-uber.jar`
2. Build with `gradle build` and run with `java -cp "./build/classes/java/main:./build/resources/main:./lib/*" com.quickbase.Main`
Notice that you should set the classpath correctly. Running the `copyDepJars` task will copy all required jars to the `lib` subdirectory.

### Output
The program prints out the aggregated data from both sources. When the log level is set to `DEBUG` it will inform you
when duplicated data is found, e.g. `Replacing country India from 1182105000 to 1210854977`.

## Tests
Several unit tests are added to cover the basic logic. Run them with `gradle test`.
58 changes: 55 additions & 3 deletions backend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,68 @@
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'

mainClassName = 'com.quickbase.Main'

compileJava {
sourceCompatibility = '11'
targetCompatibility = '11'
}

repositories {
mavenCentral()
}

dependencies {
compile 'org.xerial:sqlite-jdbc:3.8.11.1'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'
implementation 'org.xerial:sqlite-jdbc:3.45.2.0'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'

implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.10'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.23.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.23.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j2-impl', version: '2.23.1'

compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'

// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'

testImplementation 'org.mockito:mockito-core:5.11.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.11.0'
}

tasks.named('test', Test) {
useJUnitPlatform()

testLogging {
events "passed"
}
}

task copyDepJars(type: Copy) {
from configurations.runtimeClasspath
into 'lib'
}

jar {
manifest {
attributes 'Main-Class': 'com.quickbase.Main'
attributes 'Main-Class': "$mainClassName"
}
}

task uberJar(type: Jar) {
archiveClassifier = 'uber'

manifest {
attributes 'Main-Class': "$mainClassName"
}

from sourceSets.main.output

dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
}
2 changes: 0 additions & 2 deletions backend/build/classes/main/com/quickbase/.gitignore

This file was deleted.

Binary file removed backend/build/resources/main/citystatecountry.db
Binary file not shown.
Binary file modified backend/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions backend/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Sep 11 13:29:16 EDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-bin.zip
98 changes: 61 additions & 37 deletions backend/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading