Skip to content

Commit

Permalink
FABJ-401 Update dependencies
Browse files Browse the repository at this point in the history
Change-Id: I13237f83ec910fe0fb599a46bab8221cf25b7fdb
Signed-off-by: rickr <cr22rc@gmail.com>
  • Loading branch information
cr22rc committed Jan 22, 2019
1 parent a2140f9 commit 2080902
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 30 deletions.
40 changes: 23 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
<tag>fabric-sdk-java-1.0</tag>
</scm>
<properties>
<grpc.version>1.17.1</grpc.version><!-- CURRENT_GRPC_VERSION -->
<grpc.version>1.18.0</grpc.version><!-- CURRENT_GRPC_VERSION -->
<protobuf.version>3.6.1</protobuf.version>
<bouncycastle.version>1.60</bouncycastle.version>
<httpclient.version>4.5.6</httpclient.version>
<javadoc.version>3.0.1</javadoc.version>
<skipITs>true</skipITs>
<alpn-boot-version>8.1.7.v20160121</alpn-boot-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacoco.version>0.7.9</jacoco.version>
<jacoco.version>0.8.2</jacoco.version>
<log4j.version>1.2.17</log4j.version>
<org.hyperledger.fabric.sdktest.ITSuite>IntegrationSuite.java</org.hyperledger.fabric.sdktest.ITSuite>
<gpg.executable>gpg2</gpg.executable>
Expand Down Expand Up @@ -234,14 +235,14 @@
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.4.1.Final</version>
<version>1.6.1</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<version>3.0.0-M3</version>
<configuration>
<argLine>${surefireArgLine}</argLine>
<includes>
Expand All @@ -253,7 +254,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<version>3.0.0-M3</version>
<configuration>
<argLine>${failsafeArgLine}</argLine>
<includes>
Expand Down Expand Up @@ -303,7 +304,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand All @@ -312,7 +313,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>${javadoc.version}</version>
<configuration>
<excludePackageNames>
org.hyperledger.fabric_ca.sdk.helper:org.hyperledger.fabric.protos.*:org.hyperledger.fabric.sdk.helper:org.hyperledger.fabric.sdk.transaction:org.hyperledger.fabric.sdk.security:org.hyperledger.fabric.sdk.idemix
Expand All @@ -326,7 +327,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<version>3.0.0</version>
<executions>
<execution>
<goals>
Expand All @@ -339,7 +340,11 @@
<logViolationsToConsole>true</logViolationsToConsole>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
<!--<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>-->
<sourceDirectories>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
</sourceDirectories>

