Example usage for java.util.concurrent.atomic AtomicBoolean get

List of usage examples for java.util.concurrent.atomic AtomicBoolean get

Introduction

In this page you can find the example usage for java.util.concurrent.atomic AtomicBoolean get.

Prototype

public final boolean get() 

Source Link

Document

Returns the current value, with memory effects as specified by VarHandle#getVolatile .

Usage

From source file:org.apache.hadoop.yarn.server.resourcemanager.security.TestDelegationTokenRenewer.java

@Test
public void testRMRestartWithExpiredToken() throws Exception {
    Configuration yarnConf = new YarnConfiguration();
    yarnConf.setBoolean(YarnConfiguration.RM_PROXY_USER_PRIVILEGES_ENABLED, true);
    yarnConf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "kerberos");
    yarnConf.setBoolean(YarnConfiguration.RECOVERY_ENABLED, true);
    FileSystem fs;/*w  w w  .  j  av a 2s.com*/
    Path tmpDir;
    fs = FileSystem.get(new Configuration());
    tmpDir = new Path(new File("target", this.getClass().getSimpleName() + "-tmpDir").getAbsolutePath());
    fs.delete(tmpDir, true);
    fs.mkdirs(tmpDir);
    try {
        conf.set(YarnConfiguration.FS_RM_STATE_STORE_URI, tmpDir.toString());
        conf.set(YarnConfiguration.RM_STORE, FileSystemRMStateStore.class.getName());
        UserGroupInformation.setConfiguration(yarnConf);

        // create Token1:
        Text userText1 = new Text("user1");
        DelegationTokenIdentifier dtId1 = new DelegationTokenIdentifier(userText1, new Text("renewer1"),
                userText1);
        final Token<DelegationTokenIdentifier> originalToken = new Token<>(dtId1.getBytes(),
                "password1".getBytes(), dtId1.getKind(), new Text("service1"));
        Credentials credentials = new Credentials();
        credentials.addToken(userText1, originalToken);

        MockRM rm1 = new TestSecurityMockRM(yarnConf);
        rm1.start();
        RMApp app = rm1.submitApp(200, "name", "user", new HashMap<ApplicationAccessType, String>(), false,
                "default", 1, credentials);

        // create token2
        Text userText2 = new Text("user1");
        DelegationTokenIdentifier dtId2 = new DelegationTokenIdentifier(userText1, new Text("renewer2"),
                userText2);
        final Token<DelegationTokenIdentifier> updatedToken = new Token<DelegationTokenIdentifier>(
                dtId2.getBytes(), "password2".getBytes(), dtId2.getKind(), new Text("service2"));
        final AtomicBoolean firstRenewInvoked = new AtomicBoolean(false);
        final AtomicBoolean secondRenewInvoked = new AtomicBoolean(false);
        MockRM rm2 = new TestSecurityMockRM(yarnConf) {
            @Override
            protected DelegationTokenRenewer createDelegationTokenRenewer() {
                return new DelegationTokenRenewer() {

                    @Override
                    protected void renewToken(final DelegationTokenToRenew dttr) throws IOException {

                        if (dttr.token.equals(updatedToken)) {
                            secondRenewInvoked.set(true);
                            super.renewToken(dttr);
                        } else if (dttr.token.equals(originalToken)) {
                            firstRenewInvoked.set(true);
                            throw new InvalidToken("Failed to renew");
                        } else {
                            throw new IOException("Unexpected");
                        }
                    }

                    @Override
                    protected Token<?>[] obtainSystemTokensForUser(String user, final Credentials credentials)
                            throws IOException {
                        credentials.addToken(updatedToken.getService(), updatedToken);
                        return new Token<?>[] { updatedToken };
                    }
                };
            }
        };

        // simulating restart the rm
        rm2.start();

        // check nm can retrieve the token
        final MockNM nm1 = new MockNM("127.0.0.1:1234", 15120, rm2.getResourceTrackerService());
        nm1.registerNode();
        NodeHeartbeatResponse response = nm1.nodeHeartbeat(true);
        ByteBuffer tokenBuffer = response.getSystemCredentialsForApps().get(app.getApplicationId());
        Assert.assertNotNull(tokenBuffer);
        Credentials appCredentials = new Credentials();
        DataInputByteBuffer buf = new DataInputByteBuffer();
        tokenBuffer.rewind();
        buf.reset(tokenBuffer);
        appCredentials.readTokenStorageStream(buf);
        Assert.assertTrue(firstRenewInvoked.get() && secondRenewInvoked.get());
        Assert.assertTrue(appCredentials.getAllTokens().contains(updatedToken));
    } finally {
        fs.delete(tmpDir, true);
    }
}

