1# Licensed to the Apache Software Foundation (ASF) under one 2# or more contributor license agreements. See the NOTICE file 3# distributed with this work for additional information 4# regarding copyright ownership. The ASF licenses this file 5# to you under the Apache License, Version 2.0 (the 6# "License"); you may not use this file except in compliance 7# with the License. You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, 12# software distributed under the License is distributed on an 13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14# KIND, either express or implied. See the License for the 15# specific language governing permissions and limitations 16# under the License. 17 18class TestPlasmaReferredObject < Test::Unit::TestCase 19 include Helper::Omittable 20 21 def setup 22 @store = nil 23 omit("Plasma is required") unless defined?(::Plasma) 24 require_gi_bindings(3, 3, 9) 25 @store = Helper::PlasmaStore.new 26 @store.start 27 @client = Plasma::Client.new(@store.socket_path, nil) 28 29 @id = Plasma::ObjectID.new("Hello") 30 @data = "World" 31 @metadata = "Metadata" 32 @options = Plasma::ClientCreateOptions.new 33 @options.metadata = @metadata 34 object = @client.create(@id, @data.bytesize, @options) 35 object.data.set_data(0, @data) 36 object.seal 37 @object = @client.refer_object(@id, -1) 38 end 39 40 def teardown 41 @store.stop if @store 42 end 43 44 test("#release") do 45 @object.release 46 47 message = "[plasma][referred-object][release]: " 48 message << "Can't process released object: <#{@id.to_hex}>" 49 error = Arrow::Error::Invalid.new(message) 50 assert_raise(error) do 51 @object.release 52 end 53 end 54end 55