Search in sources :

Example 1 with AtomixRegistry

use of io.atomix.core.AtomixRegistry in project atomix by atomix.

the class SimpleRegistryTest method testStaticRegistryBuilder.

@Test
public void testStaticRegistryBuilder() throws Exception {
    AtomixRegistry registry = SimpleRegistry.builder().addProfileType(ConsensusProfile.TYPE).addDiscoveryProviderType(BootstrapDiscoveryProvider.TYPE).addPrimitiveType(AtomicCounterType.instance()).addProtocolType(MultiRaftProtocol.TYPE).addPartitionGroupType(RaftPartitionGroup.TYPE).build();
    assertEquals(ConsensusProfile.TYPE, registry.getType(Profile.Type.class, "consensus"));
    assertEquals(BootstrapDiscoveryProvider.TYPE, registry.getType(NodeDiscoveryProvider.Type.class, "bootstrap"));
    assertEquals(AtomicCounterType.instance(), registry.getType(PrimitiveType.class, "atomic-counter"));
    assertEquals(MultiRaftProtocol.TYPE, registry.getType(PrimitiveProtocol.Type.class, "multi-raft"));
    assertEquals(RaftPartitionGroup.TYPE, registry.getType(PartitionGroup.Type.class, "raft"));
}
Also used : AtomixRegistry(io.atomix.core.AtomixRegistry) PrimitiveType(io.atomix.primitive.PrimitiveType) AtomicCounterType(io.atomix.core.counter.AtomicCounterType) PrimitiveType(io.atomix.primitive.PrimitiveType) Test(org.junit.Test)

Example 2 with AtomixRegistry

use of io.atomix.core.AtomixRegistry in project atomix by atomix.

the class DefaultRegistryTest method testRegistry.

@Test
public void testRegistry() throws Exception {
    AtomixRegistry registry = AtomixRegistry.registry();
    assertFalse(registry.getTypes(PrimitiveType.class).isEmpty());
    assertFalse(registry.getTypes(PrimitiveType.class).isEmpty());
    assertEquals("atomic-map", registry.getType(PrimitiveType.class, "atomic-map").name());
    assertFalse(registry.getTypes(PartitionGroup.Type.class).isEmpty());
    assertEquals("raft", registry.getType(PartitionGroup.Type.class, "raft").name());
    assertFalse(registry.getTypes(PrimitiveProtocol.Type.class).isEmpty());
    assertEquals("multi-raft", registry.getType(PrimitiveProtocol.Type.class, "multi-raft").name());
    assertEquals(3, registry.getTypes(Profile.Type.class).size());
    assertEquals("client", registry.getType(Profile.Type.class, "client").name());
}
Also used : PartitionGroup(io.atomix.primitive.partition.PartitionGroup) AtomixRegistry(io.atomix.core.AtomixRegistry) Profile(io.atomix.core.profile.Profile) PrimitiveProtocol(io.atomix.primitive.protocol.PrimitiveProtocol) Test(org.junit.Test)

Aggregations

AtomixRegistry (io.atomix.core.AtomixRegistry)2 Test (org.junit.Test)2 AtomicCounterType (io.atomix.core.counter.AtomicCounterType)1 Profile (io.atomix.core.profile.Profile)1 PrimitiveType (io.atomix.primitive.PrimitiveType)1 PartitionGroup (io.atomix.primitive.partition.PartitionGroup)1 PrimitiveProtocol (io.atomix.primitive.protocol.PrimitiveProtocol)1