Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1D0F6EF40 for ; Tue, 26 Feb 2013 11:42:14 +0000 (UTC) Received: (qmail 75275 invoked by uid 500); 26 Feb 2013 11:42:13 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 74793 invoked by uid 500); 26 Feb 2013 11:42:13 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 74757 invoked by uid 99); 26 Feb 2013 11:42:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Feb 2013 11:42:13 +0000 Date: Tue, 26 Feb 2013 11:42:13 +0000 (UTC) From: "Michal Fojtik (JIRA)" To: dev@deltacloud.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DTACLOUD-499) The 'ref' attributes are not (de)serialized properly when used in array MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DTACLOUD-499?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D13= 587039#comment-13587039 ]=20 Michal Fojtik commented on DTACLOUD-499: ---------------------------------------- Attached a sample test case: ~/code/core/server =E2=80=BA ruby tests/cimi/model/schema_spec.rb=20 Run options: --seed 42038 # Running tests: .....F............ Finished tests in 0.006219s, 2894.4607 tests/s, 14472.3036 assertions/s. 1) Failure: test_0005_should convert ref in array(Schema::arrays) [tests/cimi/model/sch= ema_spec.rb:246]: Expected #{}, :volume_config=3D>#nil= , :name=3D>nil, :description=3D>nil, :created=3D>nil, :updated=3D>nil, :pro= perty=3D>{}, :type=3D>#, :format=3D>nil, :capacity=3D>ni= l, :operations=3D>[], :href=3D>nil}, @entity=3Dnil>, :volume_image=3D>#nil, :name=3D>nil, :description=3D>nil, :cre= ated=3D>nil, :updated=3D>nil, :property=3D>{}, :image_location=3D>#, :image_data=3D>nil, :bootable=3D>nil, :operations=3D>[], :href= =3D>nil}, @entity=3Dnil>, :meter_templates=3D>[], :event_log_template=3D>#<= struct href=3Dnil>, :operations=3D>[]}, @entity=3Dnil>> (#) to respond to #volume_config. 18 tests, 90 assertions, 1 failures, 0 errors, 0 skips =20 > The 'ref' attributes are not (de)serialized properly when used in array > ----------------------------------------------------------------------- > > Key: DTACLOUD-499 > URL: https://issues.apache.org/jira/browse/DTACLOUD-499 > Project: DeltaCloud > Issue Type: Bug > Components: CIMI/Frontend > Reporter: Michal Fojtik > Assignee: David Lutterkort > Attachments: 0001-Sample-test.patch > > > If you have this definition in CIMI model (MachineTemplate in this case): > array :volume_templates do > ref :volume_template > end > and you use this JSON in .from_json method to create an instance of the M= achineTemplate: > > 'volume_templates' : [ > { 'volumeConfig' : { 'capacity' : '12345' } } > ] > > The resulting 'machine_template.volume_templates.first.volume_config.capa= city' will be 'nil'. > I tried to play a bit with the input JSON and I found that if you use thi= s: > > 'volume_templates' : [ > 'volume_template' : { > { 'volumeConfig' : { 'capacity' : '12345' } } > } > ] > > The resulting 'machine_template.volume_templates.first.volume_template.ca= pacity' is set properly to '12345' :-) > The XML output then looks like: > > > > > 10240 > > > > > I think we need to do something smart in the 'array' to remove the upper = 'volumeTemplate' or introduce something like 'ref_arr :volume_templates'. > Anyway, I'm leaving this one to you David, as you might have better schem= a knowledge than me ;-) > CC'ing Dies, as he reported this issue original in his email. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira