Skip to content

Commit

Permalink
Memory report
Browse files Browse the repository at this point in the history
  • Loading branch information
avantgardnerio committed Oct 31, 2018
1 parent 5eb3ebe commit d66c04d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/test/kotlin/net/squarelabs/depends/ResolverTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,28 @@ package net.squarelabs.depends

import net.squarelabs.depends.models.Artifact
import org.junit.Test
import java.text.DecimalFormat

class ResolverTest {
@Test
fun `resolver should resolve`() {
val runtime = Runtime.getRuntime()
println("Used mem: ${DecimalFormat("#,##0").format(runtime.totalMemory() - runtime.freeMemory())}")
val state = State()
val root: Artifact = resolve("io.dropwizard:dropwizard-core:1.3.7", state)
val conflicts = state.artifactsByGa.keys
.filter { key -> state.artifactsByGa[key]!!.size > 1 }
.map { key -> key + ": " + state.artifactsByGa[key]!!.keys.joinToString() }
.joinToString("\n")
.joinToString(separator = "\n\t")
println("unique artifacts: ${state.artifactsByGa.size}")
println("conflicts: $conflicts")
println("conflicts:\n\t $conflicts")

// find removals
state.artifactsByGa.keys
.filter { key -> state.artifactsByGa[key]!!.size > 1 }

// print memory
Runtime.getRuntime().gc()
println("Used mem: ${DecimalFormat("#,##0").format(runtime.totalMemory() - runtime.freeMemory())}")
}
}

0 comments on commit d66c04d

Please sign in to comment.