From source file:org.apache.tinkerpop.gremlin.structure.IoTest.java

@Test
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldReadWriteVertexNoEdgesToGryo() throws Exception {
    final Vertex v1 = g.addVertex("name", "marko", "acl", "rw");
    final Vertex v2 = g.addVertex();
    v1.addEdge("friends", v2, "weight", 0.5d);

    try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
        final GryoWriter writer = g.io().gryoWriter().create();
        writer.writeVertex(os, v1);/*from   w  w  w  . ja  v a2 s .  c om*/

        final AtomicBoolean called = new AtomicBoolean(false);
        final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
        try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
            reader.readVertex(bais, detachedVertex -> {
                assertEquals(v1.id(), detachedVertex.id());
                assertEquals(v1.label(), detachedVertex.label());
                assertEquals(2, StreamFactory.stream(detachedVertex.iterators().propertyIterator()).count());
                assertEquals(v1.value("name"), detachedVertex.value("name").toString());
                assertEquals(v1.value("acl"), detachedVertex.value("acl").toString());
                called.set(true);
                return mock(Vertex.class);
            });
        }
        assertTrue(called.get());
    }
}

From source file:org.apache.tinkerpop.gremlin.structure.IoTest.java

@Test
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
public void shouldReadWriteVertexNoEdgesToGryoUsingFloatProperty() throws Exception {
    final Vertex v1 = g.addVertex("name", "marko", "acl", "rw");

    final Vertex v2 = g.addVertex();
    v1.addEdge("friends", v2, "weight", 0.5f);

    try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
        final GryoWriter writer = g.io().gryoWriter().create();
        writer.writeVertex(os, v1);//from  w w w  .  j  a v a  2 s .c o  m

        final AtomicBoolean called = new AtomicBoolean(false);
        final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
        try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
            reader.readVertex(bais, detachedVertex -> {
                assertEquals(v1.id(), detachedVertex.id());
                assertEquals(v1.label(), detachedVertex.label());
                assertEquals(2, StreamFactory.stream(detachedVertex.iterators().propertyIterator()).count());
                assertEquals(v1.value("name"), detachedVertex.value("name").toString());
                assertEquals(v1.value("acl"), detachedVertex.value("acl").toString());
                called.set(true);
                return mock(Vertex.class);
            });
        }
        assertTrue(called.get());
    }
}

From source file:org.apache.tinkerpop.gremlin.structure.IoTest.java

@Test
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldReadWriteVertexNoEdgesToGraphSON() throws Exception {
    final Vertex v1 = g.addVertex("name", "marko", "acl", "rw");
    final Vertex v2 = g.addVertex();
    v1.addEdge("friends", v2, "weight", 0.5f);

    try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
        final GraphSONWriter writer = g.io().graphSONWriter().create();
        writer.writeVertex(os, v1);/*from  ww w. j av  a  2s . c o  m*/

        final AtomicBoolean called = new AtomicBoolean(false);
        final GraphSONReader reader = g.io().graphSONReader().create();
        try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
            reader.readVertex(bais, detachedVertex -> {
                assertEquals(v1.id().toString(), detachedVertex.id().toString()); // lossy
                assertEquals(v1.label(), detachedVertex.label());
                assertEquals(2, StreamFactory.stream(detachedVertex.iterators().propertyIterator()).count());
                assertEquals("marko", detachedVertex.iterators().propertyIterator("name").next().value());
                assertEquals("rw", detachedVertex.iterators().propertyIterator("acl").next().value());
                called.set(true);
                return detachedVertex;
            });
        }

        assertTrue(called.get());
    }
}

From source file:org.apache.tinkerpop.gremlin.structure.IoTest.java

