AtomixFactory { public static Atomix fromConfiguration( final BrokerCfg configuration, final ReceivableSnapshotStoreFactory snapshotStoreFactory) { final var clusterCfg = configuration.getCluster(); final var nodeId = clusterCfg.getNodeId(); final var localMemberId = Integer.toString(nodeId); final var networkCfg = configuration.getNetwork(); final NodeDiscoveryProvider discoveryProvider = createDiscoveryProvider(clusterCfg, localMemberId); final MembershipCfg membershipCfg = clusterCfg.getMembership(); final GroupMembershipProtocol membershipProtocol = SwimMembershipProtocol.builder() .withFailureTimeout(membershipCfg.getFailureTimeout()) .withGossipInterval(membershipCfg.getGossipInterval()) .withProbeInterval(membershipCfg.getProbeInterval()) .withProbeTimeout(membershipCfg.getProbeTimeout()) .withBroadcastDisputes(membershipCfg.isBroadcastDisputes()) .withBroadcastUpdates(membershipCfg.isBroadcastUpdates()) .withGossipFanout(membershipCfg.getGossipFanout()) .withNotifySuspect(membershipCfg.isNotifySuspect()) .withSuspectProbes(membershipCfg.getSuspectProbes()) .withSyncInterval(membershipCfg.getSyncInterval()) .build(); final AtomixBuilder atomixBuilder = Atomix.builder(new AtomixConfig()) .withClusterId(clusterCfg.getClusterName()) .withMemberId(localMemberId) .withMembershipProtocol(membershipProtocol) .withAddress( Address.from( networkCfg.getInternalApi().getAdvertisedHost(), networkCfg.getInternalApi().getAdvertisedPort())) .withMembershipProvider(discoveryProvider); final DataCfg dataConfiguration = configuration.getData(); final String rootDirectory = dataConfiguration.getDirectories().get(0); IoUtil.ensureDirectoryExists(new File(rootDirectory), "Zeebe data directory"); final RaftPartitionGroup partitionGroup = createRaftPartitionGroup(configuration, rootDirectory, snapshotStoreFactory); return atomixBuilder.withPartitionGroups(partitionGroup).build(); } private  AtomixFactory(); static Atomix fromConfiguration(
      final BrokerCfg configuration, final ReceivableSnapshotStoreFactory snapshotStoreFactory); static final String GROUP_NAME; }
@Test public void shouldUseMappedStorageLevel() { final var brokerConfig = newConfig(); brokerConfig.getData().setUseMmap(true); final var atomix = AtomixFactory.fromConfiguration(brokerConfig, new FileBasedSnapshotStoreFactory()); final var config = getPartitionGroupConfig(atomix); assertThat(config.getStorageConfig().getLevel()).isEqualTo(StorageLevel.MAPPED); }
@Test public void shouldUseDiskStorageLevel() { final var brokerConfig = newConfig(); brokerConfig.getData().setUseMmap(false); final var atomix = AtomixFactory.fromConfiguration(brokerConfig, new FileBasedSnapshotStoreFactory()); final var config = getPartitionGroupConfig(atomix); assertThat(config.getStorageConfig().getLevel()).isEqualTo(StorageLevel.DISK); }