text:
var nopt = require('nopt'),
    os = require('os'),
    props = require('./lib/properties'),
    querystring = require('querystring'),
    connect = require('connect'),
    child_process = require('child_process'),
    temp = require('temp'),
    path = require('path'),
    async = require('async'),
    LRU = require('lru-cache'),
    fs = require('fs-extra');

var opts = nopt({
        'env': [String],
        'rootDir': [String]});

var propHierarchy = [
    'defaults',
    opts.env || 'dev',
    os.hostname()];

var rootDir = opts.rootDir || './etc';

props.initialize(rootDir + '/config', propHierarchy);

var port = props.get('gcc-explorer', 'port', 10240);
var compilers = [];
var compilersByExe = {};
var compilerExecutables;

var cache = LRU({
    max: props.get('gcc-explorer', 'cacheMb') * 1024 * 1024,
    length: function(n) { return n.length; }
});
var cacheHits = 0;
var cacheMisses = 0;

var compileQueue = async.queue(function(task, callback) {
    console.log("Compiling, queue size " + compileQueue.length());
    task.task(callback);
}, props.get("gcc-explorer", "maxConcurrentCompiles", 1));
compileQueue.drain = function() {
    console.log("Compile queue empty");
};
compileQueue.saturated = function() {
    console.log("Compile queue full");
};

function checkOptions(options) {
    var okOptions = new RegExp(props.get('gcc-options', 'whitelistRe', '.*'));
    var badOptions = new RegExp(props.get('gcc-options', 'blacklistRe'));
    var error = [];
    options.forEach(function(option) {
        if (!option.match(okOptions) || option.match(badOptions)) {
            error.push(option);
        }
    });
    if (error.length > 0) return "Bad options: " + error.join(", ");
    return null;
}

function checkSource(source) {
    var re = /^\s*#include(_next)?\s+["<"](\/|.*\.\.)/;
    var failed = [];
    source.split('\n').forEach(function(line, index) {
        if (line.match(re)) {
            failed.push("<stdin>:" + (index + 1) + ":1: no absolute or relative includes please");
        }
    });
    if (failed.length > 0) return failed.join("\n");
    return null;
}

function cacheStats() {
    console.log("Cache stats: " + cacheHits + " hits, " + cacheMisses + " misses");
}

function compile(req, res) {
    var source = req.body.source;
    var compiler = req.body.compiler;
    if (getCompilerExecutables().indexOf(compiler) < 0) {
        return res.end(JSON.stringify({code: -1, stderr: "bad compiler " + compiler}));
    }
    var compilerInfo = compilersByExe[compiler];
    if (!compilerInfo) {
        return res.end(JSON.stringify({code: -1, stderr: "bad compiler " + compiler}));
    }
    var options = req.body.options.split(' ').filter(function(x){return x!=""});
    var filters = req.body.filters;
    var optionsErr = checkOptions(options);
    if (optionsErr) {
        return res.end(JSON.stringify({code: -1, stderr: optionsErr}));
    }
    var sourceErr = checkSource(source);
    if (sourceErr) {
        return res.end(JSON.stringify({code: -1, stderr: sourceErr}));
    }

    var key = compiler + " | " + source + " | " + options + " | " + filters["intel"];
    var cached = cache.get(key);
    if (cached) {
        cacheHits++;
        cacheStats();
        res.end(cached);
        return;
    }
    cacheMisses++;

    var compileTask = function(taskFinished) {
        temp.mkdir('gcc-explorer-compiler', function(err, dirPath) {
            if (err) {
                return res.end(JSON.stringify({code: -1, stderr: "Unable to open temp file: " + err}));
            }
            var postProcess = props.get("gcc-explorer", "postProcess");
            var inputFilename = path.join(dirPath, props.get("gcc-explorer", "compileFilename"));
            var outputFilename = path.join(dirPath, 'output.S');
            if (compilerInfo.supportedOpts['-masm']) {
                var syntax = '-masm=att'; // default at&t
                if (filters["intel"] == "true") syntax = '-masm=intel';
                options = options.concat([syntax]);
            }
            var compileToAsm = props.get("gcc-explorer", "compileToAsm", "-S").split(" ");
            options = options.concat(['-g', '-o', outputFilename]).concat(compileToAsm).concat([inputFilename]);
            var file = fs.openSync(inputFilename, "w");
            fs.writeSync(file, source);
            fs.closeSync(file);
            var okToCache = true;
            var compilerWrapper = props.get("gcc-explorer", "compiler-wrapper");
            if (compilerWrapper) {
                options = [compiler].concat(options);
                compiler = compilerWrapper;
            }
            var child = child_process.spawn(
                compiler,
                options,
                {detached: true}
                );
            var stdout = "";
            var stderr = "";
            var timeout = setTimeout(function() {
                okToCache = false;
                child.kill();
                stderr += "\nKilled - processing time exceeded";
            }, props.get("gcc-explorer", "compileTimeoutMs", 100));
            child.stdout.on('data', function (data) { stdout += data; });
            child.stderr.on('data', function (data) { stderr += data; });
            child.on('exit', function (code) {
                clearTimeout(timeout);
                child_process.exec('cat "' + outputFilename + '" | ' + postProcess,
                    { maxBuffer: props.get("gcc-explorer", "max-asm-size", 8 * 1024 * 1024) },
                    function(err, filt_stdout, filt_stderr) {
                        var data = filt_stdout;
                        if (err) {
                            data = '<No output: ' + err + '>';
                        }

                        var result = JSON.stringify({
                            stdout: stdout,
                            stderr: stderr,
                            asm: data,
                            code: code });
                        if (okToCache) {
                            cache.set(key, result);
                            cacheStats();
                        }
                        res.end(result);
                        fs.remove(dirPath);
                        taskFinished();
                    });
            });
            child.stdin.end();
        });
    };

    compileQueue.push({task: compileTask});
}

function loadSources() {
    var sourcesDir = "lib/sources";
    var sources = fs.readdirSync(sourcesDir)
        .filter(function(file) { return file.match(/.*\.js$/); })
        .map(function(file) { return require("./" + path.join(sourcesDir, file)); });
    return sources;
}

var fileSources = loadSources();
var sourceToHandler = {};
fileSources.forEach(function(source) { sourceToHandler[source.urlpart] = source; });

function compareOn(key) {
    return function(xObj, yObj) {
        var x = xObj[key];
        var y = yObj[key];
        if (x < y) return -1;
        if (x > y) return 1;
        return 0;
    };
}

function getSources(req, res) {
    var sources = fileSources.map(function(source) {
        return {name: source.name, urlpart: source.urlpart};
    });
    res.end(JSON.stringify(sources.sort(compareOn("name"))));
}

function getInfo(req, res) {
    res.end(JSON.stringify({
        language: props.get("gcc-explorer", "language"),
        options: props.get("gcc-explorer", "options"),
    }));
}

function getSource(req, res, next) {
    var bits = req.url.split("/");
    var handler = sourceToHandler[bits[1]];
    if (!handler) {
        next();
        return;
    }
    var action = bits[2];
    if (action == "list") action = handler.list;
    else if (action == "load") action = handler.load;
    else if (action == "save") action = handler.save;
    else action = null;
    if (action == null) {
        next();
        return;
    }
    action.apply(handler, bits.slice(3).concat(function(err, response) {
        if (err) {
            res.end(JSON.stringify({err: err}));
        } else {
            res.end(JSON.stringify(response));
        }}));
}

function getCompilerExecutables() {
    if (compilerExecutables) {
        return compilerExecutables;
    }
    var exes = props.get("gcc-explorer", "compilers", "/usr/bin/g++").split(":");
    var ndk = props.get('gcc-explorer', 'androidNdk');
    if (ndk) {
        var toolchains = fs.readdirSync(ndk + "/toolchains");
        toolchains.forEach(function(v, i, a) {
            var path = ndk + "/toolchains/" + v + "/prebuilt/linux-x86_64/bin/";
            if (fs.existsSync(path)) {
                var cc = fs.readdirSync(path).filter(function(filename) {
                    return filename.indexOf("g++") != -1;
                });
                a[i] = path + cc[0];
            } else {
                a[i] = null;
            }
        });
        toolchains = toolchains.filter(function(x){return x!=null;});
        exes.push.apply(exes, toolchains);
    }
    compilerExecutables = exes;
    return exes;
}

function getCompilers(req, res) {
    res.end(JSON.stringify(compilers));
}

function findCompilers() {
    async.map(getCompilerExecutables(),
        function (compiler, callback) {
            fs.stat(compiler, function(err, result) {
                if (err) return callback(null, null);
                child_process.exec(compiler + ' --version', function(err, output) {
                    if (err) return callback(null, null);
                    var version = output.split('\n')[0];
                    child_process.exec(compiler + ' --target-help', function(err, output) {
                        var options = {};
                        if (!err) {
                            var splitness = /--?[-a-zA-Z]+( ?[-a-zA-Z]+)/;
                            output.split('\n').forEach(function(line) {
                                var match = line.match(splitness);
                                if (!match) return;
                                options[match[0]] = true;
                            });
                        }
                        callback(null, {exe: compiler, version: version, supportedOpts: options});
                    });
                });
            });
        },
        function (err, all) {
            all = all.filter(function(x){return x!=null;});
            compilers = all.sort(function(x,y){return x.version < y.version ? -1 : x.version > y.version ? 1 : 0;});
            compilersByExe = {};
            compilers.forEach(function(compiler) {
                compilersByExe[compiler.exe] = compiler;
            });
        }
    );
}

findCompilers();

// WebServer.
var webServer = connect();
webServer
    .use(connect.logger())
    .use(connect.favicon('static/favicon.ico'))
    .use(connect.static('static'))
    .use(connect.bodyParser())
    .use('/info', getInfo)
    .use('/sources', getSources)
    .use('/source', getSource)
    .use('/compilers', getCompilers)
    .use('/compile', compile);

// GO!
console.log("=======================================");
console.log("Listening on http://" + os.hostname() + ":" + port + "/");
console.log("=======================================");
webServer.listen(port);


text:
import os
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ms2ldaviz.settings")

import django
django.setup()

from basicviz.models import Experiment,User,UserExperiment

if __name__ == '__main__':
	username = sys.argv[1]
	user = User.objects.get(username = username)
	experiments = Experiment.objects.all()
	for experiment in experiments:
		ue = UserExperiment.objects.get_or_create(user = user,experiment = experiment)[0]
		ue.permission = 'edit'
		ue.save()

redpajama_set_name: RedPajamaGithub


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace scifiBookStore.SiteAdministration {

    public partial class Categories {

        /// <summary>
        /// StoreCategories control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.GridView StoreCategories;
    }
}


text:
package org.broadinstitute.dsde.rawls.model

import org.broadinstitute.dsde.rawls.RawlsException
import org.broadinstitute.dsde.rawls.model.Attributable.AttributeMap
import org.broadinstitute.dsde.rawls.model.WorkspaceJsonSupport.AttributeNameFormat
import org.scalatest.Assertions
import org.scalatest.freespec.AnyFreeSpec
import spray.json.DefaultJsonProtocol._
import spray.json._

class AttributeSpec extends AnyFreeSpec with Assertions {

  "AttributeName model" - {

    "when unmarshalling from json" - {
      "should handle namespaces" in {
        val testData = """ "namespace:name" """
        val an = testData.parseJson.convertTo[AttributeName]
        assertResult("namespace")(an.namespace)
        assertResult("name")(an.name)
      }
      "should handle missing namespace" in {
        val testData = """ "name" """
        val an = testData.parseJson.convertTo[AttributeName]
        assertResult(AttributeName.defaultNamespace)(an.namespace)
        assertResult("name")(an.name)
      }
      "should fail with multiple delimiters" in {
        val testData = """ "one:two:three" """
        intercept[RawlsException] {
          testData.parseJson.convertTo[AttributeName]
        }
      }
    }
    "when marshalling to json" - {
      "should handle arbitrary namespace" in {
        val testData = AttributeName("namespace", "name")
        assertResult(JsString("namespace:name"))(testData.toJson)
      }
      "should handle library namespace" in {
        val testData = AttributeName(AttributeName.libraryNamespace, "name")
        assertResult(JsString("library:name"))(testData.toJson)
      }
      "should omit default namespace" in {
        val testData = AttributeName.withDefaultNS("name")
        assertResult(JsString("name"))(testData.toJson)
      }
    }
  }

