Search in sources :

Example 1 with SimpleIndexMainType

use of org.sonar.server.es.IndexType.SimpleIndexMainType in project sonarqube by SonarSource.

the class IndexTypeTest method parseMainType_from_maintype_with_relations.

@Test
public void parseMainType_from_maintype_with_relations() {
    IndexMainType type1 = IndexType.main(Index.withRelations("foo"), "bar");
    assertThat(type1.format()).isEqualTo("foo/bar");
    SimpleIndexMainType type2 = IndexType.parseMainType(type1.format());
    assertThat(type2).extracting(SimpleIndexMainType::getIndex, SimpleIndexMainType::getType).containsExactly("foo", "bar");
}
Also used : IndexMainType(org.sonar.server.es.IndexType.IndexMainType) SimpleIndexMainType(org.sonar.server.es.IndexType.SimpleIndexMainType) SimpleIndexMainType(org.sonar.server.es.IndexType.SimpleIndexMainType) Test(org.junit.Test)

Example 2 with SimpleIndexMainType

use of org.sonar.server.es.IndexType.SimpleIndexMainType in project sonarqube by SonarSource.

the class IndexTypeTest method parseMainType_from_main_type_without_relations.

@Test
public void parseMainType_from_main_type_without_relations() {
    IndexMainType type1 = IndexType.main(Index.simple("foo"), "bar");
    assertThat(type1.format()).isEqualTo("foo/bar");
    SimpleIndexMainType type2 = IndexType.parseMainType(type1.format());
    assertThat(type2).extracting(SimpleIndexMainType::getIndex, SimpleIndexMainType::getType).containsExactly("foo", "bar");
}
Also used : IndexMainType(org.sonar.server.es.IndexType.IndexMainType) SimpleIndexMainType(org.sonar.server.es.IndexType.SimpleIndexMainType) SimpleIndexMainType(org.sonar.server.es.IndexType.SimpleIndexMainType) Test(org.junit.Test)

Example 3 with SimpleIndexMainType

use of org.sonar.server.es.IndexType.SimpleIndexMainType in project sonarqube by SonarSource.

the class IndexTypeTest method parseMainType_from_relationtype.

@Test
public void parseMainType_from_relationtype() {
    IndexMainType mainType = IndexType.main(Index.withRelations("foo"), "bar");
    IndexRelationType type1 = IndexType.relation(mainType, "donut");
    assertThat(type1.format()).isEqualTo("foo/bar/donut");
    SimpleIndexMainType type2 = IndexType.parseMainType(type1.format());
    assertThat(type2).extracting(SimpleIndexMainType::getIndex, SimpleIndexMainType::getType).containsExactly("foo", "bar");
}
Also used : IndexRelationType(org.sonar.server.es.IndexType.IndexRelationType) IndexMainType(org.sonar.server.es.IndexType.IndexMainType) SimpleIndexMainType(org.sonar.server.es.IndexType.SimpleIndexMainType) SimpleIndexMainType(org.sonar.server.es.IndexType.SimpleIndexMainType) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 IndexMainType (org.sonar.server.es.IndexType.IndexMainType)3 SimpleIndexMainType (org.sonar.server.es.IndexType.SimpleIndexMainType)3 IndexRelationType (org.sonar.server.es.IndexType.IndexRelationType)1