@Test void initializeTypesShouldNotFailIfCalledASecondTime() { new CassandraTypesCreator(MODULE, cassandra.getConf()).initializeTypes(); assertThat(cassandra.getTypesProvider().getDefinedUserType(TYPE_NAME_1)) .isNotNull(); assertThat(cassandra.getTypesProvider().getDefinedUserType(TYPE_NAME_2)) .isNotNull(); }
public InitializationStatus initializeTypes() { KeyspaceMetadata keyspaceMetadata = session.getCluster() .getMetadata() .getKeyspace(session.getLoggedKeyspace()); return types.stream() .map(type -> type.initialize(keyspaceMetadata, session)) .reduce((left, right) -> left.reduce(right)) .orElse(InitializationStatus.ALREADY_DONE); }
CassandraTypesCreator { public InitializationStatus initializeTypes() { KeyspaceMetadata keyspaceMetadata = session.getCluster() .getMetadata() .getKeyspace(session.getLoggedKeyspace()); return types.stream() .map(type -> type.initialize(keyspaceMetadata, session)) .reduce((left, right) -> left.reduce(right)) .orElse(InitializationStatus.ALREADY_DONE); } }
CassandraTypesCreator { public InitializationStatus initializeTypes() { KeyspaceMetadata keyspaceMetadata = session.getCluster() .getMetadata() .getKeyspace(session.getLoggedKeyspace()); return types.stream() .map(type -> type.initialize(keyspaceMetadata, session)) .reduce((left, right) -> left.reduce(right)) .orElse(InitializationStatus.ALREADY_DONE); } CassandraTypesCreator(CassandraModule module, Session session); }
CassandraTypesCreator { public InitializationStatus initializeTypes() { KeyspaceMetadata keyspaceMetadata = session.getCluster() .getMetadata() .getKeyspace(session.getLoggedKeyspace()); return types.stream() .map(type -> type.initialize(keyspaceMetadata, session)) .reduce((left, right) -> left.reduce(right)) .orElse(InitializationStatus.ALREADY_DONE); } CassandraTypesCreator(CassandraModule module, Session session); InitializationStatus initializeTypes(); }
CassandraTypesCreator { public InitializationStatus initializeTypes() { KeyspaceMetadata keyspaceMetadata = session.getCluster() .getMetadata() .getKeyspace(session.getLoggedKeyspace()); return types.stream() .map(type -> type.initialize(keyspaceMetadata, session)) .reduce((left, right) -> left.reduce(right)) .orElse(InitializationStatus.ALREADY_DONE); } CassandraTypesCreator(CassandraModule module, Session session); InitializationStatus initializeTypes();  }