  "AttributeMap model" - {
    import org.broadinstitute.dsde.rawls.model.WorkspaceJsonSupport.attributeFormat

    "when unmarshalling from json" - {
      "should handle string value" in {
        val testData =
          """
            | {"testKey" : "helloWorld"}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeString("helloWorld"))(attr)
      }
      "should handle numeric value" in {
        val testData =
          """
            | {"testKey" : 123}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeNumber(123))(attr)
      }
      "should handle boolean value" in {
        val testData =
          """
            | {"testKey" : true}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeBoolean(true))(attr)
      }
      "should handle null value" in {
        val testData =
          """
            | {"testKey" : null}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeNull)(attr)
      }
      "should handle entity reference value" in {
        val testData =
          """
            | {"testKey" : {
            |   "entityType" : "sample",
            |   "entityName" : "My Sample Name"
            | }}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeEntityReference("sample", "My Sample Name"))(attr)
      }
      "should handle empty value list" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "AttributeValue",
            |   "items" : []
            | }}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeValueEmptyList)(attr)
      }
      "should handle empty entity reference list" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "EntityReference",
            |   "items" : []
            | }}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeEntityReferenceEmptyList)(attr)
      }
      "should handle populated entity reference list" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "EntityReference",
            |   "items" : [
            |     {"entityType" : "sample", "entityName" : "My Sample Name"},
            |     {"entityType" : "participant", "entityName" : "My Participant Name"},
            |     {"entityType" : "pair", "entityName" : "My Pair Name"}
            |   ]
            | }}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        val expected = AttributeEntityReferenceList(
          Seq(
            AttributeEntityReference("sample", "My Sample Name"),
            AttributeEntityReference("participant", "My Participant Name"),
            AttributeEntityReference("pair", "My Pair Name")
          )
        )
        assertResult(expected)(attr)
      }
      "should handle populated string list" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "AttributeValue",
            |   "items" : [ "foo", "bar", "baz" ]
            | }}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        val expected = AttributeValueList(
          Seq(
            AttributeString("foo"),
            AttributeString("bar"),
            AttributeString("baz")
          )
        )
        assertResult(expected)(attr)
      }
      "should handle populated numeric list" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "AttributeValue",
            |   "items" : [ 123, 456, 789 ]
            | }}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        val expected = AttributeValueList(
          Seq(
            AttributeNumber(123),
            AttributeNumber(456),
            AttributeNumber(789)
          )
        )
        assertResult(expected)(attr)
      }
      "should handle populated boolean list" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "AttributeValue",
            |   "items" : [ true, false, true ]
            | }}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        val expected = AttributeValueList(
          Seq(
            AttributeBoolean(true),
            AttributeBoolean(false),
            AttributeBoolean(true)
          )
        )
        assertResult(expected)(attr)
      }
      "should handle raw json empty array" in {
        val testData =
          """
            | {"testKey" : [] }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        val expected = AttributeValueRawJson(JsArray())
        assertResult(expected)(attr)
      }
      "should handle raw json filled array" in {
        val testData =
          """
            | {"testKey" : [1,2,3] }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        val expected = AttributeValueRawJson(JsArray(JsNumber(1), JsNumber(2), JsNumber(3)))
        assertResult(expected)(attr)
      }
      "should handle raw json empty object" in {
        val testData =
          """
            | {"testKey" : {} }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        val expected = AttributeValueRawJson(JsObject())
        assertResult(expected)(attr)
      }
      "should handle raw json object with items" in {
        val testData =
          """
            | {"testKey" : {"foo" : "bar"} }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        val expected = AttributeValueRawJson(JsObject(Map("foo" -> JsString("bar"))))
        assertResult(expected)(attr)
      }
      "should fail if entity reference list contains values" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "EntityReference",
            |   "items" : [ 123, 456, 789 ]
            | }}
          """.stripMargin
        intercept[DeserializationException] {
          testData.parseJson.convertTo[AttributeMap]
        }
      }
      "should fail if value list contains entities" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "AttributeValue",
            |   "items" : [
            |     {"entityType" : "sample", "entityName" : "My Sample Name"},
            |     {"entityType" : "participant", "entityName" : "My Participant Name"},
            |     {"entityType" : "pair", "entityName" : "My Pair Name"}
            |   ]
            | }}
          """.stripMargin
        intercept[DeserializationException] {
          testData.parseJson.convertTo[AttributeMap]
        }
      }
      "should work even if value list contains mixed types" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "AttributeValue",
            |   "items" : ["hello world", 123, false]
            | }}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        val expected = AttributeValueList(
          Seq(
            AttributeString("hello world"),
            AttributeNumber(123),
            AttributeBoolean(false)
          )
        )
        assertResult(expected)(attr)
      }
      "should fail if list specifies unknown type" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "SomeValueNotExpected",
            |   "items" : ["foo", "bar", "baz"]
            | }}
          """.stripMargin
        intercept[DeserializationException] {
          testData.parseJson.convertTo[AttributeMap]
        }
      }
      "should return AttributeValueRawJson attribute if list omits type" in {
        val testData =
          """
            | {"testKey" : {
            |   "items" : ["foo", "bar", "baz"]
            | }}
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        val expected =
          AttributeValueRawJson(JsObject(Map("items" -> JsArray(JsString("foo"), JsString("bar"), JsString("baz")))))
        assertResult(expected)(attr)
      }
      "should fail if entity reference list contains list" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "EntityReference",
            |   "items" : [
            |     {"anotherList" :
            |       {
            |         "itemsType" : "AttributeValue",
            |         "items" : ["foo", "bar", "baz"]
            |       }
            |     }
            |   ]
            | }}
          """.stripMargin
        intercept[DeserializationException] {
          testData.parseJson.convertTo[AttributeMap]
        }
      }
      "should fail if value list contains list" in {
        val testData =
          """
            | {"testKey" : {
            |   "itemsType" : "AttributeValue",
            |   "items" : {
            |     "itemsType" : "AttributeValue",
            |     "items" : ["foo", "bar", "baz"]
            |   }
            | }}
          """.stripMargin
        intercept[DeserializationException] {
          testData.parseJson.convertTo[AttributeMap]
        }
      }
      "should handle a json with every possible type" in {
        val testData =
          """
            | {
            |   "stringKey" : "stringValue",
            |   "numberKey" : 123,
            |   "booleanKey" : true,
            |   "nullKey" : null,
            |   "entityReferenceKey" : {"entityType" : "sample", "entityName" : "Top-level reference"},
            |   "emptyValueListKey" : { "itemsType" : "AttributeValue", "items" : []},
            |   "emptyEntityReferenceListKey" : { "itemsType" : "EntityReference", "items" : []},
            |   "valueListKey" : { "itemsType" : "AttributeValue", "items" : ["foo", 456, false]},
            |   "entityReferenceListKey" : {
            |     "itemsType" : "EntityReference",
            |     "items" : [
            |       {"entityType" : "sample", "entityName" : "My Sample Name"},
            |       {"entityType" : "participant", "entityName" : "My Participant Name"},
            |       {"entityType" : "pair", "entityName" : "My Pair Name"}
            |     ]
            |   }
            | }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]

        val expected = Map[AttributeName, Attribute](
          AttributeName.withDefaultNS("stringKey") -> AttributeString("stringValue"),
          AttributeName.withDefaultNS("numberKey") -> AttributeNumber(123),
          AttributeName.withDefaultNS("booleanKey") -> AttributeBoolean(true),
          AttributeName.withDefaultNS("nullKey") -> AttributeNull,
          AttributeName.withDefaultNS("entityReferenceKey") -> AttributeEntityReference("sample",
                                                                                "Top-level reference"
          ),
          AttributeName.withDefaultNS("emptyValueListKey") -> AttributeValueEmptyList,
          AttributeName.withDefaultNS("emptyEntityReferenceListKey") -> AttributeEntityReferenceEmptyList,
          AttributeName.withDefaultNS("valueListKey") -> AttributeValueList(
            Seq(
              AttributeString("foo"),
              AttributeNumber(456),
              AttributeBoolean(false)
            )
          ),
          AttributeName.withDefaultNS("entityReferenceListKey") -> AttributeEntityReferenceList(
            Seq(
              AttributeEntityReference("sample", "My Sample Name"),
              AttributeEntityReference("participant", "My Participant Name"),
              AttributeEntityReference("pair", "My Pair Name")
            )
          )
        )
        assertResult(expected)(obj)
      }
    }
    "when marshalling to json" - {
      "should handle string value" in {
        val testData: AttributeMap = Map(AttributeName("ns", "name") -> AttributeString("abc"))
        val expected =
          """
            |{"ns:name":"abc"}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle numeric value" in {
        val testData: AttributeMap = Map(AttributeName("ns", "name") -> AttributeNumber(777))
        val expected =
          """
            |{"ns:name":777}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle boolean value" in {
        val testData: AttributeMap = Map(AttributeName("ns", "name") -> AttributeBoolean(true))
        val expected =
          """
            |{"ns:name":true}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle null value" in {
        val testData: AttributeMap = Map(AttributeName("ns", "name") -> AttributeNull)
        val expected =
          """
            |{"ns:name":null}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle entity reference value" in {
        val testData: AttributeMap = Map(
          AttributeName("ns", "name") ->
            AttributeEntityReference("sample", "some sample name")
        )
        val expected =
          """
            |{"ns:name":{"entityType":"sample","entityName":"some sample name"}}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle empty value list" in {
        val testData: AttributeMap = Map(AttributeName("ns", "name") -> AttributeValueEmptyList)
        val expected =
          """
            |{"ns:name":{"itemsType":"AttributeValue","items":[]}}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle empty entity reference list" in {
        val testData: AttributeMap = Map(AttributeName("ns", "name") -> AttributeEntityReferenceEmptyList)
        val expected =
          """
            |{"ns:name":{"itemsType":"EntityReference","items":[]}}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle populated entity reference list" in {
        val testData: AttributeMap = Map(
          AttributeName("ns", "name") -> AttributeEntityReferenceList(
            Seq(
              AttributeEntityReference("sample", "some sample name"),
              AttributeEntityReference("participant", "some participant name")
            )
          )
        )
        val expected =
          """
            |{"ns:name":{"itemsType":"EntityReference","items":[{"entityType":"sample","entityName":"some sample name"},{"entityType":"participant","entityName":"some participant name"}]}}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle populated mixed value list" in {
        val testData: AttributeMap = Map(
          AttributeName("ns", "name") -> AttributeValueList(
            Seq(
              AttributeString("def"),
              AttributeNumber(999),
              AttributeBoolean(true),
              AttributeNull
            )
          )
        )
        val expected =
          """
            |{"ns:name":{"itemsType":"AttributeValue","items":["def",999,true,null]}}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle a json with every possible type" in {
        val testData: AttributeMap = Map[AttributeName, Attribute](
          AttributeName.withDefaultNS("stringKey") -> AttributeString("stringValue"),
          AttributeName.withDefaultNS("numberKey") -> AttributeNumber(123),
          AttributeName.withDefaultNS("booleanKey") -> AttributeBoolean(true),
          AttributeName.withDefaultNS("nullKey") -> AttributeNull,
          AttributeName.withDefaultNS("entityReferenceKey") -> AttributeEntityReference("sample", "TopLevelReference"),
          AttributeName.withDefaultNS("emptyValueListKey") -> AttributeValueEmptyList,
          AttributeName.withDefaultNS("emptyEntityReferenceListKey") -> AttributeEntityReferenceEmptyList,
          AttributeName.withDefaultNS("valueListKey") -> AttributeValueList(
            Seq(
              AttributeString("foo"),
              AttributeNumber(456),
              AttributeBoolean(false)
            )
          ),
          AttributeName.withDefaultNS("entityReferenceListKey") -> AttributeEntityReferenceList(
            Seq(
              AttributeEntityReference("sample", "MySampleName"),
              AttributeEntityReference("participant", "MyParticipantName"),
              AttributeEntityReference("pair", "MyPairName")
            )
          )
        )
        // use replace to make the test code easier to read
        val expected =
          """
            |{
            |  "stringKey" : "stringValue",
            |  "numberKey" : 123,
            |  "booleanKey" : true,
            |  "nullKey" : null,
            |  "entityReferenceKey" : {"entityType":"sample","entityName":"TopLevelReference"},
            |  "emptyValueListKey" : {"itemsType" : "AttributeValue", "items" : []},
            |  "emptyEntityReferenceListKey" : {"itemsType" : "EntityReference", "items" : []},
            |  "valueListKey" : {"itemsType" : "AttributeValue", "items" : [ "foo", 456, false ]},
            |  "entityReferenceListKey" : {"itemsType" : "EntityReference", "items" : [
            |    {"entityType":"sample","entityName":"MySampleName"},
            |    {"entityType":"participant","entityName":"MyParticipantName"},
            |    {"entityType":"pair","entityName":"MyPairName"}
            |  ]}
            |}
        """.stripMargin.trim.replace(" ", "").replace("\n", "").replace("\r", "")

        val actual = testData.toJson.compactPrint
        // we can't test the two strings directly, because AttributeMap doesn't preserve order,
        // and therefore we don't know in which order the keys will appear. So, jump through a
        // few hoops to validate.
        assertResult(expected.length)(actual.length)
        // strip off the first and last { and }, which gives us each individual key/value pair,
        // sort, and compare the sorted results
        val expectedSubStrings = expected.substring(1, expected.length - 1).split(",").sorted
        val actualSubStrings = actual.substring(1, actual.length - 1).split(",").sorted
        assertResult(expectedSubStrings)(actualSubStrings)

      }
    }
  }

  "PlainArrayAttributeSerializer" - {
    import org.broadinstitute.dsde.rawls.model.WDLJsonSupport.attributeFormat

    // i'm only testing the complex types here because the basic types are handled in the above suite.
    // we should really do it all someday.

    "when unmarshalling from json" - {
      "should handle empty arrays" in {
        val testData =
          """
            | {"testKey" : [] }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeValueEmptyList)(attr)
      }
      "should handle arrays" in {
        val testData =
          """
            | {"testKey" : [1,2,3] }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeValueList(Seq(AttributeNumber(1), AttributeNumber(2), AttributeNumber(3))))(attr)
      }
      "should handle arrays of references as such, even though they're arrays" in {
        val testData =
          """
            | {"testKey" : [{"entityType":"sample", "entityName":"fred"}] }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeEntityReferenceList(Seq(AttributeEntityReference("sample", "fred"))))(attr)
      }
      "should treat objects as RawJson" in {
        val testData =
          """
            | {"testKey" : { "foo" : "bar" } }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeValueRawJson(JsObject(Map("foo" -> JsString("bar")))))(attr)
      }
      "should treat objects as RawJson even if they look like lists in the other serializer" in {
        val testData =
          """
            | {"testKey" : { "itemsType" : "AttributeValue", "items" : [] } }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(
          AttributeValueRawJson(
            JsObject(
              Map(
                "itemsType" -> JsString("AttributeValue"),
                "items" -> JsArray()
              )
            )
          )
        )(attr)
      }
      "should handle references as such even though they're objects" in {
        val testData =
          """
            | {"testKey" : {"entityType":"sample", "entityName":"fred"} }
          """.stripMargin
        val obj = testData.parseJson.convertTo[AttributeMap]
        val attr = obj.getOrElse(AttributeName.withDefaultNS("testKey"), fail("attr doesn't exist"))
        assertResult(AttributeEntityReference("sample", "fred"))(attr)
      }
    }

    "when marshalling to json" - {
      "should handle empty value list" in {
        val testData: AttributeMap = Map(AttributeName("ns", "name") -> AttributeValueEmptyList)
        val expected =
          """
            |{"ns:name":[]}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle value list" in {
        val testData: AttributeMap =
          Map(AttributeName("ns", "name") -> AttributeValueList(Seq(AttributeNumber(1), AttributeNumber(2))))
        val expected =
          """
            |{"ns:name":[1,2]}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle empty ref list" in {
        val testData: AttributeMap = Map(AttributeName("ns", "name") -> AttributeEntityReferenceEmptyList)
        val expected =
          """
            |{"ns:name":[]}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle ref list" in {
        val testData: AttributeMap = Map(
          AttributeName("ns", "name") -> AttributeEntityReferenceList(
            Seq(AttributeEntityReference("sample", "fred"), AttributeEntityReference("sample", "carol"))
          )
        )
        val expected =
          """
            |{"ns:name":[{"entityType":"sample", "entityName":"fred"},{"entityType":"sample", "entityName":"carol"}]}
          """.stripMargin.trim.replace(" ", "").replace("\n", "").replace("\r", "")
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle raw json of heterogeneous list" in {
        val testData: AttributeMap = Map(
          AttributeName("ns", "name") -> AttributeValueRawJson(
            JsArray(JsNumber(1), JsObject(Map("foo" -> JsString("bar"))))
          )
        )
        val expected =
          """
            |{"ns:name":[1,{"foo":"bar"}]}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
      "should handle raw json of object" in {
        val testData: AttributeMap =
          Map(AttributeName("ns", "name") -> AttributeValueRawJson(JsObject(Map("foo" -> JsString("bar")))))
        val expected =
          """
            |{"ns:name":{"foo":"bar"}}
          """.stripMargin.trim
        assertResult(expected)(testData.toJson.compactPrint)
      }
    }
  }
}


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="MessageHandlerProviderBase.cs" company="Kephas Software SRL">
//   Copyright (c) Kephas Software SRL. All rights reserved.
//   Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// <summary>
//   Implements the message handler provider base class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Kephas.Messaging.HandlerProviders
{
    using System;
    using System.Collections.Generic;
    using System.Linq;

    using Kephas.Composition;
    using Kephas.Diagnostics.Contracts;
    using Kephas.Messaging;
    using Kephas.Messaging.Composition;
    using Kephas.Services;

    /// <summary>
    /// Base class for message handler providers.
    /// </summary>
    public abstract class MessageHandlerProviderBase : IMessageHandlerProvider
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageHandlerProviderBase"/> class.
        /// </summary>
        /// <param name="messageMatchService">The message match service.</param>
        protected MessageHandlerProviderBase(IMessageMatchService messageMatchService)
        {
            Requires.NotNull(messageMatchService, nameof(messageMatchService));

            this.MessageMatchService = messageMatchService;
        }

        /// <summary>
        /// Gets the message match service.
        /// </summary>
        /// <value>
        /// The message match service.
        /// </value>
        protected IMessageMatchService MessageMatchService { get; }

        /// <summary>
        /// Indicates whether the selector can handle the indicated message type.
        /// </summary>
        /// <param name="envelopeType">The type of the envelope. This is typically the adapter type, if the message does not implement <see cref="IMessage"/>.</param>
        /// <param name="messageType">The type of the message.</param>
        /// <param name="messageId">The ID of the message.</param>
        /// <returns>
        /// True if the selector can handle the message type, false if not.
        /// </returns>
        public abstract bool CanHandle(Type envelopeType, Type messageType, object messageId);

        /// <summary>
        /// Gets a factory which retrieves the components handling messages of the given type.
        /// </summary>
        /// <param name="handlerFactories">The handler factories.</param>
        /// <param name="envelopeType">The type of the envelope. This is typically the adapter type, if
        ///                            the message does not implement <see cref="IMessage"/>.</param>
        /// <param name="messageType">The type of the message.</param>
        /// <param name="messageId">The ID of the message.</param>
        /// <returns>
        /// A factory of an enumeration of message handlers.
        /// </returns>
        public virtual Func<IEnumerable<IMessageHandler>> GetHandlersFactory(
            IEnumerable<IExportFactory<IMessageHandler, MessageHandlerMetadata>> handlerFactories,
            Type envelopeType,
            Type messageType,
            object messageId)
        {
            var orderedHandlers = this.GetOrderedMessageHandlerFactories(handlerFactories, envelopeType, messageType, messageId);
            return () => orderedHandlers.Select(f => f.CreateExportedValue()).ToList();
        }

        /// <summary>
        /// Gets the ordered message handler factories.
        /// </summary>
        /// <param name="handlerFactories">The handler factories.</param>
        /// <param name="envelopeType">The type of the envelope. This is typically the adapter type, if
        ///                            the message does not implement <see cref="IMessage"/>.</param>
        /// <param name="messageType">The type of the message.</param>
        /// <param name="messageId">The ID of the message.</param>
        /// <returns>
        /// The ordered message handler factories.
        /// </returns>
        protected virtual IList<IExportFactory<IMessageHandler, MessageHandlerMetadata>>
            GetOrderedMessageHandlerFactories(
                IEnumerable<IExportFactory<IMessageHandler, MessageHandlerMetadata>> handlerFactories,
                Type envelopeType,
                Type messageType,
                object messageId)
        {
            var orderedFactories = handlerFactories
                .Where(f => this.MessageMatchService.IsMatch(f.Metadata.MessageMatch, envelopeType, messageType, messageId))
                .Order()
                .ToList();
            return orderedFactories;
        }
    }
}


text:
/*!
 * Module dependencies.
 */
var fs = require('fs');
var path = require('path');
var util = require('util');
var events = require('events');
var assertModule = require('assert');
var CommandQueue = require('./queue.js');
var Assertion = require('./assertion.js');
var Page = require('../page-object/page.js');

module.exports = new (function() {

  var client;
  var custom_commands_path;
  var custom_assertions_path;
  var page_objects_path;
  var assertOperators = {
    ok : ['ok', 'ko'],
    equal : ['==', '!='],
    notEqual : ['!=', '=='],
    deepEqual : ['deepEqual', 'not deepEqual'],
    notDeepEqual : ['not deepEqual', 'deepEqual'],
    strictEqual : ['===', '!=='],
    notStrictEqual : ['!==', '==='],
    throws : ['throws', 'doesNotThrow'],
    doesNotThrow : ['doesNotThrow', 'throws'],
    fail : 'fail',
    ifError : 'ifError'
  };

  /////////////////////////////////////////////////////////////////////
  // Assertions
  /////////////////////////////////////////////////////////////////////
  /**
   * Extends the node.js assert module
   *
   * @param prop
   * @param abortOnFailure
   * @returns {Function}
   */
  function makeAssertion(prop, abortOnFailure) {
    return function() {
      var passed;
      var expected = null;
      var actual = null;
      var lastArgument = arguments[arguments.length-1];
      var isLastArgString = typeof lastArgument === 'string';
      var message = isLastArgString &&
        (arguments.length > 2 || typeof arguments[0] === 'boolean') &&
        lastArgument || (typeof arguments[0] === 'function' && '[Function]');

      var args = Array.prototype.slice.call(arguments, 0);

      try {
        assertModule[prop].apply(null, arguments);
        passed = true;
        message = 'Passed [' + prop + ']: ' + (message || getAssertMessage(prop, args, passed));
      } catch (ex) {
        passed = false;
        message = 'Failed [' + prop + ']: ' + ('(' + ex.message + ')' || message || getAssertMessage(prop, args, passed));
        actual = ex.actual;
        expected = ex.expected;
      }

      return Assertion.assert(passed, actual, expected, message, abortOnFailure);
    };
  }

  function getAssertMessage(prop, args, passed) {
    if (!Array.isArray(assertOperators[prop])) {
      return assertOperators[prop] || '';
    }

    var operator = passed ? assertOperators[prop][0] : assertOperators[prop][1];

    if (args.length === 2) {
      args.splice(1, 0, operator);
    } else {
      args.push(operator);
    }
    args = args.map(function(argument) {
      if (argument && typeof argument == 'object') {
        argument = util.inspect(argument);
      }
      return argument;
    });
    return args.join(' ');
  }

  /**
   * Loads the available assertions
   */
  function loadAssertions(parent) {
    parent = parent || client.api;
    parent.assert = {};
    if (client.options.start_session) {
      parent.verify = {};
    }
    for (var prop in assertModule) {
      if (assertModule.hasOwnProperty(prop)) {
        parent.assert[prop] = (function(prop) {
          return makeAssertion(prop, true);
        })(prop);
        if (client.options.start_session) {
          parent.verify[prop] = (function (prop) {
            return makeAssertion(prop, false);
          })(prop);
        }
      }
    }

    if (client.options.start_session) {
      var dirPath = path.join(__dirname, './../api/assertions/');

      loadAssertionFiles(dirPath, parent.assert, true);
      loadAssertionFiles(dirPath, parent.verify, false);
    }
  }

  /**
   * Create an instance of an assertion
   *
   * @param {string} commandName
   * @param {function} assertionFn
   * @param {boolean} abortOnFailure
   * @param {object} parent
   * @returns {AssertionInstance}
   */
  function createAssertion(commandName, assertionFn, abortOnFailure, parent) {
    var assertion;
    if (typeof assertionFn === 'object' && assertionFn.assertion) {
      assertion = Assertion.factory(assertionFn.assertion, abortOnFailure, client);
      addCommand(commandName, assertion._commandFn, assertion, parent);
      return assertion;
    }

    // backwards compatibility
    var module = loadCommandModule(assertionFn, client.api, {
      abortOnFailure : abortOnFailure
    });

    addCommand(commandName, module.command, module.context, parent);
    return assertion;
  }

  /**
   * Loads the actual assertion files.
   *
   * @param {String} dirPath
   * @param {Object} parent
   * @param {Boolean} abortOnFailure
   */
  function loadAssertionFiles(dirPath, parent, abortOnFailure) {
    var commandFiles = fs.readdirSync(dirPath);

    for (var i = 0, len = commandFiles.length; i < len; i++) {
      if (path.extname(commandFiles[i]) === '.js') {
        var commandName = path.basename(commandFiles[i], '.js');
        var assertionFn = require(path.join(dirPath, commandFiles[i]));
        createAssertion(commandName, assertionFn, abortOnFailure, parent);
      }
    }
  }

  /////////////////////////////////////////////////////////////////////
  // Commands
  /////////////////////////////////////////////////////////////////////
  /**
   * Loads selenium protocol actions
   */
  function loadProtocolActions(parent) {
    parent = parent || client.api;
    var protocol = require('./../api/protocol.js')(client);
    var actions  = Object.keys(protocol);
    actions.forEach(function(command) {
      addCommand(command, protocol[command], client.api, parent);
    });
  }

  /**
   * Loads all the composite commands defined by nightwatch
   */
  function loadAllCommands(parent) {
    loadElementCommands(parent);
    loadClientCommands(parent);
    loadCommandFiles(client.api, parent, true);
  }

  /**
   * Loads the element composite commands defined by nightwatch
   */
  function loadElementCommands(parent) {
    parent = parent || client.api;
    var elementCommands = require('./../api/element-commands.js')(client);
    var entries = Object.keys(elementCommands);
    entries.forEach(function(command) {
      addCommand(command, elementCommands[command], client.api, parent);
    });
  }

  /**
   * Loads all the client commands defined by nightwatch
   */
  function loadClientCommands(parent) {
    parent = parent || client.api;
    var clientCommands = require('./../api/client-commands.js')(client);
    var entries = Object.keys(clientCommands);
    entries.forEach(function(command) {
      addCommand(command, clientCommands[command], client.api, parent, true);
    });
  }

  /**
   * Loads the external commands
   */
  function loadCommandFiles(context, parent, shouldLoadClientCommands) {
    var relativePaths = ['./../api/element-commands/'];
    if (shouldLoadClientCommands) {
      relativePaths.push('./../api/client-commands/');
    }

    relativePaths.forEach(function(relativePath) {
      var commandFiles = fs.readdirSync(path.join(__dirname, relativePath));
      var commandName;
      var commandModule;

      for (var i = 0, len = commandFiles.length; i < len; i++) {
        var ext = path.extname(commandFiles[i]);
        commandName = path.basename(commandFiles[i], ext);
        if (ext === '.js' && commandName.substr(0, 1) !== '_') {
          commandModule = require(__dirname + relativePath + commandFiles[i]);
          var m = loadCommandModule(commandModule, context);
          addCommand(commandName, m.command, m.context, parent);
        }
      }
    });
  }

  /**
   * Loads a command module either specified as an object with a `command` method
   * or specified as a function which will be instantiated (new function() {..})
   *
   * @param {object|function} module
   * @param {object} context
   * @param {object} [addt_props]
   * @returns {{command: function, context: *}}
   */
  function loadCommandModule(module, context, addt_props, return_val) {
    var m = {command: null, context: context};

    function F() {
      if (typeof module === 'object') {
        events.EventEmitter.call(this);
      }
      if (addt_props) {
        for (var prop in addt_props) {
          if (addt_props.hasOwnProperty(prop)) {
            this[prop] = addt_props[prop];
          }
        }
      }
      this.client = client;
      this.api = client.api;
      if (typeof module === 'function') {
        module.call(this);
      }
    }

    if (typeof module === 'object' && module.command) {
      util.inherits(F, events.EventEmitter);
      F.prototype.command = function() {
        return module.command.apply(this, arguments);
      };
    } else if (typeof module === 'function') {
      F.prototype = Object.create(module.prototype);
      F.prototype.constructor = F;
    }

    m.command = function commandFn() {
      var instance = new F();
      if (typeof module === 'function') {
        context = m.context = instance;
      }
      instance.command.prototype.constructor.stackTrace = commandFn.stackTrace;
      instance.command.apply(context, arguments);
      return context;
    };

    return m;
  }

  /**
   * Loads custom commands defined by the user
   * @param {string} [dirPath]
   * @param {object} [parent]
   */
  function loadCustomCommands(dirPath, parent) {
    if (!custom_commands_path && !dirPath) {
      return;
    }

    dirPath = dirPath || custom_commands_path;
    parent = parent || client.api;

    if (Array.isArray(dirPath)) {
      dirPath.forEach(function(folder) {
        loadCustomCommands(folder, parent);
      });
      return;
    }

    var absPath = path.resolve(dirPath);
    var commandFiles = fs.readdirSync(absPath);

    commandFiles.forEach(function(file) {
      var fullPath = path.join(absPath, file);
      if (fs.lstatSync(fullPath).isDirectory()) {
        parent[file] = parent[file] || {};
        var pathFolder = path.join(dirPath, file);
        loadCustomCommands(pathFolder, parent[file]);
      } else if (path.extname(file) === '.js') {
        var commandModule = require(fullPath);
        var name = path.basename(file, '.js');

        if (!commandModule) {
          throw new Error('Module ' + file + 'should have a public method or function.');
        }

        var m = loadCommandModule(commandModule, client.api);
        addCommand(name, m.command, m.context, parent, true);
      }
    });
  }

  /**
   * Loads custom assertions, similarly to custom commands
   * @param [folder]
   */
  function loadCustomAssertions(folder, parent) {
    folder = folder || custom_assertions_path;
    parent = parent || client.api;
    if (!custom_assertions_path) {
      return;
    }

    if (Array.isArray(folder)) {
      folder.forEach(function(folderName) {
        loadCustomAssertions(folderName, parent);
      });
      return;
    }

    loadCustomAssertionFolder(folder, parent);
  }

  function loadCustomAssertionFolder(folderName, parent) {
    var absPath = path.resolve(folderName);
    loadAssertionFiles(absPath, parent.assert, true);
    loadAssertionFiles(absPath, parent.verify, false);
  }

  function loadExpectAssertions(parent) {
    parent = parent || client.api;
    var Expect = require('../api/expect.js')(client);
    var assertions  = Object.keys(Expect);

    try {
      var chaiExpect = module.require('chai').expect;
      parent.expect = function() {
        return chaiExpect.apply(chaiExpect, arguments);
      };
    } catch (err) {
      parent.expect = {};
    }

    assertions.forEach(function(assertion) {
      parent.expect[assertion] = function() {
        var args = Array.prototype.slice.call(arguments);
        var command = Expect[assertion].apply(parent, args);

        function F(element) {
          events.EventEmitter.call(this);
          this.client = client;
          this.element = element;
        }
        util.inherits(F, events.EventEmitter);
        F.prototype.command = function commandFn() {
          this.element._stackTrace = commandFn.stackTrace;
          this.element.locate(this);
          return this;
        };

        var instance = new F(command.element);
        var err = new Error;
        Error.captureStackTrace(err, arguments.callee);
        CommandQueue.add(assertion, instance.command, instance, [], err.stack);

        return command.expect;
      };
    });
  }

  /**
   * Loads page object files
   * @param {string} [dirPath]
   */
  function loadPageObjects(dirPath, parent) {
    if (!page_objects_path && !dirPath) {
      return;
    }

    dirPath = dirPath || page_objects_path;
    client.api.page = client.api.page || {};
    parent = parent || client.api.page;

    if (Array.isArray(dirPath)) {
      dirPath.forEach(function(folder) {
        loadPageObjects(folder);
      });
      return;
    }

    var absPath = path.resolve(dirPath);
    var pageFiles = fs.readdirSync(absPath);

    pageFiles.forEach(function(file) {
      var fullPath = path.join(absPath, file);
      if (fs.lstatSync(fullPath).isDirectory()) {
        parent[file] = parent[file] || {};
        var pathFolder = path.join(dirPath, file);
        loadPageObjects(pathFolder, parent[file]);
      } else if (path.extname(file) === '.js') {
        var pageName = path.basename(file, '.js');
        var pageFnOrObject = require(path.join(absPath, file));
        addPageObject(pageName, pageFnOrObject, client.api, parent);
      }
    });
  }

  /**
   * Instantiates the page object class
   * @param {String} name
   * @param {Object} pageFnOrObject
   * @param {Object} context
   * @param {Object} parent
   */
  function addPageObject(name, pageFnOrObject, context, parent) {
    parent[name] = function() {
      var args = Array.prototype.slice.call(arguments);
      args.unshift(context);

      if (useEnhancedModel(pageFnOrObject)) {
        var loadOntoPageObject = function(parent) {
          if (client.options.start_session) {
            loadElementCommands(parent);
            loadCommandFiles(client.api, parent, false);
            loadExpectAssertions(parent);
            // Alias
            parent.expect.section = parent.expect.element;
          }
          loadAssertions(parent);
          loadCustomCommands(null, parent);
          loadCustomAssertions(null, parent);
          return parent;
        };
        pageFnOrObject.name = name;
        return new Page(pageFnOrObject, loadOntoPageObject, context, client);
      }

      return new (function() {
        if (typeof pageFnOrObject == 'function') {
          return createPageObject(pageFnOrObject, args);
        }

        return pageFnOrObject;
      })();
    };
  }

  function useEnhancedModel(pageFnOrObject) {
    return typeof pageFnOrObject == 'object' && (pageFnOrObject.elements || pageFnOrObject.sections);
  }

  /**
   *
   * @param pageFnOrObject
   * @param args
   * @returns {Object}
   */
  function createPageObject(pageFnOrObject, args) {
    function PageObject() {
      return pageFnOrObject.apply(this, args);
    }
    PageObject.prototype = pageFnOrObject.prototype;
    return new PageObject();
  }

  /**
   * Adds a command/assertion to the queue.
   *
   * @param {String} name
   * @param {Object} command
   * @param {Object} context
   * @param {Object} [parent]
   */
  function addCommand(name, command, context, parent) {
    parent = parent || client.api;
    if (parent[name]) {
      client.results.errors++;
      var error = new Error('The command "' + name + '" is already defined!');
      client.errors.push(error.stack);
      throw error;
    }
    parent[name] = function commandFn() {
      var args = Array.prototype.slice.call(arguments);

      var originalStackTrace;
      if (commandFn.stackTrace) {
        originalStackTrace = commandFn.stackTrace;
      } else {
        var err = new Error;
        Error.captureStackTrace(err, arguments.callee);
        originalStackTrace = err.stack;
      }

      CommandQueue.add(name, command, context, args, originalStackTrace);
      return client.api; // for chaining
    };
  }

  /**
   * Initialize the api
   *
   * @param {Object} c The nightwatch client instance
   * @api public
   */
  this.init = function(c) {
    client = c;
    custom_commands_path = c.options.custom_commands_path;
    custom_assertions_path = c.options.custom_assertions_path;
    page_objects_path = c.options.page_objects_path;
    return this;
  };

  /**
   * Loads everything
   */
  this.load = function() {
    if (client.options.start_session) {
      loadProtocolActions();
      loadAllCommands();
      loadPageObjects();
      loadExpectAssertions();
    }
    loadAssertions();
    loadCustomCommands();
    loadCustomAssertions();
    return this;
  };

  this.addCommand = addCommand;
  this.loadCustomCommands = loadCustomCommands;
  this.loadCustomAssertions = loadCustomAssertions;
  this.loadPageObjects = loadPageObjects;
  this.createAssertion = createAssertion;
})();


text:
<?php

  namespace osCommerce\OM\Core\Site\Shop\Application\Account\Action\Create;

  use osCommerce\OM\Core\ApplicationAbstract;
  use osCommerce\OM\Core\OSCOM;

  class Success {
    public static function execute(ApplicationAbstract $application) {
      $application->setPageTitle(OSCOM::getDef('create_account_success_heading'));
      $application->setPageContent('create_success.php');
    }
  }
?>


text:
The game [Scrabble](https://en.wikipedia.org/wiki/Scrabble).

## Download and Install
Download the program specific to your OS from [here](https://github.com/Lord-of-the-Galaxy/Scrabble/releases/tag/latest), extract the .zip file and run Scrabble.exe.

I'll be writing an installer for Scrabble once the project itself reaches a stable state.

## Bugs?
This project is in its early developmental stage, so bugs are sure to exist. Please report bugs [here](https://github.com/Lord-of-the-Galaxy/Scrabble/issues).

## Processing
This game has been built using [Processing](https://processing.org/), a flexible software sketchbook and a language for learning how to code within the context of the visual arts. (SRC - [processing.org](https://processing.org/))


text:
<?php

namespace DreamCommerce\Resource;

use DreamCommerce\Resource;
use DreamCommerce\Exception;

/**
 * Resource Delivery
 *
 * @package DreamCommerce\Resource
 * @link https://developers.shoper.pl/developers/api/resources/gauges
 */
class Gauge extends Resource
{
    protected $name = 'gauges';

    /**
     * {@inheritdoc}
     */
    public function post($data)
    {
        throw new Exception('Specified method is not supported');
    }

    /**
     * {@inheritdoc}
     */
    public function put($id = null, $data = array())
    {
        throw new Exception('Specified method is not supported');
    }

    /**
     * {@inheritdoc}
     */
    public function delete($id = null)
    {
        throw new Exception('Specified method is not supported');
    }
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="author" content="Chunshan" />
        <meta name="copyright" content="Chunshan" />

        <meta property="og:type" content="article" />
        <meta name="twitter:card" content="summary">
        <title>Page not found · MRI Q&A
</title>
        <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
        <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.1/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="https://chunshan.github.io/MRI-QA/theme/css/style.min.css?edf95c30">
        <link rel="shortcut icon" href="https://chunshan.github.io/MRI-QA/theme/images/favicon.ico" type="image/x-icon" type="image/png" />
        <link rel="icon" href="https://chunshan.github.io/MRI-QA/theme/images/apple-touch-icon-152x152.png" type="image/png" />
        <link rel="apple-touch-icon" href="https://chunshan.github.io/MRI-QA/theme/images/apple-touch-icon.png"  type="image/png" />
        <link rel="apple-touch-icon" sizes="57x57" href="https://chunshan.github.io/MRI-QA/theme/images/apple-touch-icon-57x57.png" type="image/png" />
        <link rel="apple-touch-icon" sizes="72x72" href="https://chunshan.github.io/MRI-QA/theme/images/apple-touch-icon-72x72.png" type="image/png" />
        <link rel="apple-touch-icon" sizes="76x76" href="https://chunshan.github.io/MRI-QA/theme/images/apple-touch-icon-76x76.png" type="image/png" />
        <link rel="apple-touch-icon" sizes="114x114" href="https://chunshan.github.io/MRI-QA/theme/images/apple-touch-icon-114x114.png" type="image/png" />
        <link rel="apple-touch-icon" sizes="120x120" href="https://chunshan.github.io/MRI-QA/theme/images/apple-touch-icon-120x120.png" type="image/png" />
        <link rel="apple-touch-icon" sizes="144x144" href="https://chunshan.github.io/MRI-QA/theme/images/apple-touch-icon-144x144.png" type="image/png" />
        <link rel="apple-touch-icon" sizes="152x152" href="https://chunshan.github.io/MRI-QA/theme/images/apple-touch-icon-152x152.png" type="image/png" />
        <link href="https://chunshan.github.io/MRI-QA/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="MRI Q&A - Full Atom Feed" />

                    MRI Q&A

Home

About

Categories

Tags

Archives

<form class="navbar-search" action="https://chunshan.github.io/MRI-QA/search.html" onsubmit="return validateForm(this.elements['q'].value);"> <input type="text" class="search-query" placeholder="Search" name="q" id="tipue_search_input"></form>

That page doesn't exist!

Sorry, but the page you are looking for cannot be found. It seems that the page you were trying to reach doesn't exist, or may be it has just moved, or it no longer exists.

The best thing to do is to use the search form or start again from the home page.

            <form action="https://chunshan.github.io/MRI-QA/search.html" onsubmit="return validateForm(this.elements['q'].value)">
                <input type="text" class="span12" placeholder="Search" name="q" id="tipue_search_input_404">
                <button class="btn" type="submit">Search</button>
            </form>

Powered by Pelican. Theme: Elegant by Talha Mansoor


text:
var express = require('express')

var Document = require('node-document');
var API = require('../');

var Post = Document('Post');

Post.api = API({route: '/api'});

var app = express();

app
  .use(Post.api)
  .use(function(req, res) {
    res.end("Hello world!");
  });

app.listen(3000, function() {
  console.log('[node-document-api/examples/express-example.js]: Listening on port %s', 3000);
});


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="xsl/rules.xsl" type="text/xsl"?>
<jcsc version="__0.96__" date="2004-01-21 13:11:33">
   <rules>
      <rule name="CtorJavaDocPackage" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>4</severity>
      </rule>
      <rule name="MaxNumberOfNCSSPerConstructor" category="Metrics" enabled="true">
         <type>integer</type>
         <value>25</value>
         <severity>4</severity>
      </rule>
      <rule name="FieldJavaDocPackage" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>4</severity>
      </rule>
      <rule name="AllowedComplexLoopExpression" category="General" enabled="true">
         <type>regexp</type>
         <value>has(Next|More(Elements|Tokens))</value>
         <severity>3</severity>
      </rule>
      <rule name="MethodDeclarationReturn" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="CtorJavaDocProtected" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="IFPacRegExp" category="Field" enabled="false">
         <type>regexp</type>
         <value>m[A-Z0-9][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="CMetPubRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="FMetProRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="ClassNameRegExp" category="General" enabled="true">
         <type>regexp</type>
         <value>[A-Z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="CtorDeclarationThrows" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="MethodJavaDocProtected" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="IFPriRegExp" category="Field" enabled="false">
         <type>regexp</type>
         <value>m[A-Z0-9][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="LineLength" category="General" enabled="true">
         <type>integer</type>
         <value>115</value>
         <severity>3</severity>
      </rule>
      <rule name="SpaceAfterStatementKeyword" category="General" enabled="false">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>

      <rule name="EmptyFinallyBlockAllowed" category="General" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>5</severity>
      </rule>
      <rule name="LVRegExp" category="Field" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="MaxNumberOfCCNPerMethod" category="Metrics" enabled="true">
         <type>integer</type>
         <value>5</value>
         <severity>4</severity>
      </rule>
      <rule name="NestedTypeBlockPlaceRule" category="General" enabled="true">
         <type>multichoice</type>
         <choices>
            <choice>Beginning of Class</choice>
            <choice>End of Class</choice>
         </choices>
         <value>End of Class</value>
         <severity>3</severity>
      </rule>
      <rule name="IMetPriRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="AllowDotStarImport" category="General" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>3</severity>
      </rule>
      <rule name="MethodJavaDocPackage" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>4</severity>
      </rule>
      <rule name="TypeHeaderExpression" category="General" enabled="false">
         <type>regexp-multiline</type>
         <value>/\*
 \* Copyright \(C\) 1999-2005 Ralph Jocham
 \* This program is free software; you can redistribute it and/or
 \* modify it under the terms of the GNU General Public License
 \* as published by the Free Software Foundation; either version 2
 \* of the License, or \(at your option\) any later version\.
 \* *
 \* This program is distributed in the hope that it will be useful,
 \* but WITHOUT ANY WARRANTY; without even the implied warranty of
 \* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\.  See the
 \* GNU General Public License for more details\.
 \* *
 \* You should have received a copy of the GNU General Public License
 \* along with this program; if not, write to the Free Software
 \* Foundation, Inc\., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA\.
 \*/</value>
         <severity>3</severity>
      </rule>
      <rule name="CFPriRegExp" category="Field" enabled="true">
         <type>regexp</type>
         <value>s[A-Z0-9][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="FieldJavaDocPublic" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="FCMetProRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="FCMetPriRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="TypeDeclarationVersion" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="ConditionalExpression" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="FCFPacRegExp" category="Field" enabled="true">
         <type>regexp</type>
         <value>[A-Z][A-Z0-9_]*</value>
         <severity>3</severity>
      </rule>
      <rule name="SwitchRequiresDefault" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="FieldJavaDocProtected" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="FinParaRegExp" category="Method" enabled="false">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="FCFPriRegExp" category="Field" enabled="true">
         <type>regexp</type>
         <value>[A-Z][A-Z0-9_]*</value>
         <severity>3</severity>
      </rule>
      <rule name="FMetPubRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="FCFPubRegExp" category="Field" enabled="true">
         <type>regexp</type>
         <value>[A-Z][A-Z0-9_]*</value>
         <severity>3</severity>
      </rule>
      <rule name="MethodBlockPlaceRule" category="Method" enabled="false">
         <type>multichoice</type>
         <choices>
            <choice>Method Block Before Field Block</choice>
            <choice>Method Block After Field Block</choice>
         </choices>
         <value>Method Block After Field Block</value>
         <severity>3</severity>
      </rule>
      <rule name="OnlyThrowSubclassedException" category="Method" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="LabelNameRegExp" category="General" enabled="true">
         <type>regexp</type>
         <value>[A-Z][A-Z0-9_]*</value>
         <severity>3</severity>
      </rule>
      <rule name="PackageNameRegExp" category="General" enabled="true">
         <type>regexp</type>
         <value>[a-z0-9.]+</value>
         <severity>3</severity>
      </rule>
      <rule name="OnlyCapitalLForLong" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="MethodDeclarationModifierOrder" category="Method" enabled="false">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="IFPubRegExp" category="Field" enabled="false">
         <type>regexp</type>
         <value>m[A-Z0-9][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="FieldOrderRule" category="Field" enabled="false">
         <type>multichoice</type>
         <choices>
            <choice>No Order</choice>
            <choice>Pub->Pro->Pac->Pri</choice>
            <choice>Pri->Pac->Pro->Pub</choice>
            <choice>Static Final->Static->Inst</choice>
         </choices>
         <value>Static Final->Static->Inst</value>
         <severity>3</severity>
      </rule>
      <rule name="FieldDeclarationModifierOrder" category="Field" enabled="false">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="FMetPacRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="FCMetPubRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="CtorJavaDocPrivate" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>4</severity>
      </rule>
      <rule name="CMetPacRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="EmptyCatchBlockAllowed" category="General" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>5</severity>
      </rule>
      <rule name="CFPacRegExp" category="Field" enabled="true">
         <type>regexp</type>
         <value>s[A-Z0-9][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="RegExpPrefixForMethodReturingBoolean" category="Method" enabled="false">
         <type>regexp</type>
         <value>(accept|is|has|are|assert|shall|boolean).*</value>
         <severity>3</severity>
      </rule>
      <rule name="IFProRegExp" category="Field" enabled="false">
         <type>regexp</type>
         <value>m[A-Z0-9][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="StringLiteralAllowed" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>2</severity>
      </rule>
      <rule name="TabsAllowed" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="CFProRegExp" category="Field" enabled="true">
         <type>regexp</type>
         <value>s[A-Z0-9][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="FCFProRegExp" category="Field" enabled="true">
         <type>regexp</type>
         <value>[A-Z][A-Z0-9_]*</value>
         <severity>3</severity>
      </rule>
      <rule name="AnonymousClassMethodJavaDoc" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>4</severity>
      </rule>
      <rule name="ApplyJavaDocRulesInInnerClasses" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>3</severity>
      </rule>
      <rule name="ParaRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="MaxNumberOfCCNPerConstructor" category="Metrics" enabled="true">
         <type>integer</type>
         <value>5</value>
         <severity>4</severity>
      </rule>
      <rule name="FMetPriRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="AllowPublicField" category="Field" enabled="false">
         <type>boolean</type>
         <value>false</value>
         <severity>5</severity>
      </rule>
      <rule name="OpenBraceNewLine" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="CMetPriRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="UnitTestsRegExp" category="Unittest" enabled="true">
         <type>regexp</type>
         <value>test[\w\d]+</value>
         <severity>3</severity>
      </rule>
      <rule name="OnlyOneFieldDeclarationPerLine" category="Field" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="IMetProRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="IMetPubRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="AbstractClassNameRegExp" category="General" enabled="true">
         <type>regexp</type>
         <value>[A-Z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="CtorDeclarationParam" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="MethodOrderRule" category="Method" enabled="false">
         <type>multichoice</type>
         <choices>
            <choice>No Order</choice>
            <choice>Pub->Pro->Pac->Pri</choice>
            <choice>Pri->Pac->Pro->Pub</choice>
            <choice>Ctor->Inst->Static</choice>
            <choice>Ctor->Static->Inst</choice>
            <choice>Static Final->Static->Inst</choice>
         </choices>
         <value>Static Final->Static->Inst</value>
         <severity>3</severity>
      </rule>
      <rule name="MethodDeclarationParam" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="OnlySubclassedCatchBlock" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="IMetPacRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="InterfaceCheckAbstract" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="MethodDeclarationThrows" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="BracesAroundSingleLineStatement" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="EmptyStringLiteralAllowed" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="FieldBlockPlaceRule" category="Field" enabled="false">
         <type>multichoice</type>
         <choices>
            <choice>Field Block Before Method Block</choice>
            <choice>Field Block After Method Block</choice>
         </choices>
         <value>Field Block Before Method Block</value>
         <severity>3</severity>
      </rule>
      <rule name="FCMetPacRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="CFPubRegExp" category="Field" enabled="true">
         <type>regexp</type>
         <value>s[A-Z0-9][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="DontReturnTypeHashtable" category="Method" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="MethodJavaDocPublic" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="MaxNumberOfArgumentsPerConstructor" category="General" enabled="true">
         <type>integer</type>
         <value>5</value>
         <severity>3</severity>
      </rule>
      <rule name="FieldJavaDocPrivate" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>4</severity>
      </rule>
      <rule name="InterfaceNameRegExp" category="General" enabled="true">
         <type>regexp</type>
         <value>[A-Z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="TypeDeclarationAuthor" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="DontReturnTypeVector" category="Method" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="AllowPackageField" category="Field" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="CMetProRegExp" category="Method" enabled="true">
         <type>regexp</type>
         <value>[a-z][\w\d]*</value>
         <severity>3</severity>
      </rule>
      <rule name="TypeDeclarationModifierOrder" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="JavaDocTagOrder" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="AssignmentInConditionalExpression" category="General" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>3</severity>
      </rule>
      <rule name="MaxNumberOfArgumentsPerMethod" category="Method" enabled="true">
         <type>integer</type>
         <value>5</value>
         <severity>3</severity>
      </rule>
      <rule name="AllowProtectedField" category="Field" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="CheckArrayAtType" category="Field" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="NestedTypeDeclarationModifierOrder" category="General" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>3</severity>
      </rule>
      <rule name="MethodVoidNoReturn" category="JavaDoc" enabled="false">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="UnitTestClassRegExp" category="Unittest" enabled="true">
         <type>regexp</type>
         <value>((junit.framework.)?TestCase)|SorterTestCase</value>
         <severity>3</severity>
      </rule>
      <rule name="MethodJavaDocPrivate" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>4</severity>
      </rule>
      <rule name="SemicolonAfterTypeDeclaration" category="General" enabled="true">
         <type>boolean</type>
         <value>false</value>
         <severity>3</severity>
      </rule>
      <rule name="CtorJavaDocPublic" category="JavaDoc" enabled="true">
         <type>boolean</type>
         <value>true</value>
         <severity>4</severity>
      </rule>
      <rule name="MaxNumberOfNCSSPerMethod" category="Metrics" enabled="true">
         <type>integer</type>
         <value>30</value>
         <severity>4</severity>
      </rule>
   </rules>
</jcsc>


text:
package eu.openg.aws.sns.internal;

import com.amazonaws.services.sns.model.InvalidParameterException;
import com.amazonaws.services.sns.model.NotFoundException;
import org.assertj.core.api.AWSThrowableAssert;
import org.assertj.core.api.ThrowableAssert;
import org.junit.Test;

import static com.amazonaws.AmazonServiceException.ErrorType.Client;
import static org.assertj.core.api.AWSThrowableAssert.assertThatThrownBy;
import static org.assertj.core.api.Assertions.assertThat;

public class AmazonSNSFakePublishTest extends AbstractSNSFakeTest {

    @Test
    public void publishPlainTopicName() {
        assertSNSParamThrownBy(() -> sns.publish("test", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn Reason: test does not start with arn");
    }

    @Test
    public void publishWithOnlyArnPrefix() {
        assertSNSParamThrownBy(() -> sns.publish("arn", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn");
    }

    @Test
    public void publishWithInvalidArnProvider() {
        assertSNSParamThrownBy(() -> sns.publish("arn:test", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn Reason: arn:test has invalid partition test");
        assertSNSParamThrownBy(() -> sns.publish("arn:test123", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn Reason: arn:test123 has invalid partition test123");
        assertSNSParamThrownBy(() -> sns.publish("arn:Tst123Tst", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn Reason: arn:Tst123Tst has invalid partition Tst123Tst");
    }

    @Test
    public void publishWithOnlyArnPrefixAndProvider() {
        assertSNSParamThrownBy(() -> sns.publish("arn:aws", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn");
    }

    @Test
    public void publishWithInvalidService() {
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:a", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn Reason: a does not conform to the ARN specification");
    }

    @Test
    public void publishWithPrefixProviderAndService() {
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:ab", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn");
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:ab:", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn");
    }

    @Test
    public void publishWithInvalidRegion() {
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:ab:a", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn Reason: a does not conform to the ARN specification");
    }

    @Test
    public void publishWithPrefixProviderServiceAndRegion() {
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:ab:ab", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn");
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:ab:", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn");
    }

    @Test
    public void publishWithInvalidUID() {
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:ab:ab:a", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn Reason: a does not conform to the ARN specification");
    }

    @Test
    public void publishWithPrefixProviderServiceRegionAndUID() {
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:ab:ab:ab", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn");
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:ab:ab:ab:", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn");
    }

    @Test
    public void publishWithNonExistentAccountId() {
        assertSNSThrownBy(() -> sns.publish("arn:aws:sns:us-east-1:ab:a", "message"))
                .hasErrorCode("InvalidClientTokenId")
                .hasErrorMessage("No account found for the given parameters")
                .hasStatusCode(403);
    }

    @Test
    public void publishWithoutATopic() {
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:sns:us-east-1:12345", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn");
        assertSNSParamThrownBy(() -> sns.publish("arn:aws:sns:us-east-1:12345:", "message"))
                .hasErrorMessage("Invalid parameter: TopicArn");
    }

    @Test
    public void publishToNonExistentTopic() {
        assertSNSThrownBy(() -> sns.publish("arn:aws:sns:us-east-1:12345:a", "message"))
                .isInstanceOf(NotFoundException.class)
                .hasErrorCode("NotFound")
                .hasErrorMessage("Topic does not exist")
                .hasStatusCode(404);
    }

    @Test
    public void publishToACreatedTopic() {
        assertThat(sns.publish(sns.createTopic("test").getTopicArn(), "message").getMessageId()).isNotNull();
        sns = new AmazonSNSFake("54321");
        assertThat(sns.publish(sns.createTopic("test").getTopicArn(), "message").getMessageId()).isNotEmpty();
    }

    private static AWSThrowableAssert assertSNSParamThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable) {
        return assertSNSThrownBy(shouldRaiseThrowable)
                .isInstanceOf(InvalidParameterException.class)
                .hasErrorCode("InvalidParameter")
                .hasStatusCode(400);
    }

    private static AWSThrowableAssert assertSNSThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable) {
        return assertThatThrownBy(shouldRaiseThrowable)
                .hasRequestId()
                .hasServiceName("AmazonSNS")
                .hasErrorType(Client);
    }
}


text:
import Vue from 'vue'
import Button from  './button'

Vue.component('g-button', Button)

new Vue({
    el:'#app',
    data:{
        'message':'hi'
    }
})