<configLocation>checkstyle-config.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
Expand Down Expand Up @@ -479,7 +484,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<version>1.8</version>
<executions>
<execution>
<phase>generate-test-resources</phase>
Expand All @@ -498,7 +503,7 @@
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.2</version>
<version>2.2.6</version>
<executions>
<execution>
<id>get-the-git-infos</id>
Expand Down Expand Up @@ -539,12 +544,13 @@
<profiles>
<profile>
<id>owasp</id>
<!-- RUN with mvn -P owasp verify -->
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>3.2.0</version>
<version>4.0.2</version>
<executions>
<execution>
<goals>
Expand All @@ -565,7 +571,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<version>1.6.8</version> <!-- was 1.6.7 -->
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand All @@ -575,7 +581,7 @@
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<version>3.1.1</version> <!-- was 2.3 -->
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
Expand All @@ -596,7 +602,7 @@
<configuration>
<useAgent>true</useAgent>
</configuration>
<version>1.5</version>
<version>1.6</version> <!-- was 1.5 -->
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -610,7 +616,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<version>3.0.1</version> <!-- was 2.2.1 -->
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -623,7 +629,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>${javadoc.version}</version>
<configuration>
<excludePackageNames>
org.hyperledger.fabric_ca.sdk.helper:org.hyperledger.fabric.protos.*:org.hyperledger.fabric.sdk.helper:org.hyperledger.fabric.sdk.transaction:org.hyperledger.fabric.sdk.security
Expand Down
34 changes: 21 additions & 13 deletions src/main/java/org/hyperledger/fabric/sdk/identity/IdemixRoles.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,73 +25,80 @@ int getValue() {

/**
* Receives an array of IdemixRoles and returns the bitmask combination of all
*
* @param roles that we want to combine
* @return bitmask
*/
static int getRoleMask(IdemixRoles[] roles) {
static int getRoleMask(IdemixRoles[] roles) {
int mask = 0;
for (IdemixRoles role: roles) {
for (IdemixRoles role : roles) {
mask = mask | role.value;
}
return mask;
}

/**
* Receives an array of MspPrincipal.MSPRole and returns the bitmask combination of all
*
* @param roles that we want to combine
* @return bitmask
*/
static int getRoleMask(MspPrincipal.MSPRole [] roles) {
static int getRoleMask(MspPrincipal.MSPRole[] roles) {
int mask = 0;
for (MspPrincipal.MSPRole role: roles) {
mask = mask | getIdemixRoleFromMSPRole(role);
for (MspPrincipal.MSPRole role : roles) {
mask = mask | getIdemixRoleFromMSPRole(role);
}
return mask;
}

/**
* Receives a MspPrincipal.MSPRole and returns the bitmask
*
* @param role that we want to combine
* @return bitmask
*/
static int getRoleMask(MspPrincipal.MSPRole role) {
return getRoleMask(new MspPrincipal.MSPRole[]{role});
static int getRoleMask(MspPrincipal.MSPRole role) {
return getRoleMask(new MspPrincipal.MSPRole[] {role});
}

/**
* Receives a bitmask and a roleMask to test. If the roleMask is contained in the bit mask returns true.
* @param bitmask where to test the roleMask
*
* @param bitmask where to test the roleMask
* @param searchRole roleMask to test
* @return true if roleMask contained
*/
static boolean checkRole(int bitmask, IdemixRoles searchRole) {
static boolean checkRole(int bitmask, IdemixRoles searchRole) {
return (bitmask & searchRole.value) == searchRole.value;
}

/**
* Receives a MSPRole and returns the correspondent IdemixRole value
*
* @param role to transform to int
* @return IdemixRole value
*/
static int getIdemixRoleFromMSPRole(MspPrincipal.MSPRole role) {
static int getIdemixRoleFromMSPRole(MspPrincipal.MSPRole role) {
return getIdemixRoleFromMSPRole(role.getRole());
}

/**
* Receives a MSPRole Type and returns the correspondent IdemixRole value
*
* @param type to transform to int
* @return IdemixRole value
*/
static int getIdemixRoleFromMSPRole(MspPrincipal.MSPRole.MSPRoleType type) {
static int getIdemixRoleFromMSPRole(MspPrincipal.MSPRole.MSPRoleType type) {
return getIdemixRoleFromMSPRole(type.getNumber());
}

/**
* Receives a MSPRole int value and returns the correspondent IdemixRole value
*
* @param type to transform to int
* @return IdemixRole value
*/
static int getIdemixRoleFromMSPRole(int type) {
static int getIdemixRoleFromMSPRole(int type) {
switch (type) {
case MspPrincipal.MSPRole.MSPRoleType.ADMIN_VALUE:
return ADMIN.getValue();
Expand All @@ -108,10 +115,11 @@ static int getIdemixRoleFromMSPRole(int type) {

/**
* Receives an integer that represents a roleMask and return the correspondent MSPRole value
*
* @param role to transform to MSProle
* @return MSPRole
*/
static MspPrincipal.MSPRole.MSPRoleType getMSPRoleFromIdemixRole(int role) {
static MspPrincipal.MSPRole.MSPRoleType getMSPRoleFromIdemixRole(int role) {
if (role == ADMIN.getValue()) {
return MspPrincipal.MSPRole.MSPRoleType.ADMIN;
}
Expand Down

0 comments on commit 2080902

Please sign in to comment.