A java library providing fingerprinting and service interaction for the Victims Project.
Current version is 1.3.2
.
Download: pgp.mit.edu
Fingerprint:
47DB 2877 89B2 1722 B6D9 5DDE 5326 8101 3701 7186
- Snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/redhat/victims/victims-lib/
- Releases: http://central.maven.org/maven2/com/redhat/victims/victims-lib/
Update your pom.xml dependencies.
<dependency>
<groupId>com.redhat.victims</groupId>
<artifactId>victims-lib</artifactId>
<version>1.3.2</version>
</dependency>
Update your build.gradle dependencies.
dependencies {
compile group: 'com.redhat.victims', name: 'victims-lib', version: '1.3.2'
}
There are multiple configurations that can be set via system properties. When using them programatically use the keys provided by VictimsConfig.Key and methods provided by VictimsConfig. These can be set by end-users by using the -D option as:
-D$PROPERTY=$VALUE
Option | Default Value | Description |
---|---|---|
victims.service.uri | http://www.victi.ms/ |
This sets the base URI for accessing the victims web-service. |
victims.service.entry | service/ |
The entry point for the REST-API for the web-service. |
victims.encoding | UTF-8 |
Default file encoding when serializing byte streams. |
victims.home | $USER_HOME/.victims |
The OS specific home location for storing cache and database. |
victims.cache.purge | false |
Set to true to force purging of the results cache. |
victims.algorithms | MD5,SHA1,SHA512 |
The algorithms to get fingerprints for. |
victims.db.driver | VictimsDB.defaultDriver() |
The database driver class to load. This has to be available in the class path. The default implementation uses org.h2.Driver. |
victims.db.url | VictimsDB.defaultURL(DB_DRIVER) |
The database url to use when connecting to the database. Eg: jdbc:h2:~/.victims/victims;MVCC=true. |
victims.db.user | victims |
The username to use when connecting to a database. |
victims.db.pass | victims |
The password to use when connection to a database. |
victims.db.purge | ``false``` | Set this to force all records in the database to be updated. This is achieved be removing all records and fetching all updates from the server. |
- java 1.6
- maven3
Once you have cloned the repository, you can genereate the victims-lib artifactions using any of the following commands.
mvn clean package
By default the artifacts are not signed. If you require gpg signed artifacts,
mvn clean package -Drelease=true gpg:sign -Dgpg.keyname=EEE72232
To execute all tests:
mvn test
To run only offlinetests:
mvn test -Dtest=OfflineTests
You might want to use a dummy sservice to test your implementation. This is available using the package com.redhat.victims.mock. This is avaiable in the test jar. You can use this by adding the following dependency.
<dependency>
<groupId>com.redhat.victims</groupId>
<artifactId>victims-lib</artifactId>
<type>test-jar</type>
<version>1.3</version>
<scope>test</scope>
</dependency>
To write a test case using this, you will need to provide 2 files containing the expected json responses. If null is used, the mock server will respond with "[]". You can use this in a junit test case as shown below.
@BeforeClass
public static void setUp() throws IOException, VictimsException {
File updateResponse = new File(TEST_RESPONSE);
MockEnvironment.setUp(updateResponse, null);
}
@AfterClass
public static void tearDown() {
MockEnvironment.tearDown();
}
Beyond starting a mock service and cleaning up the cache after you, this will set the following properties for you:
- victims.service.uri="http://localhost:1337/"
- victims.db.force="true"
- victims.cache="victims.test.cache"
This is an abridged version of the guide available at https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
mvn clean deploy
mvn clean deploy
mvn release:clean
mvn release:prepare
mvn release:perform
- Login at https://oss.sonatype.org/
- Go to staging repositories
- Select the staging repository
- Click on the Close button
- Once closed, click on the Release button.