Commit 32499faf authored by Nils Christian Ehmke's avatar Nils Christian Ehmke

Tests for the monitoring import and minor bug fixes

parent 8792e211
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
...@@ -24,6 +25,16 @@ ...@@ -24,6 +25,16 @@
<groupId>org.jfxtras</groupId> <groupId>org.jfxtras</groupId>
<artifactId>jfxtras-controls</artifactId> <artifactId>jfxtras-controls</artifactId>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -293,7 +293,7 @@ final class MonitoringLogImporter { ...@@ -293,7 +293,7 @@ final class MonitoringLogImporter {
// Make sure that the timestamp is always in milliseconds // Make sure that the timestamp is always in milliseconds
if ( DESTINATION_TIMESTAMP_TIME_UNIT != ivSourceTimeUnit ) { if ( DESTINATION_TIMESTAMP_TIME_UNIT != ivSourceTimeUnit ) {
final long newTimestamp = DESTINATION_TIMESTAMP_TIME_UNIT.convert( timestamp, ivSourceTimeUnit ); final long newTimestamp = DESTINATION_TIMESTAMP_TIME_UNIT.convert( lastMethodCall.getTimestamp( ), ivSourceTimeUnit );
lastMethodCall.setTimestamp( newTimestamp ); lastMethodCall.setTimestamp( newTimestamp );
} }
...@@ -354,18 +354,18 @@ final class MonitoringLogImporter { ...@@ -354,18 +354,18 @@ final class MonitoringLogImporter {
try { try {
final Class<?> recordClass = Class.forName( recordName ); final Class<?> recordClass = Class.forName( recordName );
final Field sizeField = recordClass.getDeclaredField( "SIZE" ); final Field sizeField = recordClass.getDeclaredField( "SIZE" );
size = (byte) sizeField.get( null ); size = (byte) (int) sizeField.get( null );
ivIgnoredRecordsSizeMap.put( aRecordKey, size ); ivIgnoredRecordsSizeMap.put( aRecordKey, size );
ivIgnoredRecords++;
} catch ( final Exception ex ) { } catch ( final Exception ex ) {
// We have no chance. We cannot skip the record, as we don't know its size. // We have no chance. We cannot skip the record, as we don't know its size.
throw new RuntimeException( String.format( ivResourceBundle.getString( "errorMessageUnknownRecord" ), recordName ) ); throw new RuntimeException( String.format( ivResourceBundle.getString( "errorMessageUnknownRecord" ), recordName ), ex );
} }
} else { } else {
size = ivIgnoredRecordsSizeMap.get( aRecordKey ); size = ivIgnoredRecordsSizeMap.get( aRecordKey );
} }
ivIgnoredRecords++;
skipBytes( size, aByteBuffer ); skipBytes( size, aByteBuffer );
} }
...@@ -496,33 +496,44 @@ final class MonitoringLogImporter { ...@@ -496,33 +496,44 @@ final class MonitoringLogImporter {
@Override @Override
public boolean equals( final Object obj ) { public boolean equals( final Object obj ) {
if ( this == obj ) if ( this == obj ) {
return true; return true;
if ( obj == null ) }
if ( obj == null ) {
return false; return false;
if ( getClass( ) != obj.getClass( ) ) }
if ( getClass( ) != obj.getClass( ) ) {
return false; return false;
}
final AggregationKey other = (AggregationKey) obj; final AggregationKey other = (AggregationKey) obj;
if ( ivClass == null ) { if ( ivClass == null ) {
if ( other.ivClass != null ) if ( other.ivClass != null ) {
return false; return false;
} else if ( !ivClass.equals( other.ivClass ) ) }
} else if ( !ivClass.equals( other.ivClass ) ) {
return false; return false;
}
if ( ivException == null ) { if ( ivException == null ) {
if ( other.ivException != null ) if ( other.ivException != null ) {
return false; return false;
} else if ( !ivException.equals( other.ivException ) ) }
} else if ( !ivException.equals( other.ivException ) ) {
return false; return false;
}
if ( ivHost == null ) { if ( ivHost == null ) {
if ( other.ivHost != null ) if ( other.ivHost != null ) {
return false; return false;
} else if ( !ivHost.equals( other.ivHost ) ) }
} else if ( !ivHost.equals( other.ivHost ) ) {
return false; return false;
}
if ( ivMethod == null ) { if ( ivMethod == null ) {
if ( other.ivMethod != null ) if ( other.ivMethod != null ) {
return false; return false;
} else if ( !ivMethod.equals( other.ivMethod ) ) }
} else if ( !ivMethod.equals( other.ivMethod ) ) {
return false; return false;
}
return true; return true;
} }
......
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId> <artifactId>hamcrest-all</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId> <artifactId>hamcrest-all</artifactId>
<version>1.3</version> <version>1.3</version>
</dependency> </dependency>
<dependency> <dependency>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment