Skip to content

Commit

Permalink
fix some optional warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfurmanski committed Oct 26, 2016
1 parent 7d4d29d commit f410eeb
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -23,6 +23,8 @@
import org.junit.ClassRule;
import org.junit.Test;

import java.util.Optional;

import org.neo4j.causalclustering.core.CoreGraphDatabase;
import org.neo4j.causalclustering.discovery.Cluster;
import org.neo4j.causalclustering.discovery.CoreClusterMember;
Expand Down Expand Up @@ -65,8 +67,9 @@ public void coreProceduresShouldBeAvailable() throws Throwable

for ( String procedure : coreProcs )
{
CoreClusterMember coreClusterMember = cluster.coreMembers().stream().findFirst().get();
CoreGraphDatabase database = coreClusterMember.database();
Optional<CoreClusterMember> firstCore = cluster.coreMembers().stream().findFirst();
assert firstCore.isPresent();
CoreGraphDatabase database = firstCore.get().database();
InternalTransaction tx =
database.beginTransaction( KernelTransaction.Type.explicit, AUTH_DISABLED );
Result coreResult = database.execute( "CALL " + procedure + "()" );
Expand All @@ -90,9 +93,9 @@ public void readReplicaProceduresShouldBeAvailable() throws Exception
// when
for ( String procedure : readReplicaProcs )
{
ReadReplica readReplica = cluster.readReplicas().stream().findFirst().get();

ReadReplicaGraphDatabase database = readReplica.database();
Optional<ReadReplica> firstReadReplica = cluster.readReplicas().stream().findFirst();
assert firstReadReplica.isPresent();
ReadReplicaGraphDatabase database = firstReadReplica.get().database();
InternalTransaction tx =
database.beginTransaction( KernelTransaction.Type.explicit, AUTH_DISABLED );
Result readReplicaResult = database.execute( "CALL " + procedure + "()" );
Expand Down

0 comments on commit f410eeb

Please sign in to comment.