Skip to content
Snippets Groups Projects
Select Git revision
  • ad54edbc12315fb177bd91b415cefa629ed10b9b
  • main default protected
  • f-sss4grpc
  • dev
  • 108-implement-rpc-call-for-server-side-scripting
  • f-windows-conan-create
  • f-to-string
  • f-update-requirements
  • f-related-projects
  • f-role
  • f-remote-path
  • f-rel-path
  • f-consol-message
  • v0.3.0
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.2
  • v0.1.1
  • v0.1
  • v0.0.19
  • v0.0.18
  • v0.0.16
  • v0.0.15
  • v0.0.10
  • v0.0.9
  • v0.0.8
  • v0.0.7
  • v0.0.6
  • v0.0.5
  • v0.0.4
  • v0.0.3
  • v0.0.2
33 results

authentication.h

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test_list_properties.cpp 9.78 KiB
    /*
     * This file is a part of the LinkAhead Project.
     *
     * Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
     * Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License as
     * published by the Free Software Foundation, either version 3 of the
     * License, or (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License
     * along with this program. If not, see <https://www.gnu.org/licenses/>.
     *
     */
    #include "linkahead/connection.h"         // for Connection, ConnectionManager
    #include "linkahead/data_type.h"          // for AtomicDataType
    #include "linkahead/entity.h"             // for Entity, Messages, Message
    #include "linkahead/transaction.h"        // for Entity, Transaction,...
    #include "linkahead/transaction_status.h" // for TransactionStatus, StatusCode
    #include "linkahead/value.h"              // for value
    #include <cstdint>                        // for int64_t
    #include <gtest/gtest-message.h>          // for Message
    #include <gtest/gtest-test-part.h>        // for TestPartResult, SuiteApiResolver
    #include <gtest/gtest_pred_impl.h>        // for Test, EXPECT_EQ, AssertionResult
    #include <iostream>                       // for cout
    #include <memory>                         // for unique_ptr, allocator, __shar...
    #include <string>                         // for string
    #include <vector>                         // for vector
    
    namespace linkahead::entity {
    
    class test_list_properties : public ::testing::Test {
    protected:
      void SetUp() override { DeleteEntities(); }
    
      void TearDown() override { DeleteEntities(); }
    
      static void DeleteEntities() {
        const auto &connection = linkahead::connection::ConnectionManager::GetDefaultConnection();
        auto query_transaction(connection->CreateTransaction());
        query_transaction->Query("FIND ENTITY WITH id > 99");
        query_transaction->Execute();
        if (query_transaction->GetResultSet().size() > 0) {
          auto delete_transaction(connection->CreateTransaction());
          for (const Entity &entity : query_transaction->GetResultSet()) {
            delete_transaction->DeleteById(entity.GetId());
          }
          delete_transaction->Execute();
        }
      }
    };
    
    TEST_F(test_list_properties, insert_list_of_text) {
      const auto &connection = linkahead::connection::ConnectionManager::GetDefaultConnection();
    
      auto insertion_prop(connection->CreateTransaction());
    
      Entity abstract_list_property;
      abstract_list_property.SetRole(Role::PROPERTY);
      abstract_list_property.SetName("TestProp");
      abstract_list_property.SetDataType(DataType::ListOf(AtomicDataType::TEXT));
      abstract_list_property.SetValue(std::vector<std::string>{"item1", "item2", "item3"});
    
      insertion_prop->InsertEntity(&abstract_list_property);