Search in sources :

Example 1 with IdIdString

use of com.yahoo.document.idstring.IdIdString in project vespa by vespa-engine.

the class IdIdStringTest method requireThatIdIdStringCanBehaveLikeGroupDoc.

@Test
public void requireThatIdIdStringCanBehaveLikeGroupDoc() throws Exception {
    DocumentId docId1 = new DocumentId(new IdIdString("namespace", "type", "g=foo", "foo"));
    DocumentId docId2 = new DocumentId(new IdIdString("namespace", "type", "g=foo", "bar"));
    DocumentId docId3 = new DocumentId(new IdIdString("namespace", "type", "g=bar", "baz"));
    assertEquals(docId1.getScheme().getLocation(), docId2.getScheme().getLocation());
    assert (docId1.getScheme().getLocation() != docId3.getScheme().getLocation());
}
Also used : IdIdString(com.yahoo.document.idstring.IdIdString) Test(org.junit.Test)

Example 2 with IdIdString

use of com.yahoo.document.idstring.IdIdString in project vespa by vespa-engine.

the class IdIdStringTest method requireThatIdIdStringGeneratesProperString.

@Test
public void requireThatIdIdStringGeneratesProperString() throws Exception {
    DocumentId docId = new DocumentId(new IdIdString("namespace", "type", "g=group", "foobar"));
    assertEquals("id:namespace:type:g=group:foobar", docId.toString());
}
Also used : IdIdString(com.yahoo.document.idstring.IdIdString) Test(org.junit.Test)

Example 3 with IdIdString

use of com.yahoo.document.idstring.IdIdString in project vespa by vespa-engine.

the class IdIdStringTest method requireThatEmptyKeyValuesAreOk.

@Test
public void requireThatEmptyKeyValuesAreOk() throws Exception {
    DocumentId docId = new DocumentId(new IdIdString("namespace", "type", "", "foobar"));
    assertEquals("id:namespace:type::foobar", docId.toString());
}
Also used : IdIdString(com.yahoo.document.idstring.IdIdString) Test(org.junit.Test)

Example 4 with IdIdString

use of com.yahoo.document.idstring.IdIdString in project vespa by vespa-engine.

the class IdIdStringTest method requireThatIdIdStringCanBehaveLikeUserDoc.

@Test
public void requireThatIdIdStringCanBehaveLikeUserDoc() throws Exception {
    DocumentId docId1 = new DocumentId(new IdIdString("namespace", "type", "n=10", "foo"));
    DocumentId docId2 = new DocumentId(new IdIdString("namespace", "type", "n=10", "bar"));
    DocumentId docId3 = new DocumentId(new IdIdString("namespace", "type", "n=20", "baz"));
    assertEquals(docId1.getScheme().getLocation(), docId2.getScheme().getLocation());
    assert (docId1.getScheme().getLocation() != docId3.getScheme().getLocation());
}
Also used : IdIdString(com.yahoo.document.idstring.IdIdString) Test(org.junit.Test)

Aggregations

IdIdString (com.yahoo.document.idstring.IdIdString)4 Test (org.junit.Test)4