对象的属性未定义

时间:2018-06-04 04:03:39

标签: javascript hyperledger-composer

玩弄汽车拍卖的样本网络。 我不知道为什么"提供"交易工作,因为它显示所有属性,但" AmendOffer"事务显示属性以$ as undefined开头?

有没有办法翻译来自" AmendOffer"为了"提供",我试图制作一份" AmendOffer"然后删除属性" oldTransactionID"在复制的一个上使它与"提供"事务。

caused by: java.lang.RuntimeException: There was an error in the forked process
org.testng.TestNGException:

Cannot find class in classpath: Cucumber.runners.MainRunner
    at org.testng.xml.XmlClass.loadClass(XmlClass.java:81)
    at org.testng.xml.XmlClass.init(XmlClass.java:73)
    at org.testng.xml.XmlClass.<init>(XmlClass.java:59)
    at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:556)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:766)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
    at org.testng.xml.XMLParser.parse(XMLParser.java:39)
    at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:16)
    at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:9)
    at org.testng.xml.Parser.parse(Parser.java:172)
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:305)
    at org.testng.TestNG.run(TestNG.java:1036)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
    at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)

enter image description here

1 个答案:

答案 0 :(得分:0)

假设您有TP功能以匹配您的交易和使用您的模型,在Composer Playground中,您将获得如下所示的交易(您建模) - 在Historian中。

{
 "$class": "org.acme.vehicle.auction.Offer",
 "bidPrice": 10,
 "listing": "resource:org.acme.vehicle.auction.VehicleListing#L1",
 "member": "resource:org.acme.vehicle.auction.Member#1",
 "transactionId": "d133abab-cd96-4f15-ac06-ca7a065f2e84",
 "timestamp": "2018-06-04T10:38:17.042Z"
}

{
 "$class": "org.acme.vehicle.auction.AmendOffer",
 "oldTransactionID": "3333",  // whatever
 "bidPrice": 0,
 "listing": "resource:org.acme.vehicle.auction.VehicleListing#L1",
 "member": "resource:org.acme.vehicle.auction.Member#1",
 "transactionId": "3576a2f2-6264-4490-9b79-ef0d612ed07a",
 "timestamp": "2018-06-04T10:37:50.854Z"
}

如果您不想将'oldTransactionId'存储为必填字段 - 只需在模型文件中将其设为可选项。

transaction AmendOffer extends OfferTrans {
  o String oldTransactionID optional
}

例如,以下内容将作为AmendOffer交易

{
  "$class": "org.acme.vehicle.auction.AmendOffer",
  "bidPrice": 10,
  "listing": "resource:org.acme.vehicle.auction.VehicleListing#L1",
  "member": "resource:org.acme.vehicle.auction.Member#1"
}

如果您想更新该示例网络中的Offers[]数组(如今存在),您显然会提供相应的交易代码。