Skip to content

Commit

Permalink
Merge hyperledger-iroha#740 - 'fix/shared_query_builder'
Browse files Browse the repository at this point in the history
Signed-off-by: Kitsu <[email protected]>
  • Loading branch information
l4l authored and lebdron committed Dec 19, 2017
2 parents 058aed7 + 0ef822e commit 5cc4d3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
8 changes: 3 additions & 5 deletions shared_model/builders/protobuf/queries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#ifndef IROHA_PROTO_QUERY_BUILDER_HPP
#define IROHA_PROTO_QUERY_BUILDER_HPP

// TODO @l4l IR-648
// #include "backend/protobuf/queries.hpp"
#include "backend/protobuf/queries/proto_query.hpp"
#include "interfaces/common_objects/types.hpp"
#include "queries.pb.h"

Expand Down Expand Up @@ -128,10 +127,9 @@ namespace shared_model {
return *this;
}

// TODO IR-648 @l4l: Uncomment on completing proto::Query
iroha::protocol::Query /*Query*/ build() {
Query build() {
static_assert(S == (1 << TOTAL) - 1, "Required fields are not set");
return query_; // Query(iroha::protocol::Query(query_));
return Query(iroha::protocol::Query(query_));
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ TEST(ProtoQuery, QueryLoad) {
auto payload = query.mutable_payload();
auto refl = payload->GetReflection();
auto desc = payload->GetDescriptor()->FindOneofByName("query");
boost::for_each(
boost::irange(0, desc->field_count()),
[&](auto i) {
auto field = desc->field(i);
refl->SetAllocatedMessage(
payload, refl->GetMessage(*payload, field).New(), field);
ASSERT_EQ(i, shared_model::proto::Query(query).get().which());
});
boost::for_each(boost::irange(0, desc->field_count()), [&](auto i) {
auto field = desc->field(i);
refl->SetAllocatedMessage(
payload, refl->GetMessage(*payload, field).New(), field);
ASSERT_EQ(i, shared_model::proto::Query(query).get().which());
});
}

/**
Expand Down Expand Up @@ -71,8 +69,7 @@ TEST(ProtoQueryBuilder, Builder) {
.getAccountAssets(account_id, asset_id)
.queryCounter(query_counter)
.build();
// TODO IR-648 @l4l: Uncomment on completing proto::Query
auto &proto = query; //.getTransport();
auto &proto = query.getTransport();

ASSERT_EQ(proto_tx.SerializeAsString(), proto.SerializeAsString());
}

0 comments on commit 5cc4d3b

Please sign in to comment.