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

Commit

Permalink
Fix GitHub Issue #2
Browse files Browse the repository at this point in the history
  • Loading branch information
lewischeng-ms committed Mar 19, 2015
1 parent 15d1192 commit 2ce08e1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions include/odata/edm/edm_operation_import.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class edm_operation_import
return m_name;
}

const ::odata::utility::string_t get_operation_name() const
{
return m_operation_name;
}

const std::shared_ptr<edm_operation_type> get_operation_type() const
{
return m_operation_type;
Expand Down
2 changes: 1 addition & 1 deletion src/edm/edm_model_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ void edm_model_utility::resolve_type_under_entity_container(const std::shared_pt
auto op = operation_import_iter->second;
if (op)
{
::odata::utility::string_t operation_name = op->get_name();
::odata::utility::string_t operation_name = op->get_operation_name();
op->set_operation_type(model->find_operation_type(operation_name));
}
}
Expand Down
18 changes: 18 additions & 0 deletions tests/functional/edm_test/edm_model_utility_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,24 @@ TEST(resolve_edm_types_after_parsing_type_in_operation)
VERIFY_ARE_EQUAL(verify_param->get_param_type()->get_type_kind(), edm_type_kind_t::Complex);
}

TEST(resolve_correct_operation_after_parsing_type_in_operation_import)
{
::odata::utility::string_t name_space = U("odata.functional.test");
auto model = std::make_shared<edm_model>();
auto schema = model->add_schema(U("schema"), name_space);
std::shared_ptr<edm_operation_type> operation;
operation.reset(new edm_operation_type(U("operation"), name_space, false, U(""), EdmOperationKind::Function, false));
schema->add_operation_type(operation);
std::shared_ptr<edm_operation_import> operation_import;
operation_import.reset(new edm_operation_import(U("operation_import"), U("operation"), U("dummy"), true, OperationImportKind::FunctionImport));
std::shared_ptr<edm_entity_container> container;
container.reset(new edm_entity_container(U("container"), true));
container->add_operation_import(operation_import);
schema->add_container(container);
edm_model_utility::resolve_edm_types_after_parsing(model);
VERIFY_ARE_EQUAL(operation, operation_import->get_operation_type());
}

}

}}}

0 comments on commit 2ce08e1

Please sign in to comment.