Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ServerEngine.prototype.initialize = function (options, callback) {
const engine = this;
assert(!engine.addressSpace); // check that 'initialize' has not been already called
engine.status = "initializing";
options = options || {};
assert(_.isFunction(callback));
options.nodeset_filename = options.nodeset_filename || nodesets.standard_nodeset_file;
const startTime = new Date();
debugLog("Loading ", options.nodeset_filename, "...");
engine.addressSpace = new AddressSpace();
// register namespace 1 (our namespace);
const serverNamespace = engine.addressSpace.registerNamespace(engine.serverNamespaceUrn);
assert(serverNamespace.index === 1);
generate_address_space(engine.addressSpace, options.nodeset_filename, function () {
const endTime = new Date();
debugLog("Loading ", options.nodeset_filename, " done : ", endTime - startTime, " ms");
before(function (done) {
addressSpace = new AddressSpace();
var xml_files = [
nodesets.standard_nodeset_file,
path.join(__dirname, "../../../", "modeling/my_data_type.xml")
];
fs.existsSync(xml_files[0]).should.be.eql(true);
fs.existsSync(xml_files[1]).should.be.eql(true);
addressSpace.registerNamespace("ServerNamespaceURI");
addressSpace.getNamespaceArray().length.should.eql(2);
generate_address_space(addressSpace, xml_files, function (err) {
done(err);
});
});
after(function (done) {
const parse_opcua_common = require("../lib/parse_server_common").parse_opcua_common;
const _ = require("underscore");
const PseudoSession = require("../lib/pseudo_session").PseudoSession;
async function parse_xml(nodeset_files) {
const addressSpace = new address_space.AddressSpace();
await address_space.generateAddressSpace(addressSpace, nodeset_files);
const pseudoSession = new PseudoSession(addressSpace);
await parse_opcua_common(pseudoSession);
}
const path = require("path");
const g_nodesets = [
nodesets.standard_nodeset_file,
nodesets.di_nodeset_filename,
nodesets.adi_nodeset_filename,
path.join(__dirname,"../../../modeling/my_data_type.xml")
];
(async ()=> {
await parse_xml(g_nodesets);
console.log("done");
})();
const VariableIds = require("node-opcua-constants").VariableIds;
const MethodIds = require("node-opcua-constants").MethodIds;
const ReferenceType = require("node-opcua-address-space").ReferenceType;
const ServerState = require("node-opcua-common").ServerState;
const ServerStatus = require("node-opcua-common").ServerStatus;
const ServerDiagnosticsSummary = require("node-opcua-common").ServerDiagnosticsSummary;
const endpoints_service = require("node-opcua-service-endpoints");
const ApplicationDescription = endpoints_service.ApplicationDescription;
const nodesets = require("node-opcua-nodesets");
exports.standard_nodeset_file = nodesets.standard_nodeset_file;
exports.di_nodeset_filename = nodesets.di_nodeset_filename;
exports.adi_nodeset_filename = nodesets.adi_nodeset_filename;
const mini_nodeset_filename = require("node-opcua-address-space/test_helpers/get_mini_address_space").mini_nodeset_filename;
exports.mini_nodeset_filename = mini_nodeset_filename;
const debugLog = require("node-opcua-debug").make_debugLog(__filename);
const doDebug = require("node-opcua-debug").checkDebugFlag(__filename);
const ServerCapabilities = require("./server_capabilities").ServerCapabilities;
const HistoryServerCapabilities = require("./history_server_capabilities").HistoryServerCapabilities;
const eoan = require("node-opcua-address-space");
/**