Search in sources :

Example 1 with SchemaData

use of org.apache.pulsar.common.schema.SchemaData in project incubator-pulsar by apache.

the class SchemaServiceTest method getReturnsTheLastWrittenEntry.

@Test
public void getReturnsTheLastWrittenEntry() throws Exception {
    putSchema(schemaId1, schema1, version(0));
    putSchema(schemaId1, schema2, version(1));
    SchemaData latest = getLatestSchema(schemaId1, version(1));
    assertEquals(schema2, latest);
}
Also used : SchemaData(org.apache.pulsar.common.schema.SchemaData) Test(org.testng.annotations.Test) MockedPulsarServiceBaseTest(org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)

Example 2 with SchemaData

use of org.apache.pulsar.common.schema.SchemaData in project incubator-pulsar by apache.

the class SchemaServiceTest method addLotsOfEntriesThenDelete.

@Test
public void addLotsOfEntriesThenDelete() throws Exception {
    SchemaData randomSchema1 = randomSchema();
    SchemaData randomSchema2 = randomSchema();
    SchemaData randomSchema3 = randomSchema();
    SchemaData randomSchema4 = randomSchema();
    SchemaData randomSchema5 = randomSchema();
    SchemaData randomSchema6 = randomSchema();
    SchemaData randomSchema7 = randomSchema();
    putSchema(schemaId1, randomSchema1, version(0));
    putSchema(schemaId1, randomSchema2, version(1));
    putSchema(schemaId1, randomSchema3, version(2));
    putSchema(schemaId1, randomSchema4, version(3));
    putSchema(schemaId1, randomSchema5, version(4));
    putSchema(schemaId1, randomSchema6, version(5));
    putSchema(schemaId1, randomSchema7, version(6));
    SchemaData version0 = getSchema(schemaId1, version(0));
    assertEquals(randomSchema1, version0);
    SchemaData version1 = getSchema(schemaId1, version(1));
    assertEquals(randomSchema2, version1);
    SchemaData version2 = getSchema(schemaId1, version(2));
    assertEquals(randomSchema3, version2);
    SchemaData version3 = getSchema(schemaId1, version(3));
    assertEquals(randomSchema4, version3);
    SchemaData version4 = getSchema(schemaId1, version(4));
    assertEquals(randomSchema5, version4);
    SchemaData version5 = getSchema(schemaId1, version(5));
    assertEquals(randomSchema6, version5);
    SchemaData version6 = getSchema(schemaId1, version(6));
    assertEquals(randomSchema7, version6);
    deleteSchema(schemaId1, version(7));
    SchemaData version7 = getSchema(schemaId1, version(7));
    assertTrue(version7.isDeleted());
}
Also used : SchemaData(org.apache.pulsar.common.schema.SchemaData) Test(org.testng.annotations.Test) MockedPulsarServiceBaseTest(org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)

Example 3 with SchemaData

use of org.apache.pulsar.common.schema.SchemaData in project incubator-pulsar by apache.

the class SchemaServiceTest method getByVersionReturnsTheCorrectEntry3.

@Test
public void getByVersionReturnsTheCorrectEntry3() throws Exception {
    putSchema(schemaId1, schema1, version(0));
    SchemaData version1 = getSchema(schemaId1, version(0));
    assertEquals(schema1, version1);
}
Also used : SchemaData(org.apache.pulsar.common.schema.SchemaData) Test(org.testng.annotations.Test) MockedPulsarServiceBaseTest(org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)

Example 4 with SchemaData

use of org.apache.pulsar.common.schema.SchemaData in project incubator-pulsar by apache.

the class SchemaServiceTest method writeReadBackDeleteSchemaEntry.

@Test
public void writeReadBackDeleteSchemaEntry() throws Exception {
    putSchema(schemaId1, schema1, version(0));
    SchemaData latest = getLatestSchema(schemaId1, version(0));
    assertEquals(schema1, latest);
    deleteSchema(schemaId1, version(1));
    SchemaData latest2 = getLatestSchema(schemaId1, version(1));
    assertTrue(latest2.isDeleted());
}
Also used : SchemaData(org.apache.pulsar.common.schema.SchemaData) Test(org.testng.annotations.Test) MockedPulsarServiceBaseTest(org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)

Example 5 with SchemaData

use of org.apache.pulsar.common.schema.SchemaData in project incubator-pulsar by apache.

the class SchemaServiceTest method getByVersionReturnsTheCorrectEntry.

@Test
public void getByVersionReturnsTheCorrectEntry() throws Exception {
    putSchema(schemaId1, schema1, version(0));
    putSchema(schemaId1, schema2, version(1));
    SchemaData version0 = getSchema(schemaId1, version(0));
    assertEquals(schema1, version0);
}
Also used : SchemaData(org.apache.pulsar.common.schema.SchemaData) Test(org.testng.annotations.Test) MockedPulsarServiceBaseTest(org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)

Aggregations

MockedPulsarServiceBaseTest (org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)7 SchemaData (org.apache.pulsar.common.schema.SchemaData)7 Test (org.testng.annotations.Test)7