• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript node-opcua-test-fixtures.getFixture函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中node-opcua-test-fixtures.getFixture函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getFixture函数的具体用法?TypeScript getFixture怎么用?TypeScript getFixture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getFixture函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: it

    it("Q1 should read a VariableType with a default value", async () => {

        const xml_file1 = path.join(__dirname, "../test_helpers/test_fixtures/mini.Node.Set2.xml");
        const xml_file2 = getFixture("fixture_variable_type_with_default_value.xml");

        const xml_files = [
            xml_file1, xml_file2
        ];
        await generateAddressSpace(addressSpace, xml_files);

        const ns = addressSpace.getNamespaceIndex("MYNAMESPACE");
        ns.should.eql(1);
        const my3x3MatrixType = addressSpace.findVariableType("My3x3MatrixType", ns)!;
        should.exist(my3x3MatrixType);

        my3x3MatrixType.browseName.toString().should.eql("1:My3x3MatrixType");

        addressSpace.findDataType(my3x3MatrixType.dataType)!.browseName.toString().should.eql("Float");

        my3x3MatrixType.valueRank.should.eql(2);
        my3x3MatrixType.arrayDimensions.should.eql([3, 3]);
        (my3x3MatrixType as any).value.toString().should.eql(new Variant({
            dataType: "Float", value: [11, 12, 13, 21, 22, 23, 31, 32, 33]
        }).toString());

        const myDoubleArrayType = addressSpace.findVariableType("MyDoubleArrayType", ns)!;
        myDoubleArrayType.browseName.toString().should.eql("1:MyDoubleArrayType");
        myDoubleArrayType.valueRank.should.eql(1);
        myDoubleArrayType.arrayDimensions.should.eql([5]);
        (myDoubleArrayType as any).value.toString().should.eql(
          new Variant({ dataType: "Double", value: [1, 2, 3, 4, 5] }).toString());

    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:33,代码来源:test_load_nodeset2.ts


示例2: it

    it("should process multiple xml files that reference each other", async () => {
        const addressSpace = AddressSpace.create();
        const xml_files = [
            path.join(__dirname, "../test_helpers/test_fixtures/mini.Node.Set2.xml"),
            getFixture("fixture_custom_nodeset.xml"),
            getFixture("fixture_custom_nodeset_extension.xml")
        ];
        fs.existsSync(xml_files[0]).should.be.eql(true);
        fs.existsSync(xml_files[1]).should.be.eql(true);
        fs.existsSync(xml_files[2]).should.be.eql(true);

        addressSpace.registerNamespace("ServerNamespaceURI");
        addressSpace.getNamespaceArray().length.should.eql(2);

        await generateAddressSpace(addressSpace, xml_files);

        addressSpace.getNamespaceArray().length.should.eql(5);
        addressSpace.getNamespaceArray()[2].namespaceUri.should.eql("http://nodeopcua.org/UA/CUSTOM_NAMESPACE1/");
        addressSpace.getNamespaceArray()[3].namespaceUri.should.eql("http://nodeopcua.org/UA/CUSTOM_NAMESPACE2/");
        addressSpace.getNamespaceArray()[4].namespaceUri.should.eql("http://nodeopcua.org/UA/CUSTOM_NAMESPACE3/");

        addressSpace.findNode("ns=2;i=1")!.browseName.toString().should.eql("2:ObjectInCUSTOM_NAMESPACE1");
        addressSpace.findNode("ns=3;i=1")!.browseName.toString().should.eql("3:ObjectInCUSTOM_NAMESPACE2");

        addressSpace.findNode("ns=2;i=1000")!.browseName.toString().should.eql("2:AnOtherObjectInCUSTOM_NAMESPACE1");
        addressSpace.findNode("ns=3;i=1000")!.browseName.toString().should.eql("3:AnOtherObjectInCUSTOM_NAMESPACE2");

        addressSpace.findNode("ns=4;i=1")!.browseName.toString().should.eql("4:ObjectInCUSTOM_NAMESPACE3");

        addressSpace.getNamespaceArray().map((x) => x.namespaceUri).should.eql([
            "http://opcfoundation.org/UA/",
            "ServerNamespaceURI",
            "http://nodeopcua.org/UA/CUSTOM_NAMESPACE1/",
            "http://nodeopcua.org/UA/CUSTOM_NAMESPACE2/",
            "http://nodeopcua.org/UA/CUSTOM_NAMESPACE3/"
        ]);
        addressSpace.dispose();

    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:39,代码来源:test_address_space_namespace.ts


示例3: construct_verifyMessageChunkSignatureForTest

export function construct_verifyMessageChunkSignatureForTest() {
    const publicKey = fs.readFileSync(getFixture("certs/server_public_key_1024.pub")).toString("ascii");
    return (chunk: Buffer) => {
        assert(chunk instanceof Buffer);
        const options = {
            algorithm: "RSA-SHA256",
            publicKey,
            signatureLength: 128
        };

        return verifyChunkSignature(chunk, options);
    };

}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:14,代码来源:signature_helpers.ts


示例4: construct_makeMessageChunkSignatureForTest

function construct_makeMessageChunkSignatureForTest() {

    const privateKey = fs.readFileSync(getFixture("certs/server_key_1024.pem")).toString("ascii");

    return (chunk: Buffer) => {
        const options = {
            algorithm: "RSA-SHA256",
            privateKey,
            signatureLength: 128,
        };
        const buf = makeMessageChunkSignature(chunk, options); // Buffer
        assert(buf instanceof Buffer, "expecting a Buffer");
        return buf;
    };
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:15,代码来源:signature_helpers.ts


示例5: it

    it("#312 - should load a nodeset xml file containing MandatoryPlaceHolder f", async () => {

        const xml_file0 = path.join(__dirname, "../test_helpers/test_fixtures/mini.Node.Set2.xml");
        const xml_file1 = getFixture("fixture_issue_312_nodeset2.xml");

        fs.existsSync(xml_file0).should.be.eql(true);

        fs.existsSync(xml_file1).should.be.eql(true);

        const xml_files = [
            xml_file0,
            xml_file1
        ];
        await generateAddressSpace(addressSpace, xml_files);

    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:16,代码来源:test_issue_312.ts


示例6: require

    encryptBufferWithDerivedKeys,
    makeMessageChunkSignature,
    makeMessageChunkSignatureWithDerivedKeys,
    makeSHA1Thumbprint,
    publicEncrypt_long,
    readCertificate,
    readKeyPem,
    RSA_PKCS1_PADDING
} from "node-opcua-crypto";
import { AsymmetricAlgorithmSecurityHeader, SymmetricAlgorithmSecurityHeader } from "node-opcua-service-secure-channel";
import { SecureMessageChunkManager, SequenceNumberGenerator } from "../source";

// tslint:disable:no-var-requires
const getFixture = require("node-opcua-test-fixtures").getFixture;

const senderCertificate = readCertificate(getFixture("certs/client_cert_1024.pem"));
const senderPrivateKey = readKeyPem(getFixture("certs/client_key_1024.pem"));

const receiverCertificate =  readCertificate(getFixture("certs/server_cert_1024.pem"));
const receiverCertificateThumbprint = makeSHA1Thumbprint(receiverCertificate);

const receiverPublicKey = fs.readFileSync(getFixture("certs/server_public_key_1024.pub", "ascii")).toString();

const sequenceNumberGenerator = new SequenceNumberGenerator();

export type ChunkVisitorFunc = (err: Error | null, chunk?: Buffer) => void;

export function iterateOnSignedMessageChunks(buffer: Buffer, callback: ChunkVisitorFunc) {

    const params = {
        algorithm: "RSA-SHA1",
开发者ID:node-opcua,项目名称:node-opcua,代码行数:31,代码来源:fake_message_chunk_factory.ts



注:本文中的node-opcua-test-fixtures.getFixture函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap