Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #25 from hyperledger/master
Browse files Browse the repository at this point in the history
Merging master from hyperledger
  • Loading branch information
anastasia-tarasova authored Aug 22, 2017
2 parents 25d0376 + c8e8064 commit 440981f
Show file tree
Hide file tree
Showing 49 changed files with 5,406 additions and 776 deletions.
142 changes: 142 additions & 0 deletions doc/cd-pipeline.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
@startuml

start

title Indy SDK CI/CD Pipeline structure
scale 0.8

partition Testing {
fork
partition "Ubuntu Testing" {
:Start test pool;
if (BRANCH_NAME in ["master", "rc"]) then (yes)
:<b>Libindy\nRelease build;
else (no)
:<b>Libindy\nDebug build;
endif
:<b>Libindy
Testing;
:<b>Python Wrapper
Testing;
:<b>Java Wrapper
Testing;
}
fork again
partition "RHEL Testing" {
:Start test pool;
if (BRANCH_NAME in ["master", "rc"]) then (yes)
:<b>Libindy\nRelease build;
else (no)
:<b>Libindy\nDebug build;
endif
:<b>Libindy
Testing;
:<b>Python Wrapper
Testing;
:<b>Java Wrapper
Testing;
}
fork again
partition "Windows Testing" {
:Start test pool;
if (BRANCH_NAME in ["master", "rc"]) then (yes)
:<b>Libindy\nRelease build;
else (no)
:<b>Libindy\nDebug build;
endif
:<b>Libindy
Testing;
:<b>Python Wrapper
Testing;
:<b>Java Wrapper
Testing;
#red:<b>.Net Wrapper
Testing;
note right: Not implemented yet\nSee IS-257
}
fork again
partition "MacOS Testing" {
#red::Skip;
note right: Not implemented yet\nSee IS-192
}
fork again
partition "iOS Testing" {
#red::Skip;
note right: Not implemented yet\nSee IS-189
}
end fork
}

partition Publishing {
if (BRANCH_NAME in ["master", "rc"]) then (yes)
fork
partition "Ubuntu Publishing" {
:<b>Libindy
Build and publish Master/RC debs;
:<b>Python Wrapper
Publish RC to PyPi;
:<b>Java Wrapper
Build and publish Master/RC to Maven Central;
}
fork again
partition "RHEL Publishing" {
:<b>Libindy
Build and publish Master/RC rpms;
}
fork again
partition "Windows Publishing" {
:<b>Libindy
Build and publish Master/RC dlls archive;
#red:<b>.Net Wrapper
Master/RC Publishing;
note right: Not implemented yet\nSee IS-306
}
fork again
partition "MacOS Publishing" {
#red::Skip;
note right: Not implemented yet\nSee IS-6
}
fork again
partition "iOS Publishing" {
#red::Skip;
note right: Not implemented yet\nSee IS-100
}
end fork
else (no)
:<b>Skip publishing;
endif
}

partition "Acceptance Testing" {
if (BRANCH_NAME == "rc") then (yes)
:Notify QA about new artifacts to test;
:Acceptance testing by QA;
else (no)
:<b>Skip Acceptance Testing;
endif
}

partition "Releasing" {
if (BRANCH_NAME == "rc" && Acceptance tests passed) then (yes)
:<b>Libindy
Move RC debs to Stable repo;
:<b>Libindy
Move RC rmps to Stable repo;
:<b>Libindy
Move RC dlls archive to Stable repo;
:<b>Python Wrapper
Publish Stable to PyPi;
:<b>Java Wrapper
Build and publish Stable to Maven Central;
else (no)
:<b>Skip Releasing;
endif
}

partition Notification {
:Notify team about pipeline result;
}

stop

@enduml
6 changes: 3 additions & 3 deletions doc/ubuntu-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
1. Checkout and build the library:

```
git checkout https://github.com/hyperledger/indy-sdk.git
cd ./indy-sdk
git clone https://github.com/hyperledger/indy-sdk.git
cd ./indy-sdk/libindy
cargo build
```
1. Run integration tests:
Expand Down Expand Up @@ -55,4 +55,4 @@
RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test
```
See [ci/ubuntu.dockerfile](https://github.com/hyperledger/indy-sdk/tree/master/ci/ubuntu.dockerfile) for example of Ubuntu based environment creation in Docker.
See [ci/ubuntu.dockerfile](https://github.com/hyperledger/indy-sdk/tree/master/ci/ubuntu.dockerfile) for example of Ubuntu based environment creation in Docker.
2 changes: 1 addition & 1 deletion libindy/include/indy_wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ extern "C" {
/// name: Name of the wallet.
/// runtime_config (optional): Runtime wallet configuration json. if NULL, then default runtime_config will be used. Example:
/// {
/// "freshnessTime": string (optional), Amount of minutes to consider wallet value as fresh. Defaults to 24*60.
/// "freshness_time": string (optional), Amount of minutes to consider wallet value as fresh. Defaults to 24*60.
/// ... List of additional supported keys are defined by wallet type.
/// }
/// credentials(optional): Wallet credentials json. List of supported keys are defined by wallet type.
Expand Down
6 changes: 3 additions & 3 deletions libindy/src/api/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ pub extern fn indy_create_pool_ledger_config(command_handle: i32,
/// config (optional): Runtime pool configuration json.
/// if NULL, then default config will be used. Example:
/// {
/// "refreshOnOpen": bool (optional), Forces pool ledger to be refreshed immediately after opening.
/// "refresh_on_open": bool (optional), Forces pool ledger to be refreshed immediately after opening.
/// Defaults to true.
/// "autoRefreshTime": int (optional), After this time in minutes pool ledger will be automatically refreshed.
/// "auto_refresh_time": int (optional), After this time in minutes pool ledger will be automatically refreshed.
/// Use 0 to disable automatic refresh. Defaults to 24*60.
/// "networkTimeout": int (optional), Network timeout for communication with nodes in milliseconds.
/// "network_timeout": int (optional), Network timeout for communication with nodes in milliseconds.
/// Defaults to 20000.
/// }
///
Expand Down
2 changes: 1 addition & 1 deletion libindy/src/api/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub extern fn indy_create_wallet(command_handle: i32,
/// name: Name of the wallet.
/// runtime_config (optional): Runtime wallet configuration json. if NULL, then default runtime_config will be used. Example:
/// {
/// "freshnessTime": string (optional), Amount of minutes to consider wallet value as fresh. Defaults to 24*60.
/// "freshness_time": string (optional), Amount of minutes to consider wallet value as fresh. Defaults to 24*60.
/// ... List of additional supported keys are defined by wallet type.
/// }
/// credentials(optional): Wallet credentials json. List of supported keys are defined by wallet type.
Expand Down
1 change: 1 addition & 0 deletions libindy/src/services/ledger/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ pub const GET_DDO: &'static str = "120";//TODO change number

pub const STEWARD: isize = 2;
pub const TRUSTEE: isize = 0;
pub const TRUST_ANCHOR: isize = 101;
5 changes: 3 additions & 2 deletions libindy/src/services/ledger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ impl LedgerService {
let role = match role {
Some(r) =>
match r.clone() {
"STEWARD" => Some(Role::STEWARD as i32),
"TRUSTEE" => Some(Role::TRUSTEE as i32),
"STEWARD" => Some(Role::Steward as i32),
"TRUSTEE" => Some(Role::Trustee as i32),
"TRUST_ANCHOR" => Some(Role::TrustAnchor as i32),
role @ _ => return Err(CommonError::InvalidStructure(format!("Invalid role: {}", role)))
},
_ => None
Expand Down
6 changes: 4 additions & 2 deletions libindy/src/services/ledger/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use services::ledger::constants::{
GET_CLAIM_DEF,
STEWARD,
TRUSTEE,
TRUST_ANCHOR,
GET_TXN
};

Expand Down Expand Up @@ -43,8 +44,9 @@ impl<T: JsonEncodable> JsonEncodable for Request<T> {}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub enum Role {
STEWARD = STEWARD,
TRUSTEE = TRUSTEE
Steward = STEWARD,
Trustee = TRUSTEE,
TrustAnchor = TRUST_ANCHOR
}

#[derive(Serialize, PartialEq, Debug)]
Expand Down
32 changes: 31 additions & 1 deletion libindy/tests/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use utils::types::{
GetTxnResult,
SchemaData
};
use std::collections::{HashSet};
use std::collections::HashSet;
// TODO: FIXME: create_my_did doesn't support CID creation, but this trustee has CID as DID. So it is rough workaround for this issue.
// See: https://github.com/hyperledger/indy-sdk/issues/25

Expand Down Expand Up @@ -1012,6 +1012,36 @@ mod medium_cases {
TestUtils::cleanup_storage();
}

#[test]
#[cfg(feature = "local_nodes_pool")]
fn indy_send_nym_request_works_for_different_roles() {
TestUtils::cleanup_storage();

let pool_name = "indy_send_nym_request_works_for_different_roles";

let pool_handle = PoolUtils::create_and_open_pool_ledger(pool_name).unwrap();
let wallet_handle = WalletUtils::create_and_open_wallet(pool_name, None).unwrap();

let (trustee_did, _, _) = SignusUtils::create_and_store_my_did(wallet_handle, Some("000000000000000000000000Trustee1")).unwrap();

let (my_did, _, _) = SignusUtils::create_and_store_my_did(wallet_handle, None).unwrap();
let role = "STEWARD";
let nym_request = LedgerUtils::build_nym_request(&trustee_did.clone(), &my_did.clone(), None, None, Some(role)).unwrap();
LedgerUtils::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap();

let (my_did2, _, _) = SignusUtils::create_and_store_my_did(wallet_handle, None).unwrap();
let role = "TRUSTEE";
let nym_request = LedgerUtils::build_nym_request(&trustee_did.clone(), &my_did2.clone(), None, None, Some(role)).unwrap();
LedgerUtils::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap();

let (my_did3, _, _) = SignusUtils::create_and_store_my_did(wallet_handle, None).unwrap();
let role = "TRUST_ANCHOR";
let nym_request = LedgerUtils::build_nym_request(&trustee_did.clone(), &my_did3.clone(), None, None, Some(role)).unwrap();
LedgerUtils::sign_and_submit_request(pool_handle, wallet_handle, &trustee_did, &nym_request).unwrap();

TestUtils::cleanup_storage();
}

#[test]
#[cfg(feature = "local_nodes_pool")]
fn indy_build_nym_requests_works_for_wrong_role() {
Expand Down
4 changes: 2 additions & 2 deletions libindy/tests/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ mod high_cases {
TestUtils::cleanup_storage();

let pool_name = "open_pool_ledger_works_for_config";
let config = r#"{"refreshOnOpen": true}"#;
let config = r#"{"refresh_on_open": true}"#;

let txn_file_path = PoolUtils::create_genesis_txn_file_for_test_pool(pool_name, None, None);
let pool_config = PoolUtils::pool_config_json(txn_file_path.as_path());
Expand Down Expand Up @@ -366,7 +366,7 @@ mod medium_cases {
fn open_pool_ledger_works_for_invalid_config() {
TestUtils::cleanup_storage();
let name = "pool_open";
let config = r#"{"refreshOnOpen": "true"}"#;
let config = r#"{"refresh_on_open": "true"}"#;

let txn_file_path = PoolUtils::create_genesis_txn_file_for_test_pool(name, None, None);
let pool_config = PoolUtils::pool_config_json(txn_file_path.as_path());
Expand Down
2 changes: 1 addition & 1 deletion wrappers/dotnet/indy-sdk-dotnet-test/PoolUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void CreatePoolLedgerConfig(string poolName, int nodesCnt)
public static async Task<Pool> CreateAndOpenPoolLedgerAsync()
{
var poolName = PoolUtils.CreatePoolLedgerConfig();
var openPoolLedgerConfig = "{\"refreshOnOpen\":true}";
var openPoolLedgerConfig = "{\"refresh_on_open\":true}";

return await Pool.OpenPoolLedgerAsync(poolName, openPoolLedgerConfig);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task TestOpenPoolWorksForConfig()
{
var poolName = PoolUtils.CreatePoolLedgerConfig();

var config = "{\"refreshOnOpen\":true,\"autoRefreshTime\":false,\"networkTimeout\":false}";
var config = "{\"refresh_on_open\":true,\"auto_refresh_time\":false,\"network_timeout\":false}";
var pool = await Pool.OpenPoolLedgerAsync(poolName, config);


Expand Down
Loading

0 comments on commit 440981f

Please sign in to comment.