/// <summary>Attempts to start a NameNode with the given operation.</summary> /// <remarks> /// Attempts to start a NameNode with the given operation. Starting /// the NameNode should throw an exception. /// </remarks> /// <param name="operation">- NameNode startup operation</param> /// <param name="exceptionClass"> /// - if non-null, will check that the caught exception /// is assignment-compatible with exceptionClass /// </param> /// <param name="messagePattern"> /// - if non-null, will check that a substring of the /// message from the caught exception matches this pattern, via the /// <see cref="Matcher#find()"/> /// method. /// </param> internal virtual void StartNameNodeShouldFail(HdfsServerConstants.StartupOption operation , Type exceptionClass, Sharpen.Pattern messagePattern) { try { cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(0).StartupOption(operation ).Format(false).ManageDataDfsDirs(false).ManageNameDfsDirs(false).Build(); // should fail NUnit.Framework.Assert.Fail("NameNode should have failed to start"); } catch (Exception e) { // expect exception if (exceptionClass != null) { NUnit.Framework.Assert.IsTrue("Caught exception is not of expected class " + exceptionClass .Name + ": " + StringUtils.StringifyException(e), exceptionClass.IsInstanceOfType (e)); } if (messagePattern != null) { NUnit.Framework.Assert.IsTrue("Caught exception message string does not match expected pattern \"" + messagePattern.Pattern() + "\" : " + StringUtils.StringifyException(e), messagePattern .Matcher(e.Message).Find()); } Log.Info("Successfully detected expected NameNode startup failure."); } }
internal virtual void VerifyUsernamePattern(string user) { if (!UserGroupInformation.IsSecurityEnabled() && !nonsecureLocalUserPattern.Matcher (user).Matches()) { throw new ArgumentException("Invalid user name '" + user + "'," + " it must match '" + nonsecureLocalUserPattern.Pattern() + "'"); } }
public sealed override string GetDomain() { return(pattern == null ? "<String>" : pattern.Pattern()); }
protected internal override string GetDomain() { return((pattern == null) ? "a string" : pattern.Pattern()); }