### Question:
DistributedCyclicBarrierConfig extends PrimitiveConfig<DistributedCyclicBarrierConfig> { @Override public PrimitiveType getType() { return DistributedCyclicBarrierType.instance(); }  @Override PrimitiveType getType();  }### Answer:
@Test public void testConfig() throws Exception { DistributedCyclicBarrierConfig config = new DistributedCyclicBarrierConfig(); assertNull(config.getName()); assertEquals(DistributedCyclicBarrierType.instance(), config.getType()); assertNull(config.getNamespaceConfig()); assertNull(config.getProtocolConfig()); assertFalse(config.isReadOnly()); config.setName("foo"); config.setNamespaceConfig(new NamespaceConfig().setName("test").setCompatible(true).setRegistrationRequired(false)); config.setProtocolConfig(new MultiRaftProtocolConfig().setGroup("test-group")); config.setReadOnly(true); assertEquals("foo", config.getName()); assertEquals("test", config.getNamespaceConfig().getName()); assertEquals("test-group", ((MultiRaftProtocolConfig) config.getProtocolConfig()).getGroup()); assertTrue(config.isReadOnly()); }
@Test public void testLoadConfig() throws Exception { DistributedCyclicBarrierConfig config = Atomix.config(getClass().getClassLoader().getResource("primitives.conf").getPath()) .getPrimitive("cyclic-barrier"); assertEquals("cyclic-barrier", config.getName()); assertEquals(MultiPrimaryProtocol.TYPE, config.getProtocolConfig().getType()); assertFalse(config.isReadOnly()); }