<commit_before>{ EventEmitter } = require('events')
ltx = require('ltx')
should = require('should')

server = require('../lib/server')
NS = require('../lib/xmpp/ns')

# Useful namespaces
NS.ATOM = "http://www.w3.org/2005/Atom"
NS.AS   = "http://activitystrea.ms/spec/1.0/"
NS.THR  = "http://purl.org/syndication/thread/1.0"

exports.NS = NS

class ErrorStanza extends Error
    constructor: (@stanza) ->
        @message = "ErrorStanza: #{@stanza.toString()}"

# Fake XMPP server used to test the buddycloud server
class exports.TestServer extends EventEmitter
    # @property [Object] Info and items discoverable by the buddycloud server.
    disco: {
        info:
            "<EMAIL>":      { identities: [], features: [] }
            "<EMAIL>":  { identities: [], features: [] }
            "<EMAIL>":    { identities: [], features: [] }
            "<EMAIL>": { identities: [], features: [] }
            "<EMAIL>":          { identities: [], features: [] }
            "<EMAIL>":            { identities: [], features: [] }
            "<EMAIL>":            { identities: [], features: [] }
            "<EMAIL>":    { identities: [], features: [] }
            "<EMAIL>":     { identities: [], features: [] }
            "<EMAIL>":       { identities: [], features: [] }
        items:
            "example.org":   [{jid: "buddycloud.example.org"}]
            "enterprise.sf": [{jid: "buddycloud.example.org"}]
            "ds9.sf":        [{jid: "buddycloud.ds9.sf"}]
            "voyager.sf":    [{jid: "buddycloud.voyager.sf"}]
    }

    # Construct a new test server with a configuration suitable for unit
    # testing.
    constructor: ->
        @config =
            modelBackend: "postgres"
            modelConfig:
                host: "localhost"
                port: 5432
                database: "buddycloud-server-test"
                user: "buddycloud-server-test"
                password: "<PASSWORD>"
                poolSize: 4<commit_msg>Test server: disco info for "remote" servers<commit_after>{ EventEmitter } = require('events')
ltx = require('ltx')
should = require('should')

server = require('../lib/server')
NS = require('../lib/xmpp/ns')

# Useful namespaces
NS.ATOM = "http://www.w3.org/2005/Atom"
NS.AS   = "http://activitystrea.ms/spec/1.0/"
NS.THR  = "http://purl.org/syndication/thread/1.0"

exports.NS = NS

class ErrorStanza extends Error
    constructor: (@stanza) ->
        @message = "ErrorStanza: #{@stanza.toString()}"

# Fake XMPP server used to test the buddycloud server
class exports.TestServer extends EventEmitter
    # @property [Object] Info and items discoverable by the buddycloud server.
    serverInfo =
        identities: [
            { category: "pubsub", type: "service" },
            { category: "pubsub", type: "channels" },
            { category: "pubsub", type: "inbox" }
        ]
        features: []
    disco: {
        info:
            "<EMAIL>":      { identities: [], features: [] }
            "<EMAIL>":  { identities: [], features: [] }
            "<EMAIL>":    { identities: [], features: [] }
            "<EMAIL>": { identities: [], features: [] }
            "<EMAIL>":          { identities: [], features: [] }
            "<EMAIL>":            { identities: [], features: [] }
            "<EMAIL>":            { identities: [], features: [] }
            "<EMAIL>":    { identities: [], features: [] }
            "<EMAIL>":     { identities: [], features: [] }
            "<EMAIL>":       { identities: [], features: [] }
            "buddycloud.ds9.sf":     serverInfo
            "buddycloud.voyager.sf": serverInfo
        items:
            "example.org":   [{jid: "buddycloud.example.org"}]
            "enterprise.sf": [{jid: "buddycloud.example.org"}]
            "ds9.sf":        [{jid: "buddycloud.ds9.sf"}]
            "voyager.sf":    [{jid: "buddycloud.voyager.sf"}]
    }

    # Construct a new test server with a configuration suitable for unit
    # testing.
    constructor: ->
        @config =
            modelBackend: "postgres"
            modelConfig:
                host: "localhost"
                port: 5432
                database: "buddycloud-server-test"
                user: "buddycloud-server-test"
                password: "<PASSWORD>"
                poolSize: 4
{'fraction_non_alphanumeric': 0.16534883720930232, 'fraction_numerical': 0.007674418604651163, 'mean_word_length': 1.9458904109589041, 'pattern_counts': {'":': 30, '<': 25, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4518684', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1297, 'n_words': 278}