Skip to content

Commit

Permalink
Merge pull request #1030 from atlanhq/FT-784
Browse files Browse the repository at this point in the history
Correct typo that caused CategoryCache to be loaded incorrectly
  • Loading branch information
cmgrote authored Nov 20, 2024
2 parents f646f7e + 2d079d9 commit ee2ba0c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 13 deletions.
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
dependencies {
implementation("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:2.0.21")
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
implementation("io.freefair.gradle:lombok-plugin:8.10.2")
implementation("io.freefair.gradle:lombok-plugin:8.11")
implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.0.1")
implementation("com.adarshr:gradle-test-logger-plugin:4.0.0")
implementation("org.pkl-lang:org.pkl-lang.gradle.plugin:0.27.0")
Expand Down
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ log4j = "2.24.1"
wiremock = "3.9.2"
jnanoid = "2.0.0"
numaflow = "0.9.0"
awssdk = "2.29.15"
awssdk = "2.29.17"
gcs = "26.50.0"
system-stubs = "2.1.7"
fastcsv = "3.4.0"
poi = "5.3.0"
parsson = "1.1.7"
simplejavamail = "8.12.2"
swagger = "2.1.23"
swagger = "2.1.24"
jsonpath = "2.9.0"
commons-compress = "1.27.1"
commons-io = "2.17.0"
commons-io = "2.18.0"
sqlite = "3.47.0.0"
jakarta-mail = "2.1.3"
angus-mail = "2.0.3"
pkl = "0.27.0"
adls = "12.22.0"
azure = "1.14.1"
azure = "1.14.2"
guava = "33.3.1-jre"
openlineage = "1.24.2"
protobuf = "4.28.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ package com.atlan.pkg.aim

import AssetImportCfg
import com.atlan.model.assets.Glossary
import com.atlan.model.assets.GlossaryTerm
import com.atlan.pkg.PackageTest
import com.atlan.pkg.cache.CategoryCache
import mu.KotlinLogging
import java.nio.file.Paths
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue

/**
Expand Down Expand Up @@ -76,6 +80,31 @@ class SameNameCategoriesTest : PackageTest("snc") {
assertTrue(listOf("root", "c1", "c2", "same", "same") == ordered || listOf("root", "c2", "c1", "same", "same") == ordered)
}

@Test
fun termsCreated() {
val g = Glossary.findByName(glossaryName)!!
val t1 = GlossaryTerm.findByNameFast("t1", g.qualifiedName, listOf(GlossaryTerm.CATEGORIES))
assertNotNull(t1)
assertNotNull(t1.categories)
assertEquals(1, t1.categories.size)
val c1Guid = t1.categories.first().guid
val t2 = GlossaryTerm.findByNameFast("t2", g.qualifiedName, listOf(GlossaryTerm.CATEGORIES))
assertNotNull(t2)
assertNotNull(t2.categories)
assertEquals(1, t2.categories.size)
val c2Guid = t2.categories.first().guid
assertNotEquals(c1Guid, c2Guid)
}

@Test
fun categoriesProperlyCached() {
CategoryCache.refresh() // Note: refresh to ensure that loading the cache from scratch it still resolves properly
val cat1 = CategoryCache.getByIdentity("root@c1@same@@@$glossaryName")
assertNotNull(cat1)
val cat2 = CategoryCache.getByIdentity("root@c2@same@@@$glossaryName")
assertNotNull(cat2)
}

@Test
fun filesCreated() {
validateFilesExist(files)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name,anchor,typeName,parentCategory
{GLOSSARY},,AtlasGlossary,
root,{GLOSSARY},AtlasGlossaryCategory,
c1,{GLOSSARY},AtlasGlossaryCategory,root@@@{GLOSSARY}
c2,{GLOSSARY},AtlasGlossaryCategory,root@@@{GLOSSARY}
same,{GLOSSARY},AtlasGlossaryCategory,root@c1@@@{GLOSSARY}
same,{GLOSSARY},AtlasGlossaryCategory,root@c2@@@{GLOSSARY}
name,anchor,typeName,parentCategory,categories
{GLOSSARY},,AtlasGlossary,,
root,{GLOSSARY},AtlasGlossaryCategory,,
c1,{GLOSSARY},AtlasGlossaryCategory,root@@@{GLOSSARY},
c2,{GLOSSARY},AtlasGlossaryCategory,root@@@{GLOSSARY},
same,{GLOSSARY},AtlasGlossaryCategory,root@c1@@@{GLOSSARY},
same,{GLOSSARY},AtlasGlossaryCategory,root@c2@@@{GLOSSARY},
t1,{GLOSSARY},AtlasGlossaryTerm,,root@c1@same@@@{GLOSSARY}
t2,{GLOSSARY},AtlasGlossaryTerm,,root@c2@same@@@{GLOSSARY}
2 changes: 1 addition & 1 deletion sdk/src/main/java/com/atlan/cache/AbstractMassCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ protected String getNameFromId(String id, boolean bypassReadLock) {
}

private String getNameFromIdWithoutLock(String id) {
return mapNameToId.get(id);
return mapIdToName.get(id);
}

private String getNameFromIdWithLock(String id) {
Expand Down

0 comments on commit ee2ba0c

Please sign in to comment.