Skip to content

Commit 32fd628

Browse files
authored
Code clean up (#48)
1 parent 2e90859 commit 32fd628

32 files changed

+233
-219
lines changed

rwx-test/src/main/java/org/commonjava/rwx/test/jira/JiraServerInfo.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@
2020
*/
2121
public final class JiraServerInfo extends AbstractJiraServerInfo
2222
{
23-
private String version;
24-
private String baseUrl;
25-
private String buildDate;
26-
private int buildNumber;
23+
private final String version;
24+
25+
private final String baseUrl;
26+
27+
private final String buildDate;
28+
29+
private final int buildNumber;
30+
2731
private String edition;
32+
2833
private String serverTime;
2934

3035
public JiraServerInfo( String version, String baseUrl, String buildDate, int buildNumber )

rwx-test/src/main/java/org/commonjava/rwx/test/jira/JiraServerInfoConverter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ public class JiraServerInfoConverter implements Converter<AbstractJiraServerInfo
2929
@Override
3030
public AbstractJiraServerInfo parse( Object object )
3131
{
32-
Map<String, Object> map = (Map) object;
32+
Map<String, Object> map = (Map<String, Object>) object;
3333
String version = (String) map.get( "version" );
3434
String baseUrl = (String) map.get( "baseUrl" );
3535
String buildDate = (String) map.get( "buildDate" );
3636
String edition = (String) map.get( "edition" );
3737
String serverTime = (String) map.get( "serverTime" );
3838
int buildNumber = (Integer) map.get( "buildNumber" );
3939

40-
JiraServerInfo ret = new JiraServerInfo(version, baseUrl, buildDate, buildNumber);
41-
ret.setEdition(edition);
42-
ret.setServerTime(serverTime);
40+
JiraServerInfo ret = new JiraServerInfo( version, baseUrl, buildDate, buildNumber );
41+
ret.setEdition( edition );
42+
ret.setServerTime( serverTime );
4343
return ret;
4444
}
4545

rwx-test/src/main/java/org/commonjava/rwx/test/koji/GetBuildResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
@Response
2525
public class GetBuildResponse
2626
{
27-
@DataIndex(0)
27+
@DataIndex( 0 )
2828
private KojiBuildInfo buildInfo;
2929

3030
public KojiBuildInfo getBuildInfo()

rwx-test/src/main/java/org/commonjava/rwx/test/koji/KojiBuildInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public class KojiBuildInfo
100100

101101
public KojiBuildInfo() {}
102102

103-
public KojiBuildInfo(int id, int packageId, String name, String version, String release)
103+
public KojiBuildInfo( int id, int packageId, String name, String version, String release )
104104
{
105105
setId( id );
106106
setPackageId( packageId );

rwx-test/src/main/java/org/commonjava/rwx/test/koji/KojiTagInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class KojiTagInfo
5252

5353
public KojiTagInfo(){}
5454

55-
public KojiTagInfo( String name)
55+
public KojiTagInfo( String name )
5656
{
5757
this.name = name;
5858
}
@@ -84,7 +84,7 @@ public List<String> getArches()
8484

8585
public boolean isLocked()
8686
{
87-
return locked;
87+
return locked != null && locked;
8888
}
8989

9090
public boolean getMavenSupport()

rwx-test/src/main/java/org/commonjava/rwx/test/simple/SimpleResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void setValue( double value )
3434
this.value = value;
3535
}
3636

37-
@DataIndex(0)
37+
@DataIndex( 0 )
3838
private double value;
3939

4040
}

rwx-test/src/main/java/org/commonjava/rwx/test/subclass/Constants.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
*/
2121
public class Constants
2222
{
23+
private Constants()
24+
{
25+
throw new UnsupportedOperationException( "This is a utility class and cannot be instantiated" );
26+
}
27+
2328
public static final String NAME = "name";
2429

2530
public static final String VERSION = "version";

rwx-test/src/main/java/org/commonjava/rwx/test/subclass/GetBuildDescriptionResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
@Response
2525
public class GetBuildDescriptionResponse
2626
{
27-
@DataIndex(0)
27+
@DataIndex( 0 )
2828
private BuildDescription value;
2929

3030
public BuildDescription getValue()

rwx-test/src/test/java/org/commonjava/rwx/test/AbstractTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.commonjava.rwx.test.generated.Test_Registry;
2121
import org.junit.BeforeClass;
2222

23-
import javax.xml.stream.XMLStreamException;
2423
import java.io.BufferedReader;
2524
import java.io.IOException;
2625
import java.io.InputStream;
@@ -41,25 +40,25 @@ public static void register()
4140
Registry.setInstance( new Test_Registry() );
4241
}
4342

44-
protected InputStream getXMLStream( final String name ) throws IOException, XMLStreamException
43+
protected InputStream getXMLStream( final String name )
4544
{
4645
return Thread.currentThread().getContextClassLoader().getResourceAsStream( DOC_PATH + name + ".xml" );
4746
}
4847

49-
protected String getXMLString( final String name ) throws IOException, XMLStreamException
48+
protected String getXMLString( final String name ) throws IOException
5049
{
5150
return IOUtils.toString( new InputStreamReader( getXMLStream( name ) ));
5251
}
5352

5453
// Comparing XML string is a bad idea. But we need it in some cases, e.g., kojiListBuildsResponseNIL
5554

56-
protected String getXMLStringIgnoreFormat( final String name ) throws IOException, XMLStreamException
55+
protected String getXMLStringIgnoreFormat( final String name ) throws IOException
5756
{
5857
final BufferedReader reader = new BufferedReader( new InputStreamReader( getXMLStream( name ) ) );
5958
final StringWriter writer = new StringWriter();
6059
final PrintWriter pWriter = new PrintWriter( writer );
6160

62-
String line = null;
61+
String line;
6362
while ( ( line = reader.readLine() ) != null )
6463
{
6564
pWriter.print( line.trim() );

rwx-test/src/test/java/org/commonjava/rwx/test/jira/JiraServerInfoArrayConverterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.junit.Test;
2121

2222
import java.io.ByteArrayInputStream;
23-
import java.util.List;
2423

2524
import static junit.framework.TestCase.assertEquals;
2625

0 commit comments

Comments
 (0)