@Test public void testConfigureClusterWhenConnectedClusterRequestIsNullThenOriginalClusterInstanceShouldReturn() { Cluster cluster = new Cluster(); cluster.setStack(publicStack); when(publicStack.getDatalakeResourceId()).thenReturn(null); Cluster result = underTest.configureCluster(cluster, user, workspace); Assert.assertEquals(cluster, result); verify(datalakeResourcesService, times(0)).findById(anyLong()); assertNull(cluster.getRdsConfigs()); }
public Cluster configureCluster(@Nonnull Cluster requestedCluster, User user, Workspace workspace) { Objects.requireNonNull(requestedCluster); Stack stack = requestedCluster.getStack(); if (stack.getDatalakeResourceId() != null) { Optional<DatalakeResources> datalakeResources = datalakeResourcesService.findById(stack.getDatalakeResourceId()); if (datalakeResources.isPresent()) { DatalakeResources datalakeResource = datalakeResources.get(); setupRds(requestedCluster, datalakeResource); setupStoragePath(requestedCluster, datalakeResource); } } return requestedCluster; }
SharedServiceConfigProvider { public Cluster configureCluster(@Nonnull Cluster requestedCluster, User user, Workspace workspace) { Objects.requireNonNull(requestedCluster); Stack stack = requestedCluster.getStack(); if (stack.getDatalakeResourceId() != null) { Optional<DatalakeResources> datalakeResources = datalakeResourcesService.findById(stack.getDatalakeResourceId()); if (datalakeResources.isPresent()) { DatalakeResources datalakeResource = datalakeResources.get(); setupRds(requestedCluster, datalakeResource); setupStoragePath(requestedCluster, datalakeResource); } } return requestedCluster; } }
SharedServiceConfigProvider { public Cluster configureCluster(@Nonnull Cluster requestedCluster, User user, Workspace workspace) { Objects.requireNonNull(requestedCluster); Stack stack = requestedCluster.getStack(); if (stack.getDatalakeResourceId() != null) { Optional<DatalakeResources> datalakeResources = datalakeResourcesService.findById(stack.getDatalakeResourceId()); if (datalakeResources.isPresent()) { DatalakeResources datalakeResource = datalakeResources.get(); setupRds(requestedCluster, datalakeResource); setupStoragePath(requestedCluster, datalakeResource); } } return requestedCluster; }  }
SharedServiceConfigProvider { public Cluster configureCluster(@Nonnull Cluster requestedCluster, User user, Workspace workspace) { Objects.requireNonNull(requestedCluster); Stack stack = requestedCluster.getStack(); if (stack.getDatalakeResourceId() != null) { Optional<DatalakeResources> datalakeResources = datalakeResourcesService.findById(stack.getDatalakeResourceId()); if (datalakeResources.isPresent()) { DatalakeResources datalakeResource = datalakeResources.get(); setupRds(requestedCluster, datalakeResource); setupStoragePath(requestedCluster, datalakeResource); } } return requestedCluster; }  Cluster configureCluster(@Nonnull Cluster requestedCluster, User user, Workspace workspace); @Measure(SharedServiceConfigProvider.class) Stack prepareDatalakeConfigs(Stack publicStack); }
SharedServiceConfigProvider { public Cluster configureCluster(@Nonnull Cluster requestedCluster, User user, Workspace workspace) { Objects.requireNonNull(requestedCluster); Stack stack = requestedCluster.getStack(); if (stack.getDatalakeResourceId() != null) { Optional<DatalakeResources> datalakeResources = datalakeResourcesService.findById(stack.getDatalakeResourceId()); if (datalakeResources.isPresent()) { DatalakeResources datalakeResource = datalakeResources.get(); setupRds(requestedCluster, datalakeResource); setupStoragePath(requestedCluster, datalakeResource); } } return requestedCluster; }  Cluster configureCluster(@Nonnull Cluster requestedCluster, User user, Workspace workspace); @Measure(SharedServiceConfigProvider.class) Stack prepareDatalakeConfigs(Stack publicStack);  }