Skip to content

Commit

Permalink
Findbugs / PMD / Junit Updates
Browse files Browse the repository at this point in the history
Updated code based on findbug and pmd results.
Updated junit 3 style to junit 4 style tests
Within waffle code, any methods returning boolean with getter now use
is*
  • Loading branch information
hazendaz committed Aug 19, 2012
1 parent 7f187aa commit f2fdaf3
Show file tree
Hide file tree
Showing 127 changed files with 986 additions and 610 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Next Release
Misc
----

* Waffle boolean getters now use proper is* java standard - [@hazendaz](https://github.com/hazendaz).
* getContinue now isContinue
* getDebug now isDebug
* getAllowGuestLogin now isAllowGuestLogin
* getImpersonate now isImpersonate
* RevertToSelf case fix now as revertToSelf - [@hazendaz](https://github.com/hazendaz).
* All array getters now return empty arrays rather than null - [@hazendaz](https://github.com/hazendaz).
* Waffle now requires Java 1.6 or newer, uses generics where possible - [@hazendaz](https://github.com/hazendaz).
* Using JNA 3.4.2 (currently private build) - [@dblock](https://github.com/dblock).
* Refactored `waffle-jna.jar` into several distinct packages - [@dblock](https://github.com/dblock).
Expand All @@ -28,7 +35,7 @@ Misc
* spring 2.5.6.SEC03
* spring-security 2.0.7
* spring-security 3.1.1
* junit 4.10
* junit 4.10 - All tests now use junit 4 style rather than junit 3 style
* emma 2.1.5320
* Documentation has been rewritten in Markdown, R.I.P. CHM - [@dblock](https://github.com/dblock).
* [#3](https://github.com/dblock/waffle/pull/3): Converted commons-logging to slf4j logging - [@hazendaz](https://github.com/hazendaz).
Expand Down
32 changes: 18 additions & 14 deletions Source/JNA/build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
<sequential>
<delete dir="${waffle.lib}" />
<mkdir dir="${waffle.lib}" />
<javac
source="${waffle.java.version}"
target="${waffle.java.version}"
srcdir="${waffle.src}"
destdir="${waffle.lib}"
optimize="@{optimize}"
debug="@{debug}"
includeantruntime="false">
<javac
source="${waffle.java.version}"
target="${waffle.java.version}"
srcdir="${waffle.src}"
destdir="${waffle.lib}"
optimize="@{optimize}"
debug="@{debug}"
includeantruntime="false">
<classpath refid="thirdparty.classpath" />
<classpath refid="project.classpath" />
<include name="**/*.java" />
Expand Down Expand Up @@ -83,8 +83,14 @@
</path>
<target name="compile-tests">
<mkdir dir="${waffle.test.lib}" />
<javac target="${waffle.java.version}" srcdir="${waffle.test.src}"
destdir="${waffle.test.lib}" optimize="no" debug="yes" includeantruntime="false">
<javac
source="${waffle.java.version}"
target="${waffle.java.version}"
srcdir="${waffle.test.src}"
destdir="${waffle.test.lib}"
optimize="no"
debug="yes"
includeantruntime="false">
<classpath refid="waffle.test.classpath" />
<include name="**/*.java" />
</javac>
Expand All @@ -100,7 +106,7 @@
<target name="test" depends="compile-tests">
<mkdir dir="${waffle.test}" />
<junit fork="true" newenvironment="true" failureproperty="tests.failed"
haltonfailure="no" haltonerror="no" printsummary="on" errorproperty="tests.failed">
haltonfailure="no" haltonerror="no" printsummary="on" errorproperty="tests.failed">
<batchtest todir="${waffle.test}">
<fileset dir="${waffle.test.lib}">
<include name="**/*Tests.class" />
Expand Down Expand Up @@ -132,7 +138,7 @@
</path>
<emma>
<instr instrpathref="build.classpath" destdir="${waffle.cover}/lib"
metadatafile="${waffle.cover}/metadata.emma" merge="true" />
metadatafile="${waffle.cover}/metadata.emma" merge="true" />
</emma>
<copy todir="${waffle.lib}">
<fileset dir="${waffle.cover}/lib" includes="**/*" />
Expand All @@ -154,14 +160,12 @@
<antcall target="test" />
<antcall target="cover-report" />
</target>

<target name="getgitdetails" >
<exec executable="git" outputproperty="git.revision">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
</target>

<!-- package -->
<target name="jar" depends="getgitdetails">
<delete dir="${waffle.build}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ public interface IWindowsAccount {
*
* @return String in the S- format.
*/
public String getSidString();
String getSidString();

/**
* Fully qualified username.
*
* @return String.
*/
public String getFqn();
String getFqn();

/**
* User name.
*
* @return String.
*/
public String getName();
String getName();

/**
* Domain name.
*
* @return String.
*/
public String getDomain();
String getDomain();
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface IWindowsAuthProvider {
* A string that specifies the plaintext password for the user account specified by username.
* @return Windows identity.
*/
public IWindowsIdentity logonUser(String username, String password);
IWindowsIdentity logonUser(String username, String password);

/**
* The LogonDomainUser function attempts to log a user on to the local computer using a network logon type and the
Expand All @@ -47,7 +47,7 @@ public interface IWindowsAuthProvider {
* A string that specifies the plaintext password for the user account specified by username.
* @return Windows identity.
*/
public IWindowsIdentity logonDomainUser(String username, String domain,
IWindowsIdentity logonDomainUser(String username, String domain,
String password);

/**
Expand All @@ -70,7 +70,7 @@ public IWindowsIdentity logonDomainUser(String username, String domain,
* Specifies the logon provider.
* @return Windows identity.
*/
public IWindowsIdentity logonDomainUserEx(String username, String domain,
IWindowsIdentity logonDomainUserEx(String username, String domain,
String password, int logonType, int logonProvider);

/**
Expand All @@ -81,21 +81,21 @@ public IWindowsIdentity logonDomainUserEx(String username, String domain,
* Fully qualified or partial username.
* @return Windows account.
*/
public IWindowsAccount lookupAccount(String username);
IWindowsAccount lookupAccount(String username);

/**
* Retrieve the current computer information.
*
* @return Current computer information.
*/
public IWindowsComputer getCurrentComputer();
IWindowsComputer getCurrentComputer();

/**
* Retrieve a list of domains (Active Directory) on the local server.
*
* @return A list of domains.
*/
public IWindowsDomain[] getDomains();
IWindowsDomain[] getDomains();

/**
* Attempts to validate the user using an SSPI token. This token is generated by the client via the
Expand All @@ -112,7 +112,7 @@ public IWindowsIdentity logonDomainUserEx(String username, String domain,
* package to use. Other common values are "Kerberos" and "NTLM".
* @return Windows account.
*/
public IWindowsSecurityContext acceptSecurityToken(String connectionId,
IWindowsSecurityContext acceptSecurityToken(String connectionId,
byte[] token, String securityPackage);

/**
Expand All @@ -121,5 +121,5 @@ public IWindowsSecurityContext acceptSecurityToken(String connectionId,
* @param connectionId
* Connection id.
*/
public void resetSecurityToken(String connectionId);
void resetSecurityToken(String connectionId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ public interface IWindowsComputer {
*
* @return String.
*/
public String getComputerName();
String getComputerName();

/**
* Member of (domain).
*
* @return String.
*/
public String getMemberOf();
String getMemberOf();

/**
* Join status.
*
* @return String.
*/
public String getJoinStatus();
String getJoinStatus();

/**
* Groups.
*
* @return Array of group names.
*/
public String[] getGroups();
String[] getGroups();
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ public interface IWindowsDomain {
*
* @return String.
*/
public String getFqn();
String getFqn();

/**
* Trust direction.
*
* @return String.
*/
public String getTrustDirectionString();
String getTrustDirectionString();

/**
* Trust type.
*
* @return String.
*/
public String getTrustTypeString();
String getTrustTypeString();
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,45 @@ public interface IWindowsIdentity {
*
* @return String.
*/
public String getSidString();
String getSidString();

/**
* Sid.
*
* @return Array of bytes.
*/
public byte[] getSid();
byte[] getSid();

/**
* Fully qualified name.
*
* @return String.
*/
public String getFqn();
String getFqn();

/**
* Group memberships.
*
* @return Array of accounts.
*/
public IWindowsAccount[] getGroups();
IWindowsAccount[] getGroups();

/**
* Impersonate a logged on user.
*
* @return An impersonation context.
*/
public IWindowsImpersonationContext impersonate();
IWindowsImpersonationContext impersonate();

/**
* Dispose of the Windows identity.
*/
public void dispose();
void dispose();

/**
* Returns true if the identity represents a Guest account.
*
* @return True if the identity represents a Guest account, false otherwise.
*/
public boolean isGuest();
boolean isGuest();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ public interface IWindowsImpersonationContext {
/**
* Terminate the impersonation of a client application.
*/
void RevertToSelf();
void revertToSelf();
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,42 @@ public interface IWindowsSecurityContext {
*
* @return String.
*/
public String getSecurityPackage();
String getSecurityPackage();

/**
* Principal name.
*
* @return String.
*/
public String getPrincipalName();
String getPrincipalName();

/**
* Token.
*
* @return Array of bytes.
*/
public byte[] getToken();
byte[] getToken();

/**
* True if protocol requires continuation.
*
* @return True or false.
*/
public boolean getContinue();
boolean isContinue();

/**
* Windows Identity.
*
* @return Windows Identity.
*/
public IWindowsIdentity getIdentity();
IWindowsIdentity getIdentity();

/**
* Context handle.
*
* @return Handle.
*/
public Sspi.CtxtHandle getHandle();
Sspi.CtxtHandle getHandle();

/**
* Initialize the security context, continuing from a previous one.
Expand All @@ -76,18 +76,18 @@ public interface IWindowsSecurityContext {
* @param targetName
* The target of the context. The string contents are security-package specific.
*/
public void initialize(CtxtHandle continueCtx, SecBufferDesc continueToken,
void initialize(CtxtHandle continueCtx, SecBufferDesc continueToken,
String targetName);

/**
* Impersonate this security context.
*
* @return A Windows Impersonation Context.
*/
public IWindowsImpersonationContext impersonate();
IWindowsImpersonationContext impersonate();

/**
* Disposes of the context.
*/
public void dispose();
void dispose();
}
Loading

0 comments on commit f2fdaf3

Please sign in to comment.