Skip to content

Commit

Permalink
Improve some license params (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
Linary authored Apr 16, 2021
1 parent 185a926 commit f72fac4
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.baidu.hugegraph</groupId>
<artifactId>hugegraph-common</artifactId>
<version>1.8.6</version>
<version>1.8.7</version>

<name>hugegraph-common</name>
<url>https://github.com/hugegraph/hugegraph-common</url>
Expand Down Expand Up @@ -287,7 +287,7 @@
<manifestEntries>
<!-- Must be on one line, otherwise the automatic
upgrade script cannot replace the version number -->
<Implementation-Version>1.8.6.0</Implementation-Version>
<Implementation-Version>1.8.7.0</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import org.apache.commons.lang3.time.DateUtils;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;

Expand All @@ -35,9 +36,11 @@ public class LicenseCreateParam {
@JsonProperty("private_alias")
private String privateAlias;

@JsonAlias("key_ticket")
@JsonProperty("key_password")
private String keyPassword;

@JsonAlias("store_ticket")
@JsonProperty("store_password")
private String storePassword;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package com.baidu.hugegraph.license;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;

public class LicenseVerifyParam {
Expand All @@ -29,6 +30,7 @@ public class LicenseVerifyParam {
@JsonProperty("public_alias")
private String publicAlias;

@JsonAlias("store_ticket")
@JsonProperty("store_password")
private String storePassword;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ public class CommonVersion {

// The second parameter of Version.of() is for all-in-one JAR
public static final Version VERSION = Version.of(CommonVersion.class,
"1.8.6");
"1.8.7");
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public void testDeserializeLicenseCreateParam()
String json = "{"
+ "\"subject\":\"hugegraph-evaluation\","
+ "\"private_alias\":\"privatekey\","
+ "\"key_password\":\"123456\","
+ "\"store_password\":\"123456\","
+ "\"key_ticket\":\"a123456\","
+ "\"store_ticket\":\"a123456\","
+ "\"privatekey_path\":\"./privateKeys.store\","
+ "\"license_path\":\"./hugegraph-evaluation.license\","
+ "\"issued_time\":\"2019-08-10 00:00:00\","
Expand Down Expand Up @@ -85,8 +85,8 @@ public void testDeserializeLicenseCreateParam()
LicenseCreateParam.class);
Assert.assertEquals("hugegraph-evaluation", param.subject());
Assert.assertEquals("privatekey", param.privateAlias());
Assert.assertEquals("123456", param.keyPassword());
Assert.assertEquals("123456", param.storePassword());
Assert.assertEquals("a123456", param.keyPassword());
Assert.assertEquals("a123456", param.storePassword());
Assert.assertEquals("./privateKeys.store", param.privateKeyPath());
Assert.assertEquals("./hugegraph-evaluation.license",
param.licensePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void testDeserializeLicenseVerifyParam() throws IOException {
String json = "{"
+ "\"subject\":\"hugegraph-evaluation\","
+ "\"public_alias\":\"publiccert\","
+ "\"store_password\":\"123456\","
+ "\"store_ticket\":\"a123456\","
+ "\"publickey_path\":\"./publicCerts.store\","
+ "\"license_path\":\"./hugegraph-evaluation.license\""
+ "}";
Expand All @@ -43,7 +43,7 @@ public void testDeserializeLicenseVerifyParam() throws IOException {
LicenseVerifyParam.class);
Assert.assertEquals("hugegraph-evaluation", param.subject());
Assert.assertEquals("publiccert", param.publicAlias());
Assert.assertEquals("123456", param.storePassword());
Assert.assertEquals("a123456", param.storePassword());
Assert.assertEquals("./publicCerts.store", param.publicKeyPath());
Assert.assertEquals("./hugegraph-evaluation.license",
param.licensePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void testGetImplementationVersion() throws MalformedURLException {
//Mockito.when(clazz.getResource("fake.class")).thenReturn(manifest);

String manifestPath = "file:./src/test/resources";
Assert.assertEquals("1.8.6.0",
Assert.assertEquals("1.8.7.0",
VersionUtil.getImplementationVersion(manifestPath));

manifestPath = "file:./src/test/resources2";
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Manifest-Version: 1.0
Implementation-Version: 1.8.6.0
Implementation-Version: 1.8.7.0
Archiver-Version: Plexus Archiver
Built-By: jermy
Specification-Title: hugegraph-common
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_111
Specification-Version: 1.8.6
Specification-Version: 1.8.7

4 changes: 2 additions & 2 deletions src/test/resources/create-license.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"subject": "hugegraph-evaluation",
"private_alias": "privatekey",
"key_password": "private_password123456",
"store_password": "public_password123456",
"key_ticket": "a123456",
"store_ticket": "a123456",
"privatekey_path": "src/test/resources/privateKeys.store",
"license_path": "src/test/resources/hugegraph-evaluation.license",
"issued_time": "2019-08-01 00:00:00",
Expand Down
Binary file modified src/test/resources/privateKeys.store
Binary file not shown.
Binary file modified src/test/resources/publicCerts.store
Binary file not shown.
2 changes: 1 addition & 1 deletion src/test/resources/verify-license.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"subject": "hugegraph-evaluation",
"public_alias": "publiccert",
"store_password": "public_password123456",
"store_ticket": "a123456",
"publickey_path": "src/test/resources/publicCerts.store",
"license_path": "src/test/resources/hugegraph-evaluation.license"
}

0 comments on commit f72fac4

Please sign in to comment.