@Test
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldReadWriteDetachedVertexNoEdgesToGraphSON() throws Exception {
    final Vertex v1 = g.addVertex("name", "marko", "acl", "rw");
    final Vertex v2 = g.addVertex();
    v1.addEdge("friends", v2, "weight", 0.5f);

    try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
        final GraphSONWriter writer = g.io().graphSONWriter().create();
        final DetachedVertex dv = DetachedFactory.detach(v1, true);
        writer.writeVertex(os, dv);/*  w  w w . j  a  v  a2 s .  c  om*/

        final AtomicBoolean called = new AtomicBoolean(false);
        final GraphSONReader reader = g.io().graphSONReader().create();
        try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
            reader.readVertex(bais, detachedVertex -> {
                assertEquals(v1.id().toString(), detachedVertex.id().toString()); // lossy
                assertEquals(v1.label(), detachedVertex.label());
                assertEquals(2, StreamFactory.stream(detachedVertex.iterators().propertyIterator()).count());
                assertEquals("marko", detachedVertex.iterators().propertyIterator("name").next().value());
                assertEquals("rw", detachedVertex.iterators().propertyIterator("acl").next().value());
                called.set(true);
                return detachedVertex;
            });
        }

        assertTrue(called.get());
    }
}

From source file:org.apache.tinkerpop.gremlin.structure.IoTest.java

@Test
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
@FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
public void shouldReadWriteDetachedVertexNoEdgesToGryo() throws Exception {
    final Vertex v1 = g.addVertex("name", "marko", "acl", "rw");
    final Vertex v2 = g.addVertex();
    v1.addEdge("friends", v2, "weight", 0.5d);

    try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
        final GryoWriter writer = g.io().gryoWriter().create();
        final DetachedVertex dv = DetachedFactory.detach(v1, true);
        writer.writeVertex(os, dv);/*w  w w  .jav  a  2  s.c o  m*/

        final AtomicBoolean called = new AtomicBoolean(false);
        final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
        try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
            reader.readVertex(bais, detachedVertex -> {
                assertEquals(v1.id(), detachedVertex.id());
                assertEquals(v1.label(), detachedVertex.label());
                assertEquals(2, StreamFactory.stream(detachedVertex.iterators().propertyIterator()).count());
                assertEquals("marko", detachedVertex.iterators().propertyIterator("name").next().value());
                assertEquals("rw", detachedVertex.iterators().propertyIterator("acl").next().value());
                called.set(true);
                return mock(Vertex.class);
            });
        }
        assertTrue(called.get());
    }
}

From source file:org.apache.hadoop.mapreduce.v2.app.rm.TestRMContainerAllocator.java

@Test
public void testHeartbeatHandler() throws Exception {
    LOG.info("Running testHeartbeatHandler");

    Configuration conf = new Configuration();
    conf.setInt(MRJobConfig.MR_AM_TO_RM_HEARTBEAT_INTERVAL_MS, 1);
    ControlledClock clock = new ControlledClock(new SystemClock());
    AppContext appContext = mock(AppContext.class);
    when(appContext.getClock()).thenReturn(clock);
    when(appContext.getApplicationID()).thenReturn(ApplicationId.newInstance(1, 1));

    RMContainerAllocator allocator = new RMContainerAllocator(mock(ClientService.class), appContext) {
        @Override//from  w w w.  j a  v  a  2  s .  c o m
        protected void register() {
        }

        @Override
        protected ApplicationMasterProtocol createSchedulerProxy() {
            return mock(ApplicationMasterProtocol.class);
        }

        @Override
        protected synchronized void heartbeat() throws Exception {
        }
    };
    allocator.init(conf);
    allocator.start();

    clock.setTime(5);
    int timeToWaitMs = 5000;
    while (allocator.getLastHeartbeatTime() != 5 && timeToWaitMs > 0) {
        Thread.sleep(10);
        timeToWaitMs -= 10;
    }
    Assert.assertEquals(5, allocator.getLastHeartbeatTime());
    clock.setTime(7);
    timeToWaitMs = 5000;
    while (allocator.getLastHeartbeatTime() != 7 && timeToWaitMs > 0) {
        Thread.sleep(10);
        timeToWaitMs -= 10;
    }
    Assert.assertEquals(7, allocator.getLastHeartbeatTime());

    final AtomicBoolean callbackCalled = new AtomicBoolean(false);
    allocator.runOnNextHeartbeat(new Runnable() {
        @Override
        public void run() {
            callbackCalled.set(true);
        }
    });
    clock.setTime(8);
    timeToWaitMs = 5000;
    while (allocator.getLastHeartbeatTime() != 8 && timeToWaitMs > 0) {
        Thread.sleep(10);
        timeToWaitMs -= 10;
    }
    Assert.assertEquals(8, allocator.getLastHeartbeatTime());
    Assert.assertTrue(callbackCalled.get());
}

From source file:org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl.java

