GithubHelp home page GithubHelp logo

jasinner / victims-lib-java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from victims/victims-lib-java

0.0 3.0 0.0 949 KB

The victims library containing the hashing logic for java specific artifacts.

License: GNU Affero General Public License v3.0

FreeMarker 0.03% Java 99.97%

victims-lib-java's Introduction

victims-lib-java Build Status

A java library providing fingerprinting and service interaction for the Victims Project.

Current version is 1.3.2.

GPG Keys

Download: pgp.mit.edu

Fingerprint:

47DB 2877 89B2 1722 B6D9 5DDE 5326 8101 3701 7186

Artifacts

Using in your project

Maven

Update your pom.xml dependencies.

<dependency>
  <groupId>com.redhat.victims</groupId>
  <artifactId>victims-lib</artifactId>
  <version>1.3.2</version>
</dependency>

Gradle

Update your build.gradle dependencies.

dependencies {
    compile group: 'com.redhat.victims', name: 'victims-lib', version: '1.3.2'
}

Configuration Options

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.

Building from source

Requrements

  • java 1.6
  • maven3

Generating artifacts

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

Running Tests

To execute all tests:

mvn test

To run only offlinetests:

mvn test -Dtest=OfflineTests

Using Service Mocking

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:

Releases

This is an abridged version of the guide available at https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide

SNAPSHOT Release

mvn clean deploy

Staging

mvn clean deploy
mvn release:clean
mvn release:prepare
mvn release:perform

Promoting to central

  1. Login at https://oss.sonatype.org/
  2. Go to staging repositories
  3. Select the staging repository
  4. Click on the Close button
  5. Once closed, click on the Release button.

victims-lib-java's People

Contributors

abn avatar gcmurphy avatar skavanagh avatar fweimer-rh avatar seanf avatar

Watchers

James Cloos avatar Jason Shepherd avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.