Merge branch '1.4.5-SNAPSHOT' into 1.5.2-SNAPSHOT

Conflicts:
        
test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropUser.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/4b7a011c
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/4b7a011c
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/4b7a011c

Branch: refs/heads/master
Commit: 4b7a011ca59cd0f731192169d3999c630e14c0e1
Parents: d22bf18 bbd6aeb
Author: Bill Havanki <bhava...@cloudera.com>
Authored: Thu Mar 20 15:01:37 2014 -0400
Committer: Bill Havanki <bhava...@cloudera.com>
Committed: Thu Mar 20 15:01:37 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/accumulo/test/randomwalk/security/DropUser.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/4b7a011c/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropUser.java
----------------------------------------------------------------------
diff --cc 
test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropUser.java
index ddf39aa,0000000..d48a2cd
mode 100644,000000..100644
--- 
a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropUser.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropUser.java
@@@ -1,66 -1,0 +1,67 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.accumulo.test.randomwalk.security;
 +
 +import java.util.Properties;
 +
 +import org.apache.accumulo.core.client.AccumuloException;
 +import org.apache.accumulo.core.client.AccumuloSecurityException;
 +import org.apache.accumulo.core.client.Connector;
 +import org.apache.accumulo.test.randomwalk.State;
 +import org.apache.accumulo.test.randomwalk.Test;
 +
 +public class DropUser extends Test {
 +  
 +  @Override
 +  public void visit(State state, Properties props) throws Exception {
 +    Connector conn = 
state.getInstance().getConnector(WalkingSecurity.get(state).getSysUserName(), 
WalkingSecurity.get(state).getSysToken());
 +    
 +    String tableUserName = WalkingSecurity.get(state).getTabUserName();
 +    
 +    boolean exists = WalkingSecurity.get(state).userExists(tableUserName);
 +    boolean hasPermission = 
WalkingSecurity.get(state).canDropUser(WalkingSecurity.get(state).getSysCredentials(),
 tableUserName);
 +    
 +    try {
 +      conn.securityOperations().dropLocalUser(tableUserName);
 +    } catch (AccumuloSecurityException ae) {
 +      switch (ae.getSecurityErrorCode()) {
 +        case PERMISSION_DENIED:
 +          if (hasPermission)
 +            throw new AccumuloException("Got a security exception when I 
should have had permission.", ae);
 +          else {
 +            if (exists) {
 +              
state.getConnector().securityOperations().dropLocalUser(tableUserName);
 +              WalkingSecurity.get(state).dropUser(tableUserName);
 +            }
 +            return;
 +          }
 +          
 +        case USER_DOESNT_EXIST:
 +          if (exists)
 +            throw new AccumuloException("Got user DNE exception when user 
should exists.", ae);
 +          else
 +            return;
 +        default:
 +          throw new AccumuloException("Got unexpected exception", ae);
 +      }
 +    }
 +    WalkingSecurity.get(state).dropUser(tableUserName);
++    Thread.sleep(1000);
 +    if (!hasPermission)
 +      throw new AccumuloException("Didn't get Security Exception when we 
should have");
 +  }
 +}

Reply via email to