/**
 * Create ledger async and schedule a timeout task to check ledger-creation is complete else it fails the callback
 * with TimeoutException./*from w ww .  ja  v  a2 s.  c om*/
 * 
 * @param bookKeeper
 * @param config
 * @param digestType
 * @param cb
 * @param metadata
 */
protected void asyncCreateLedger(BookKeeper bookKeeper, ManagedLedgerConfig config, DigestType digestType,
        CreateCallback cb, Map<String, byte[]> metadata) {
    AtomicBoolean ledgerCreated = new AtomicBoolean(false);
    Map<String, byte[]> finalMetadata = new HashMap<>();
    finalMetadata.putAll(ledgerMetadata);
    finalMetadata.putAll(metadata);
    if (log.isDebugEnabled()) {
        log.debug("creating ledger, metadata: " + finalMetadata);
    }
    bookKeeper.asyncCreateLedger(config.getEnsembleSize(), config.getWriteQuorumSize(),
            config.getAckQuorumSize(), digestType, config.getPassword(), cb, ledgerCreated, finalMetadata);
    scheduledExecutor.schedule(() -> {
        if (!ledgerCreated.get()) {
            ledgerCreated.set(true);
            cb.createComplete(BKException.Code.TimeoutException, null, null);
        }
    }, config.getMetadataOperationsTimeoutSeconds(), TimeUnit.SECONDS);
}

From source file:com.facebook.AccessTokenManager.java

private void refreshCurrentAccessTokenImpl(final AccessToken.AccessTokenRefreshCallback callback) {
    final AccessToken accessToken = currentAccessToken;
    if (accessToken == null) {
        if (callback != null) {
            callback.OnTokenRefreshFailed(new FacebookException("No current access token to refresh"));
        }//w ww  .j  a va2  s.c  o  m
        return;
    }
    if (!tokenRefreshInProgress.compareAndSet(false, true)) {
        if (callback != null) {
            callback.OnTokenRefreshFailed(new FacebookException("Refresh already in progress"));
        }
        return;
    }

    lastAttemptedTokenExtendDate = new Date();

    final Set<String> permissions = new HashSet<>();
    final Set<String> declinedPermissions = new HashSet<>();
    final AtomicBoolean permissionsCallSucceeded = new AtomicBoolean(false);
    final RefreshResult refreshResult = new RefreshResult();

    GraphRequestBatch batch = new GraphRequestBatch(
            createGrantedPermissionsRequest(accessToken, new GraphRequest.Callback() {
                @Override
                public void onCompleted(GraphResponse response) {
                    JSONObject result = response.getJSONObject();
                    if (result == null) {
                        return;
                    }
                    JSONArray permissionsArray = result.optJSONArray("data");
                    if (permissionsArray == null) {
                        return;
                    }
                    permissionsCallSucceeded.set(true);
                    for (int i = 0; i < permissionsArray.length(); i++) {
                        JSONObject permissionEntry = permissionsArray.optJSONObject(i);
                        if (permissionEntry == null) {
                            continue;
                        }
                        String permission = permissionEntry.optString("permission");
                        String status = permissionEntry.optString("status");
                        if (!Utility.isNullOrEmpty(permission) && !Utility.isNullOrEmpty(status)) {
                            status = status.toLowerCase(Locale.US);
                            if (status.equals("granted")) {
                                permissions.add(permission);
                            } else if (status.equals("declined")) {
                                declinedPermissions.add(permission);
                            } else {
                                Log.w(TAG, "Unexpected status: " + status);
                            }
                        }
                    }
                }
            }), createExtendAccessTokenRequest(accessToken, new GraphRequest.Callback() {
                @Override
                public void onCompleted(GraphResponse response) {
                    JSONObject data = response.getJSONObject();
                    if (data == null) {
                        return;
                    }
                    refreshResult.accessToken = data.optString("access_token");
                    refreshResult.expiresAt = data.optInt("expires_at");
                }
            }));

    batch.addCallback(new GraphRequestBatch.Callback() {
        @Override
        public void onBatchCompleted(GraphRequestBatch batch) {
            AccessToken newAccessToken = null;
            try {
                if (getInstance().getCurrentAccessToken() == null
                        || getInstance().getCurrentAccessToken().getUserId() != accessToken.getUserId()) {
                    if (callback != null) {
                        callback.OnTokenRefreshFailed(
                                new FacebookException("No current access token to refresh"));
                    }
                    return;
                }
                if (permissionsCallSucceeded.get() == false && refreshResult.accessToken == null
                        && refreshResult.expiresAt == 0) {
                    if (callback != null) {
                        callback.OnTokenRefreshFailed(new FacebookException("Failed to refresh access token"));
                    }
                    return;
                }
                newAccessToken = new AccessToken(
                        refreshResult.accessToken != null ? refreshResult.accessToken : accessToken.getToken(),
                        accessToken.getApplicationId(), accessToken.getUserId(),
                        permissionsCallSucceeded.get() ? permissions : accessToken.getPermissions(),
                        permissionsCallSucceeded.get() ? declinedPermissions
                                : accessToken.getDeclinedPermissions(),
                        accessToken.getSource(),
                        refreshResult.expiresAt != 0 ? new Date(refreshResult.expiresAt * 1000l)
                                : accessToken.getExpires(),
                        new Date());
                getInstance().setCurrentAccessToken(newAccessToken);
            } finally {
                tokenRefreshInProgress.set(false);
                if (callback != null && newAccessToken != null) {
                    callback.OnTokenRefreshed(newAccessToken);
                }
            }
        }
    });
    batch.executeAsync();
}

From source file:com.atlassian.jira.bc.group.TestDefaultGroupService.java

@Test
public void testDeleteHappyPath() {
    final Mock mockProjectRoleService = new Mock(ProjectRoleService.class);
    mockProjectRoleService.setStrict(true);
    mockProjectRoleService.expectVoid("removeAllRoleActorsByNameAndType", P.ANY_ARGS);

    final Mock mockPermissionManager = new Mock(PermissionManager.class);
    mockPermissionManager.setStrict(true);
    mockPermissionManager.expectAndReturn("hasPermission", P.args(P.eq(Permissions.ADMINISTER), P.IS_ANYTHING),
            Boolean.TRUE);/*from w  w w  .j ava  2  s . c  o m*/
    mockPermissionManager.expectVoid("removeGroupPermissions", P.args(P.eq("TestGroup")));

    final Mock mockNotificationManager = new Mock(NotificationSchemeManager.class);
    mockNotificationManager.setStrict(true);
    mockNotificationManager.expectAndReturn("removeEntities",
            P.args(P.eq(GroupDropdown.DESC), P.eq("TestGroup")), Boolean.TRUE);

    final Mock mockSubscriptionManager = new Mock(SubscriptionManager.class);
    mockSubscriptionManager.setStrict(true);
    mockSubscriptionManager.expectVoid("deleteSubscriptionsForGroup", P.ANY_ARGS);

    final AtomicBoolean calledSharePermissionDeleteUtils = new AtomicBoolean(false);
    final SharePermissionDeleteUtils deleteUtils = new SharePermissionDeleteUtils(null) {
        @Override
        public void deleteGroupPermissions(final String groupName) {
            calledSharePermissionDeleteUtils.set(true);
        }
    };

    final AtomicBoolean updateCommentAndGroupsCalled = new AtomicBoolean(false);
    final AtomicBoolean removeGroupCalled = new AtomicBoolean(false);
    final AtomicBoolean clearCalled = new AtomicBoolean(false);

    final DefaultGroupService defaultGroupService = new DefaultGroupService(null, null, null, null,
            (NotificationSchemeManager) mockNotificationManager.proxy(),
            (PermissionManager) mockPermissionManager.proxy(),
            (ProjectRoleService) mockProjectRoleService.proxy(), null, null, deleteUtils,
            (SubscriptionManager) mockSubscriptionManager.proxy(), null, null, null) {
        @Override
        void updateCommentsAndWorklogs(final User user, final String groupName, final String swapGroup) {
            updateCommentAndGroupsCalled.set(true);
        }

        @Override
        Group getGroup(final String groupName) {
            return null;
        }

        @Override
        void removeGroup(final Group group) throws PermissionException {
            removeGroupCalled.set(true);
        }

        @Override
        void clearIssueSecurityLevelCache() {
            clearCalled.set(true);
        }
    };

    final ErrorCollection errorCollection = new SimpleErrorCollection();
    final JiraServiceContext jiraServiceContext = getContext(errorCollection);

    assertTrue(defaultGroupService.delete(jiraServiceContext, "TestGroup", "SwapGroup"));

    assertTrue(updateCommentAndGroupsCalled.get());
    assertTrue(clearCalled.get());
    assertTrue(removeGroupCalled.get());
    assertTrue(calledSharePermissionDeleteUtils.get());
    mockPermissionManager.verify();
    mockProjectRoleService.verify();
    mockNotificationManager.verify();
    mockSubscriptionManager.verify();
}