text:
/**
 * Test a simple binding with two modules and complex data
 */
Aria.classDefinition({
    $classpath : "test.aria.pageEngine.siteRootModule.ModelBindingTestThree",
    $extends : "test.aria.pageEngine.siteRootModule.SiteRootModuleBaseTestCase",
    $prototype : {
        testAsyncMultipleBinding : function () {
            this._createSiteModule({
                appData : {
                    baseFacts : {
                        one : 1,
                        two : 2
                    },
                    testArray : ["0", "1"]
                },
                cb : {
                    fn : this._loadSubmodules,
                    scope : this
                }
            });

        },

        _loadSubmodules : function (res) {
            var moduleConf = {
                page : [{
                            refpath : "m1",
                            classpath : "test.aria.pageEngine.testContents.modules.BoundModule1",
                            initArgs : {
                                first : false
                            },
                            bind : {
                                "first" : "appData:baseFacts.first",
                                "third" : "appData:testArray"
                            }
                        }],
                common : [{
                            refpath : "m1",
                            classpath : "test.aria.pageEngine.testContents.modules.BoundModule2",
                            bind : {
                                "first" : "appData:baseFacts",
                                "third" : "appData:testArray[1]"
                            }
                        }]
            };

            this.rm.loadModules(this.pageId, moduleConf, {
                fn : this._assertDataStructure,
                scope : this
            });
        },

        _assertDataStructure : function () {
            var expectedStorage = {
                appData : {
                    baseFacts : {
                        one : 1,
                        two : 2
                    },
                    testArray : ["0", "1"]
                },
                pageData : {}
            };
            var realStorage = this.$json.removeMetadata(this.rm.getData().storage);
            this.assertJsonEquals(realStorage, expectedStorage);

            // check m1
            var expectedModuleData = {
                first : undefined,
                newValue : false,
                third : ["0", "1"]
            };
            var realModuleData = this._getModuleData("m1", false);
            this.assertJsonEquals(expectedModuleData, realModuleData);

            // check common:m1
            expectedModuleData = {
                first : {
                    one : 1,
                    two : 2
                },
                third : "1"
            };
            realModuleData = this._getModuleData("common:m1", false);
            this.assertJsonEquals(expectedModuleData, realModuleData);

            this._checkSimpleBindings();
        },

        _checkSimpleBindings : function () {
            // change a bound value
            this.$json.setValue(this._getModuleData("m1", true), "first", "new");
            this.assertEquals(this.rm.getData().storage.appData.baseFacts.first, "new", "baseFacts.first not updated");
            this.assertEquals(this._getModuleData("common:m1", false).first.first, "new");
            this._checkAppDataChange();
        },
        _checkAppDataChange : function () {
            // change a value directly in the app data
            this.$json.setValue(this.rm.getData().storage.appData, "baseFacts", "notAnObject");
            var expectedModuleData = {
                first : undefined,
                newValue : false,
                third : ["0", "1"]
            };
            var realModuleData = this._getModuleData("m1", false);
            this.assertJsonEquals(expectedModuleData, realModuleData);

            expectedModuleData = {
                first : "notAnObject",
                third : "1"
            };
            realModuleData = this._getModuleData("common:m1", false);
            this.assertJsonEquals(expectedModuleData, realModuleData);
            this._checkObjectChange();
        },

        _checkObjectChange : function () {
            var baseFacts = {
                first : "1",
                second : "2",
                third : "3"
            };
            this.$json.setValue(this._getModuleData("common:m1", true), "first", baseFacts);
            this.assertJsonEquals(this.$json.removeMetadata(this.rm.getData()).storage.appData.baseFacts, baseFacts);
            this.assertEquals(this._getModuleData("m1", false).first, "1");
            this._checkArrayChange();
        },

        _checkArrayChange : function () {
            this.$json.setValue(this._getModuleData("common:m1", true), "third", "2");
            this.assertJsonEquals(this.$json.removeMetadata(this.rm.getData()).storage.appData.testArray, ["0", "2"]);
            this.assertEquals(this._getModuleData("m1", false).third[1], "2");

            this.$json.setValue(this._getModuleData("m1", true), "third", ["0"]);
            this.assertJsonEquals(this.$json.removeMetadata(this.rm.getData()).storage.appData.testArray, ["0"]);
            this.assertEquals(this._getModuleData("common:m1", false).third, undefined);

            this.completeTest();
        }
    }
});


text:
using System;
using Treehopper;
using Treehopper.Libraries; // Provides SevenSegSPI
using Treehopper.WPF.Message;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using AE.Net.Mail;
using System.Windows.Controls;

namespace InboxUnreadCount
{
    public class InboxUnreadCountViewModel : ViewModelBase
    {
        TreehopperUsb board;
        SevenSegSpi display;
        System.Timers.Timer timer;
        public InboxUnreadCountViewModel()
        {
            // Register a message handler so as soon as we're connected we setup the app
            Messenger.Default.Register<BoardConnectedMessage>(this, (response) => SetupApp(response.Board));

            // and when they disconnect, we should stop the app
            Messenger.Default.Register<BoardDisconnectedMessage>(this, (response) => StopRunning());

            // Initialize our SavePasswordCommand relay agent.
            StartAppCommand = new RelayCommand<PasswordBox>(i => StartAppExecute(i), CanStartApp);

            StartAppBtnName = "Start App";

            // Initialize the timer events. We won't start the timer until a board is connected.
            timer = new System.Timers.Timer(60000);
            timer.Elapsed += timer_Elapsed;
        }

        // This is where all the magic happens.
        void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            StatusBarText = "Connecting to server...";
            try
            {
                ImapClient ic = new ImapClient(ServerName, Username, Password, AuthMethods.Login, 993, true);
                ic.SelectMailbox("INBOX");
                Lazy<MailMessage>[] messages = ic.SearchMessages(SearchCondition.Unseen(), true, false);
                display.printNumber(messages.Length);
                StatusBarText = "Number of unread messages: " + messages.Length;
                ic.Disconnect();
                ic.Dispose();
            }
            catch (Exception ex)
            {
                StatusBarText = ex.Message;
                StopRunning();
            }
        }

        private bool appRunning;

        public bool AppRunning
        {
            get { return appRunning; }
            set { appRunning = value; }
        }

        // These are public properties the UI will bind to.
        private string statusBarText;
        public string StatusBarText
        {
            get { return statusBarText; }
            set { statusBarText = value; RaisePropertyChanged("StatusBarText");  }
        }

        private string username;

        public string Username
        {
            get { return username; }
            set { username = value; StartAppCommand.RaiseCanExecuteChanged(); }
        }

        public string Password { get; set; }

        private string serverName;

        public string ServerName
        {
            get { return serverName; }
            set { serverName = value; StartAppCommand.RaiseCanExecuteChanged(); }
        }

        private string startAppBtnName;
        public string StartAppBtnName
        {
            get { return startAppBtnName; }
            set { startAppBtnName = value; RaisePropertyChanged("StartAppBtnName"); }
        }

        private bool isConnected;

        public bool IsConnected
        {
            get { return isConnected; }
            set { isConnected = value; RaisePropertyChanged("IsConnected"); } //  StartAppCommand.RaiseCanExecuteChanged();
        }

        // We can't directly bind to the Password box (for stupid reasons), so we have to have a "Save" command which retrieves the password directly
        public RelayCommand<PasswordBox> StartAppCommand { get; set; }

        private bool CanStartApp(PasswordBox arg)
        {
            return IsConnected && (ServerName.Length > 0) && (Username?.Length > 0);
        }

        // When the user hits "Store", this will retrieve the password
        private void StartAppExecute(PasswordBox parameter)
        {
            if(!AppRunning)
            {
                this.Password = parameter.Password;
                StartRunning();
            }
            else
            {
                StopRunning();
            }

        }

        private async void SetupApp(TreehopperUsb treehopperBoard)
        {
            board = treehopperBoard;
            board.SPI.ChipSelect = board.Pin4;
            display = new SevenSegSpi(board.SPI);
            await display.Init();
            IsConnected = true;
        }

        private void StartRunning()
        {
            if (!IsConnected) return;

            StartAppBtnName = "Stop App";
            // Update it immediately, and then start the timer.
            timer_Elapsed(null, null);
            timer.Start();
            AppRunning = true;
        }

        private void StopRunning()
        {
            if (!IsConnected) return;

            StartAppBtnName = "Start App";
            timer.Stop();
            AppRunning = false;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
NSString *const IPAddressPreferencesKey = @"SDLExampleAppIPAddress";
NSString *const PortPreferencesKey = @"SDLExampleAppPort";
NSString *const LastUsedSegmentPreferencesKey = @"SDLExampleLastSegment";

NSString *const DefaultIPAddressValue = @"192.168.1.1";
UInt16 const DefaultPortValue = 12345;
UInt8 const DefaultSegment = 0;

@implementation Preferences

#pragma mark - Singleton / Initializers

+ (instancetype)sharedPreferences {
    static Preferences *sharedPreferences = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedPreferences = [[Preferences alloc] init];
    });

    return sharedPreferences;
}

- (instancetype)init {
    self = [super init];
    if (!self) {
        return nil;
    }

    if (self.ipAddress == nil || self.port == 0) {
        [self resetPreferences];
    }

    return self;
}

#pragma mark - Public API

- (void)resetPreferences {
    self.ipAddress = DefaultIPAddressValue;
    self.port = DefaultPortValue;
    self.lastUsedSegment = DefaultSegment;
}

#pragma mark - Setters / Getters

- (NSString *)ipAddress {
    return [self stringForKey:IPAddressPreferencesKey];
}

- (void)setIpAddress:(NSString *)ipAddress {
    [self setString:ipAddress forKey:IPAddressPreferencesKey];
}

- (UInt16)port {
    return (UInt16)[self integerForKey:PortPreferencesKey];
}

- (void)setPort:(UInt16)port {
    [self setInteger:port forKey:PortPreferencesKey];
}

- (UInt8)lastUsedSegment {
    return (UInt8)[self integerForKey:LastUsedSegmentPreferencesKey];
}

- (void)setLastUsedSegment:(UInt8)lastUsedSegment {
    [self setInteger:lastUsedSegment forKey:LastUsedSegmentPreferencesKey];
}

#pragma mark - Private User Defaults Helpers

- (void)setString:(NSString *)aString forKey:(NSString *)aKey {
    NSParameterAssert(aKey != nil);

    dispatch_async(self.class.preferencesQueue, ^{
        [[NSUserDefaults standardUserDefaults] setObject:aString forKey:aKey];
    });
}

- (NSString *)stringForKey:(NSString *)aKey {
    NSParameterAssert(aKey != nil);

    __block NSString *retVal = nil;
    dispatch_sync(self.class.preferencesQueue, ^{
        retVal = [[NSUserDefaults standardUserDefaults] stringForKey:aKey];
    });

    return retVal;
}

- (void)setInteger:(NSInteger)aInt forKey:(NSString *)aKey {
    NSParameterAssert(aKey != nil);

    dispatch_async(self.class.preferencesQueue, ^{
        [[NSUserDefaults standardUserDefaults] setInteger:aInt forKey:aKey];
    });
}

- (NSInteger)integerForKey:(NSString *)aKey {
    NSParameterAssert(aKey != nil);

    __block NSInteger retVal = 0;
    dispatch_sync(self.class.preferencesQueue, ^{
        retVal = [[NSUserDefaults standardUserDefaults] integerForKey:aKey];
    });

    return retVal;
}

#pragma mark - Class Queue

+ (dispatch_queue_t)preferencesQueue {
    static dispatch_queue_t preferencesQueue;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        preferencesQueue = dispatch_queue_create("com.sdl-example.preferences", DISPATCH_QUEUE_SERIAL);
    });

    return preferencesQueue;
}

@end


text:
package com.xxl.rpc.core.registry.impl.xxlrpcadmin;

import com.xxl.rpc.core.registry.impl.xxlrpcadmin.model.XxlRpcAdminRegistryDataItem;
import com.xxl.rpc.core.util.GsonTool;
import com.xxl.rpc.core.util.XxlRpcException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;

/**
 * registry client, auto heatbeat registry info, auto monitor discovery info
 *
 * @author xuxueli 2018-12-01 21:48:05
 */
public class XxlRpcAdminRegistryClient {
    private static Logger logger = LoggerFactory.getLogger(XxlRpcAdminRegistryClient.class);

    private volatile Set<XxlRpcAdminRegistryDataItem> registryData = new HashSet<>();
    private volatile ConcurrentMap<String, TreeSet<String>> discoveryData = new ConcurrentHashMap<>();

    private Thread registryThread;
    private Thread discoveryThread;
    private volatile boolean registryThreadStop = false;

    private XxlRpcAdminRegistryBaseClient registryBaseClient;

    public XxlRpcAdminRegistryClient(String adminAddress, String accessToken, String env) {
        // init
        registryBaseClient = new XxlRpcAdminRegistryBaseClient(adminAddress, accessToken, env);
        logger.info(">>>>>>>>>>> xxl-rpc, XxlRpcAdminRegistryClient init .... [adminAddress={}, accessToken={}, env={}]", adminAddress, accessToken, env);

        // registry thread
        registryThread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (!registryThreadStop) {
                    try {
                        if (registryData.size() > 0) {

                            boolean ret = registryBaseClient.registry(new ArrayList<XxlRpcAdminRegistryDataItem>(registryData));
                            logger.debug(">>>>>>>>>>> xxl-rpc, refresh registry data {}, registryData = {}", ret?"success":"fail",registryData);
                        }
                    } catch (Exception e) {
                        if (!registryThreadStop) {
                            logger.error(">>>>>>>>>>> xxl-rpc, registryThread error.", e);
                        }
                    }
                    try {
                        TimeUnit.SECONDS.sleep(10);
                    } catch (Exception e) {
                        if (!registryThreadStop) {
                            logger.error(">>>>>>>>>>> xxl-rpc, registryThread error.", e);
                        }
                    }
                }
                logger.info(">>>>>>>>>>> xxl-rpc, registryThread stoped.");
            }
        });
        registryThread.setName("xxl-rpc, XxlRpcAdminRegistryClient registryThread.");
        registryThread.setDaemon(true);
        registryThread.start();

        // discovery thread
        discoveryThread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (!registryThreadStop) {

                    if (discoveryData.size() == 0) {
                        try {
                            TimeUnit.SECONDS.sleep(3);
                        } catch (Exception e) {
                            if (!registryThreadStop) {
                                logger.error(">>>>>>>>>>> xxl-rpc, discoveryThread error.", e);
                            }
                        }
                    } else {
                        try {
                            // monitor
                            boolean monitorRet = registryBaseClient.monitor(discoveryData.keySet());

                            // avoid fail-retry request too quick
                            if (!monitorRet){
                                TimeUnit.SECONDS.sleep(10);
                            }

                            // refreshDiscoveryData, all
                            refreshDiscoveryData(discoveryData.keySet());
                        } catch (Exception e) {
                            if (!registryThreadStop) {
                                logger.error(">>>>>>>>>>> xxl-rpc, discoveryThread error.", e);
                            }
                        }
                    }

                }
                logger.info(">>>>>>>>>>> xxl-rpc, discoveryThread stoped.");
            }
        });
        discoveryThread.setName("xxl-rpc, XxlRegistryClient discoveryThread.");
        discoveryThread.setDaemon(true);
        discoveryThread.start();

        logger.info(">>>>>>>>>>> xxl-rpc, XxlRegistryClient init success.");
    }

    public void stop() {
        registryThreadStop = true;
        if (registryThread != null) {
            registryThread.interrupt();
        }
        if (discoveryThread != null) {
            discoveryThread.interrupt();
        }
    }

    /**
     * registry
     *
     * @param registryDataList
     * @return
     */
    public boolean registry(List<XxlRpcAdminRegistryDataItem> registryDataList){

        // valid
        if (registryDataList==null || registryDataList.size()==0) {
            throw new XxlRpcException("xxl-rpc registryDataList empty");
        }
        for (XxlRpcAdminRegistryDataItem registryParam: registryDataList) {
            if (registryParam.getKey()==null || registryParam.getKey().trim().length()<4 || registryParam.getKey().trim().length()>255) {
                throw new XxlRpcException("xxl-rpc registryDataList#key Invalid[4~255]");
            }
            if (registryParam.getValue()==null || registryParam.getValue().trim().length()<4 || registryParam.getValue().trim().length()>255) {
                throw new XxlRpcException("xxl-rpc registryDataList#value Invalid[4~255]");
            }
        }

        // cache
        registryData.addAll(registryDataList);

        // remote
        registryBaseClient.registry(registryDataList);

        return true;
    }

    /**
     * remove
     *
     * @param registryDataList
     * @return
     */
    public boolean remove(List<XxlRpcAdminRegistryDataItem> registryDataList) {
        // valid
        if (registryDataList==null || registryDataList.size()==0) {
            throw new XxlRpcException("xxl-rpc registryDataList empty");
        }
        for (XxlRpcAdminRegistryDataItem registryParam: registryDataList) {
            if (registryParam.getKey()==null || registryParam.getKey().trim().length()<4 || registryParam.getKey().trim().length()>255) {
                throw new XxlRpcException("xxl-rpc registryDataList#key Invalid[4~255]");
            }
            if (registryParam.getValue()==null || registryParam.getValue().trim().length()<4 || registryParam.getValue().trim().length()>255) {
                throw new XxlRpcException("xxl-rpc registryDataList#value Invalid[4~255]");
            }
        }

        // cache
        registryData.removeAll(registryDataList);

        // remote
        registryBaseClient.remove(registryDataList);

        return true;
    }

    /**
     * discovery
     *
     * @param keys
     * @return
     */
    public Map<String, TreeSet<String>> discovery(Set<String> keys) {
        if (keys==null || keys.size() == 0) {
            return null;
        }

        // find from local
        Map<String, TreeSet<String>> registryDataTmp = new HashMap<String, TreeSet<String>>();
        for (String key : keys) {
            TreeSet<String> valueSet = discoveryData.get(key);
            if (valueSet != null) {
                registryDataTmp.put(key, valueSet);
            }
        }

        // not find all, find from remote
        if (keys.size() != registryDataTmp.size()) {

            // refreshDiscoveryData, some, first use
            refreshDiscoveryData(keys);

            // find from local
            for (String key : keys) {
                TreeSet<String> valueSet = discoveryData.get(key);
                if (valueSet != null) {
                    registryDataTmp.put(key, valueSet);
                }
            }

        }

        return registryDataTmp;
    }

    /**
     * refreshDiscoveryData, some or all
     */
    private void refreshDiscoveryData(Set<String> keys){
        if (keys==null || keys.size() == 0) {
            return;
        }

        // discovery mult
        Map<String, TreeSet<String>> updatedData = new HashMap<>();

        Map<String, TreeSet<String>> keyValueListData = registryBaseClient.discovery(keys);
        if (keyValueListData!=null) {
            for (String keyItem: keyValueListData.keySet()) {

                // list > set
                TreeSet<String> valueSet = new TreeSet<>();
                valueSet.addAll(keyValueListData.get(keyItem));

                // valid if updated
                boolean updated = true;
                TreeSet<String> oldValSet = discoveryData.get(keyItem);
                if (oldValSet!=null && GsonTool.toJson(oldValSet).equals(GsonTool.toJson(valueSet))) {
                    updated = false;
                }

                // set
                if (updated) {
                    discoveryData.put(keyItem, valueSet);
                    updatedData.put(keyItem, valueSet);
                }

            }
        }

        if (updatedData.size() > 0) {
            logger.info(">>>>>>>>>>> xxl-rpc, refresh discovery data finish, discoveryData(updated) = {}", updatedData);
        }
        logger.debug(">>>>>>>>>>> xxl-rpc, refresh discovery data finish, discoveryData = {}", discoveryData);
    }

    public TreeSet<String> discovery(String key) {
        if (key==null) {
            return null;
        }

        Map<String, TreeSet<String>> keyValueSetTmp = discovery(new HashSet<String>(Arrays.asList(key)));
        if (keyValueSetTmp != null) {
            return keyValueSetTmp.get(key);
        }
        return null;
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid
        android:color="#0000"/>
</shape><!-- From: file:/D:/repos/github/FABToolbar/FABToolbar/library/src/main/res/drawable/empty_drawable.xml -->


text:
using System;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Exceptions;

namespace Aspose.DotNetNuke.Modules.AsposeDNNQuoteGeneratorWord
{
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// The Settings class manages Module Settings
    ///
    /// Typically your settings control would be used to manage settings for your module.
    /// There are two types of settings, ModuleSettings, and TabModuleSettings.
    ///
    /// ModuleSettings apply to all "copies" of a module on a site, no matter which page the module is on.
    ///
    /// TabModuleSettings apply only to the current module on the current page, if you copy that module to
    /// another page the settings are not transferred.
    ///
    /// If you happen to save both TabModuleSettings and ModuleSettings, TabModuleSettings overrides ModuleSettings.
    ///
    /// Below we have some examples of how to access these settings but you will need to uncomment to use.
    ///
    /// Because the control inherits from AsposeDNNQuoteGeneratorSettingsBase you have access to any custom properties
    /// defined there, as well as properties from DNN such as PortalId, ModuleId, TabId, UserId and many more.
    /// </summary>
    /// -----------------------------------------------------------------------------
    public partial class Settings : AsposeDNNQuoteGeneratorModuleSettingsBase
    {
        #region Base Method Implementations

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LoadSettings loads the settings from the Database and displays them
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void LoadSettings()
        {
            try
            {
                if (Page.IsPostBack == false)
                {
                    //Check for existing settings and use those on this page
                    //Settings["SettingName"]

                    /* uncomment to load saved settings in the text boxes
                    if(Settings.Contains("Setting1"))
                        txtSetting1.Text = Settings["Setting1"].ToString();

                    if (Settings.Contains("Setting2"))
                        txtSetting2.Text = Settings["Setting2"].ToString();

                    */

                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// UpdateSettings saves the modified settings to the Database
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void UpdateSettings()
        {
            try
            {
                var modules = new ModuleController();

                //the following are two sample Module Settings, using the text boxes that are commented out in the ASCX file.
                //module settings
                //modules.UpdateModuleSetting(ModuleId, "Setting1", txtSetting1.Text);
                //modules.UpdateModuleSetting(ModuleId, "Setting2", txtSetting2.Text);

                //tab module settings
                //modules.UpdateTabModuleSetting(TabModuleId, "Setting1",  txtSetting1.Text);
                //modules.UpdateTabModuleSetting(TabModuleId, "Setting2",  txtSetting2.Text);
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }

        #endregion
    }
}


text:
require 'spec_helper'

describe 'puppetdb', :type => :class do
  ttl_args = ['node_ttl','node_purge_ttl','report_ttl']

  context 'on a supported platform' do
    let(:facts) do
      {
        :osfamily => 'Debian',
        :operatingsystem => 'Debian',
        :operatingsystemrelease => '6.0',
        :kernel => 'Linux',
        :concat_basedir => '/var/lib/puppet/concat',
        :lsbdistid => 'Debian',
        :lsbdistcodename => 'foo',
        :id => 'root',
        :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
        :selinux => false,
        :iptables_persistent_version => '0.5.7',
      }
    end

    describe 'when using default values for puppetdb class' do
      it { should contain_class('puppetdb') }
    end
  end

  context 'with invalid arguments on a supported platform' do
    let(:facts) do
      {
        :osfamily => 'RedHat',
        :operatingsystem => 'Debian',
        :operatingsystemrelease => '6.0',
        :kernel => 'Linux',
        :concat_basedir => '/var/lib/puppet/concat',
        :selinux => true,
        :iptables_persistent_version => '0.5.7',
      }
    end
    ttl_args.each do |ttl_arg|
      let(:params) do
        {
          ttl_arg => 'invalid_value'
        }
      end
      it "when using a value that does not match the validation regex for #{ttl_arg} puppetdb class" do
        expect { should contain_class('puppetdb') }.to raise_error(Puppet::Error)
      end
    end
  end
end


text:
#include "uml/impl/ActivityParameterNodeImpl.hpp"
#ifdef NDEBUG
	#define DEBUG_MESSAGE(a) /**/
#else
	#define DEBUG_MESSAGE(a) a
#endif

#ifdef ACTIVITY_DEBUG_ON
    #define ACT_DEBUG(a) a
#else
    #define ACT_DEBUG(a) /**/
#endif

//#include "util/ProfileCallCount.hpp"

#include <cassert>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include "abstractDataTypes/SubsetUnion.hpp"

#include "abstractDataTypes/AnyEObject.hpp"
#include "abstractDataTypes/AnyEObjectBag.hpp"
#include "abstractDataTypes/SubsetUnion.hpp"
#include "ecore/EAnnotation.hpp"
#include "ecore/EClass.hpp"
#include "ecore/EAttribute.hpp"
#include "ecore/EStructuralFeature.hpp"
#include "ecore/ecorePackage.hpp"
//Forward declaration includes
#include "persistence/interfaces/XLoadHandler.hpp" // used for Persistence
#include "persistence/interfaces/XSaveHandler.hpp" // used for Persistence

#include <exception> // used in Persistence
#include "uml/umlFactory.hpp"
#include "uml/Activity.hpp"
#include "uml/ActivityEdge.hpp"
#include "uml/ActivityGroup.hpp"
#include "uml/ActivityNode.hpp"
#include "uml/ActivityPartition.hpp"
#include "uml/Behavior.hpp"
#include "uml/Classifier.hpp"
#include "uml/Comment.hpp"
#include "uml/Dependency.hpp"
#include "uml/Element.hpp"
#include "uml/InterruptibleActivityRegion.hpp"
#include "uml/Namespace.hpp"
#include "uml/ObjectNode.hpp"
#include "uml/Parameter.hpp"
#include "uml/RedefinableElement.hpp"
#include "uml/State.hpp"
#include "uml/StringExpression.hpp"
#include "uml/StructuredActivityNode.hpp"
#include "uml/Type.hpp"
#include "uml/ValueSpecification.hpp"
//Factories and Package includes
#include "uml/umlPackage.hpp"

using namespace uml;

//*********************************
// Constructor / Destructor
//*********************************
ActivityParameterNodeImpl::ActivityParameterNodeImpl()
{
	/*
	NOTE: Due to virtual inheritance, base class constrcutors may not be called correctly
	*/
}

ActivityParameterNodeImpl::~ActivityParameterNodeImpl()
{
#ifdef SHOW_DELETION
	std::cout << "-------------------------------------------------------------------------------------------------\r\ndelete ActivityParameterNode "<< this << "\r\n------------------------------------------------------------------------ " << std::endl;
#endif
}

//Additional constructor for the containments back reference
ActivityParameterNodeImpl::ActivityParameterNodeImpl(std::weak_ptr<uml::Activity> par_activity)
:ActivityParameterNodeImpl()
{
	m_activity = par_activity;
	m_owner = par_activity;
}

//Additional constructor for the containments back reference
ActivityParameterNodeImpl::ActivityParameterNodeImpl(std::weak_ptr<uml::StructuredActivityNode> par_inStructuredNode)
:ActivityParameterNodeImpl()
{
	m_inStructuredNode = par_inStructuredNode;
	m_owner = par_inStructuredNode;
}

//Additional constructor for the containments back reference
ActivityParameterNodeImpl::ActivityParameterNodeImpl(std::weak_ptr<uml::Namespace> par_namespace)
:ActivityParameterNodeImpl()
{
	m_namespace = par_namespace;
	m_owner = par_namespace;
}

//Additional constructor for the containments back reference
ActivityParameterNodeImpl::ActivityParameterNodeImpl(std::weak_ptr<uml::Element> par_owner)
:ActivityParameterNodeImpl()
{
	m_owner = par_owner;
}

ActivityParameterNodeImpl::ActivityParameterNodeImpl(const ActivityParameterNodeImpl & obj): ActivityParameterNodeImpl()
{
	*this = obj;
}

ActivityParameterNodeImpl& ActivityParameterNodeImpl::operator=(const ActivityParameterNodeImpl & obj)
{
	//call overloaded =Operator for each base class
	ObjectNodeImpl::operator=(obj);
	/* TODO: Find out if this call is necessary
	 * Currently, this causes an error because it calls an implicit assignment operator of ActivityParameterNode
	 * which is generated by the compiler (as ActivityParameterNode is an abstract class and does not have a user-defined assignment operator).
	 * Implicit compiler-generated assignment operators however only create shallow copies of members,
	 * which implies, that not a real deep copy is created when using the copy()-method.
	 *
	 * NOTE: Since all members are deep-copied by this assignment-operator anyway, why is it even necessary to call this implicit assignment-operator?
	 * This is only done for ecore-models, not for UML-models.
	 */
	//ActivityParameterNode::operator=(obj);

	//create copy of all Attributes
	#ifdef SHOW_COPIES
	std::cout << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\ncopy ActivityParameterNode "<< this << "\r\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ " << std::endl;
	#endif
	//Clone Attributes with (deep copy)

	//copy references with no containment (soft copy)
	m_parameter  = obj.getParameter();
	//Clone references with containment (deep copy)
	return *this;
}

std::shared_ptr<ecore::EObject> ActivityParameterNodeImpl::copy() const
{
	std::shared_ptr<ActivityParameterNodeImpl> element(new ActivityParameterNodeImpl());
	*element =(*this);
	element->setThisActivityParameterNodePtr(element);
	return element;
}

//*********************************
// Operations
//*********************************
bool ActivityParameterNodeImpl::has_parameters(Any diagnostics,std::shared_ptr<std::map < Any, Any>> context)
{
	throw std::runtime_error("UnsupportedOperationException: " + std::string(__PRETTY_FUNCTION__));
}

bool ActivityParameterNodeImpl::no_edges(Any diagnostics,std::shared_ptr<std::map < Any, Any>> context)
{
	throw std::runtime_error("UnsupportedOperationException: " + std::string(__PRETTY_FUNCTION__));
}

bool ActivityParameterNodeImpl::no_incoming_edges(Any diagnostics,std::shared_ptr<std::map < Any, Any>> context)
{
	throw std::runtime_error("UnsupportedOperationException: " + std::string(__PRETTY_FUNCTION__));
}

bool ActivityParameterNodeImpl::no_outgoing_edges(Any diagnostics,std::shared_ptr<std::map < Any, Any>> context)
{
	throw std::runtime_error("UnsupportedOperationException: " + std::string(__PRETTY_FUNCTION__));
}

bool ActivityParameterNodeImpl::same_type(Any diagnostics,std::shared_ptr<std::map < Any, Any>> context)
{
	throw std::runtime_error("UnsupportedOperationException: " + std::string(__PRETTY_FUNCTION__));
}

//*********************************
// Attribute Getters & Setters
//*********************************

//*********************************
// Reference Getters & Setters
//*********************************
/* Getter & Setter for reference parameter */
std::shared_ptr<uml::Parameter> ActivityParameterNodeImpl::getParameter() const
{
    return m_parameter;
}
void ActivityParameterNodeImpl::setParameter(std::shared_ptr<uml::Parameter> _parameter)
{
    m_parameter = _parameter;

}

//*********************************
// Union Getter
//*********************************
std::shared_ptr<Union<uml::ActivityGroup>> ActivityParameterNodeImpl::getInGroup() const
{
	if(m_inGroup == nullptr)
	{
		/*Union*/
		m_inGroup.reset(new Union<uml::ActivityGroup>());
			#ifdef SHOW_SUBSET_UNION
			std::cout << "Initialising Union: " << "m_inGroup - Union<uml::ActivityGroup>()" << std::endl;
		#endif

	}
	return m_inGroup;
}

std::shared_ptr<Union<uml::Element>> ActivityParameterNodeImpl::getOwnedElement() const
{
	if(m_ownedElement == nullptr)
	{
		/*Union*/
		m_ownedElement.reset(new Union<uml::Element>());
			#ifdef SHOW_SUBSET_UNION
			std::cout << "Initialising Union: " << "m_ownedElement - Union<uml::Element>()" << std::endl;
		#endif

	}
	return m_ownedElement;
}

std::weak_ptr<uml::Element> ActivityParameterNodeImpl::getOwner() const
{
	return m_owner;
}

std::shared_ptr<Union<uml::RedefinableElement>> ActivityParameterNodeImpl::getRedefinedElement() const
{
	if(m_redefinedElement == nullptr)
	{
		/*Union*/
		m_redefinedElement.reset(new Union<uml::RedefinableElement>());
			#ifdef SHOW_SUBSET_UNION
			std::cout << "Initialising Union: " << "m_redefinedElement - Union<uml::RedefinableElement>()" << std::endl;
		#endif

	}
	return m_redefinedElement;
}

//*********************************
// Container Getter
//*********************************
std::shared_ptr<ecore::EObject> ActivityParameterNodeImpl::eContainer() const
{
	if(auto wp = m_activity.lock())
	{
		return wp;
	}

	if(auto wp = m_inStructuredNode.lock())
	{
		return wp;
	}

	if(auto wp = m_namespace.lock())
	{
		return wp;
	}

	if(auto wp = m_owner.lock())
	{
		return wp;
	}
	return nullptr;
}

//*********************************
// Persistence Functions
//*********************************
void ActivityParameterNodeImpl::load(std::shared_ptr<persistence::interfaces::XLoadHandler> loadHandler)
{
	std::map<std::string, std::string> attr_list = loadHandler->getAttributeList();
	loadAttributes(loadHandler, attr_list);

	//
	// Create new objects (from references (containment == true))
	//
	// get umlFactory
	int numNodes = loadHandler->getNumOfChildNodes();
	for(int ii = 0; ii < numNodes; ii++)
	{
		loadNode(loadHandler->getNextNodeName(), loadHandler);
	}
}

void ActivityParameterNodeImpl::loadAttributes(std::shared_ptr<persistence::interfaces::XLoadHandler> loadHandler, std::map<std::string, std::string> attr_list)
{
	try
	{
		std::map<std::string, std::string>::const_iterator iter;
		std::shared_ptr<ecore::EClass> metaClass = this->eClass(); // get MetaClass
		iter = attr_list.find("parameter");
		if ( iter != attr_list.end() )
		{
			// add unresolvedReference to loadHandler's list
			loadHandler->addUnresolvedReference(iter->second, loadHandler->getCurrentObject(), metaClass->getEStructuralFeature("parameter")); // TODO use getEStructuralFeature() with id, for faster access to EStructuralFeature
		}
	}
	catch (std::exception& e)
	{
		std::cout << "| ERROR    | " << e.what() << std::endl;
	}
	catch (...)
	{
		std::cout << "| ERROR    | " <<  "Exception occurred" << std::endl;
	}

	ObjectNodeImpl::loadAttributes(loadHandler, attr_list);
}

void ActivityParameterNodeImpl::loadNode(std::string nodeName, std::shared_ptr<persistence::interfaces::XLoadHandler> loadHandler)
{

	//load BasePackage Nodes
	ObjectNodeImpl::loadNode(nodeName, loadHandler);
}

void ActivityParameterNodeImpl::resolveReferences(const int featureID, std::vector<std::shared_ptr<ecore::EObject> > references)
{
	switch(featureID)
	{
		case uml::umlPackage::ACTIVITYPARAMETERNODE_ATTRIBUTE_PARAMETER:
		{
			if (references.size() == 1)
			{
				// Cast object to correct type
				std::shared_ptr<uml::Parameter> _parameter = std::dynamic_pointer_cast<uml::Parameter>( references.front() );
				setParameter(_parameter);
			}

			return;
		}
	}
	ObjectNodeImpl::resolveReferences(featureID, references);
}

void ActivityParameterNodeImpl::save(std::shared_ptr<persistence::interfaces::XSaveHandler> saveHandler) const
{
	saveContent(saveHandler);

	ObjectNodeImpl::saveContent(saveHandler);

	ActivityNodeImpl::saveContent(saveHandler);
	TypedElementImpl::saveContent(saveHandler);

	RedefinableElementImpl::saveContent(saveHandler);

	NamedElementImpl::saveContent(saveHandler);

	ElementImpl::saveContent(saveHandler);

	ObjectImpl::saveContent(saveHandler);

	ecore::EObjectImpl::saveContent(saveHandler);
}

void ActivityParameterNodeImpl::saveContent(std::shared_ptr<persistence::interfaces::XSaveHandler> saveHandler) const
{
	try
	{
		std::shared_ptr<uml::umlPackage> package = uml::umlPackage::eInstance();
	// Add references
		saveHandler->addReference(this->getParameter(), "parameter", getParameter()->eClass() != uml::umlPackage::eInstance()->getParameter_Class());
	}
	catch (std::exception& e)
	{
		std::cout << "| ERROR    | " << e.what() << std::endl;
	}
}

std::shared_ptr<ecore::EClass> ActivityParameterNodeImpl::eStaticClass() const
{
	return uml::umlPackage::eInstance()->getActivityParameterNode_Class();
}

//*********************************
// EStructuralFeature Get/Set/IsSet
//*********************************
Any ActivityParameterNodeImpl::eGet(int featureID, bool resolve, bool coreType) const
{
	switch(featureID)
	{
		case uml::umlPackage::ACTIVITYPARAMETERNODE_ATTRIBUTE_PARAMETER:
			return eAny(getParameter(),uml::umlPackage::PARAMETER_CLASS,false); //1226
	}
	return ObjectNodeImpl::eGet(featureID, resolve, coreType);
}

bool ActivityParameterNodeImpl::internalEIsSet(int featureID) const
{
	switch(featureID)
	{
		case uml::umlPackage::ACTIVITYPARAMETERNODE_ATTRIBUTE_PARAMETER:
			return getParameter() != nullptr; //1226
	}
	return ObjectNodeImpl::internalEIsSet(featureID);
}

bool ActivityParameterNodeImpl::eSet(int featureID, Any newValue)
{
	switch(featureID)
	{
		case uml::umlPackage::ACTIVITYPARAMETERNODE_ATTRIBUTE_PARAMETER:
		{
			// CAST Any to uml::Parameter
			std::shared_ptr<ecore::EObject> _temp = newValue->get<std::shared_ptr<ecore::EObject>>();
			std::shared_ptr<uml::Parameter> _parameter = std::dynamic_pointer_cast<uml::Parameter>(_temp);
			setParameter(_parameter); //1226
			return true;
		}
	}

	return ObjectNodeImpl::eSet(featureID, newValue);
}

//*********************************
// EOperation Invoke
//*********************************
Any ActivityParameterNodeImpl::eInvoke(int operationID, std::shared_ptr<std::list<Any>> arguments)
{
	Any result;

  	switch(operationID)
	{
		// uml::ActivityParameterNode::has_parameters(Any, std::map) : bool: 1133881025
		case umlPackage::ACTIVITYPARAMETERNODE_OPERATION_HAS_PARAMETERS_EDIAGNOSTICCHAIN_EMAP:
		{
			//Retrieve input parameter 'diagnostics'
			//parameter 0
			Any incoming_param_diagnostics;
			std::list<Any>::const_iterator incoming_param_diagnostics_arguments_citer = std::next(arguments->begin(), 0);
			incoming_param_diagnostics = (*incoming_param_diagnostics_arguments_citer)->get<Any >();
			//Retrieve input parameter 'context'
			//parameter 1
			std::shared_ptr<std::map < Any, Any>> incoming_param_context;
			std::list<Any>::const_iterator incoming_param_context_arguments_citer = std::next(arguments->begin(), 1);
			incoming_param_context = (*incoming_param_context_arguments_citer)->get<std::shared_ptr<std::map < Any, Any>> >();
			result = eAny(this->has_parameters(incoming_param_diagnostics,incoming_param_context),0,false);
			break;
		}
		// uml::ActivityParameterNode::no_edges(Any, std::map) : bool: 1392135778
		case umlPackage::ACTIVITYPARAMETERNODE_OPERATION_NO_EDGES_EDIAGNOSTICCHAIN_EMAP:
		{
			//Retrieve input parameter 'diagnostics'
			//parameter 0
			Any incoming_param_diagnostics;
			std::list<Any>::const_iterator incoming_param_diagnostics_arguments_citer = std::next(arguments->begin(), 0);
			incoming_param_diagnostics = (*incoming_param_diagnostics_arguments_citer)->get<Any >();
			//Retrieve input parameter 'context'
			//parameter 1
			std::shared_ptr<std::map < Any, Any>> incoming_param_context;
			std::list<Any>::const_iterator incoming_param_context_arguments_citer = std::next(arguments->begin(), 1);
			incoming_param_context = (*incoming_param_context_arguments_citer)->get<std::shared_ptr<std::map < Any, Any>> >();
			result = eAny(this->no_edges(incoming_param_diagnostics,incoming_param_context),0,false);
			break;
		}
		// uml::ActivityParameterNode::no_incoming_edges(Any, std::map) : bool: 99476997
		case umlPackage::ACTIVITYPARAMETERNODE_OPERATION_NO_INCOMING_EDGES_EDIAGNOSTICCHAIN_EMAP:
		{
			//Retrieve input parameter 'diagnostics'
			//parameter 0
			Any incoming_param_diagnostics;
			std::list<Any>::const_iterator incoming_param_diagnostics_arguments_citer = std::next(arguments->begin(), 0);
			incoming_param_diagnostics = (*incoming_param_diagnostics_arguments_citer)->get<Any >();
			//Retrieve input parameter 'context'
			//parameter 1
			std::shared_ptr<std::map < Any, Any>> incoming_param_context;
			std::list<Any>::const_iterator incoming_param_context_arguments_citer = std::next(arguments->begin(), 1);
			incoming_param_context = (*incoming_param_context_arguments_citer)->get<std::shared_ptr<std::map < Any, Any>> >();
			result = eAny(this->no_incoming_edges(incoming_param_diagnostics,incoming_param_context),0,false);
			break;
		}
		// uml::ActivityParameterNode::no_outgoing_edges(Any, std::map) : bool: 1460759441
		case umlPackage::ACTIVITYPARAMETERNODE_OPERATION_NO_OUTGOING_EDGES_EDIAGNOSTICCHAIN_EMAP:
		{
			//Retrieve input parameter 'diagnostics'
			//parameter 0
			Any incoming_param_diagnostics;
			std::list<Any>::const_iterator incoming_param_diagnostics_arguments_citer = std::next(arguments->begin(), 0);
			incoming_param_diagnostics = (*incoming_param_diagnostics_arguments_citer)->get<Any >();
			//Retrieve input parameter 'context'
			//parameter 1
			std::shared_ptr<std::map < Any, Any>> incoming_param_context;
			std::list<Any>::const_iterator incoming_param_context_arguments_citer = std::next(arguments->begin(), 1);
			incoming_param_context = (*incoming_param_context_arguments_citer)->get<std::shared_ptr<std::map < Any, Any>> >();
			result = eAny(this->no_outgoing_edges(incoming_param_diagnostics,incoming_param_context),0,false);
			break;
		}
		// uml::ActivityParameterNode::same_type(Any, std::map) : bool: 1979271357
		case umlPackage::ACTIVITYPARAMETERNODE_OPERATION_SAME_TYPE_EDIAGNOSTICCHAIN_EMAP:
		{
			//Retrieve input parameter 'diagnostics'
			//parameter 0
			Any incoming_param_diagnostics;
			std::list<Any>::const_iterator incoming_param_diagnostics_arguments_citer = std::next(arguments->begin(), 0);
			incoming_param_diagnostics = (*incoming_param_diagnostics_arguments_citer)->get<Any >();
			//Retrieve input parameter 'context'
			//parameter 1
			std::shared_ptr<std::map < Any, Any>> incoming_param_context;
			std::list<Any>::const_iterator incoming_param_context_arguments_citer = std::next(arguments->begin(), 1);
			incoming_param_context = (*incoming_param_context_arguments_citer)->get<std::shared_ptr<std::map < Any, Any>> >();
			result = eAny(this->same_type(incoming_param_diagnostics,incoming_param_context),0,false);
			break;
		}

		default:
		{
			// call superTypes
			result = ObjectNodeImpl::eInvoke(operationID, arguments);
			if (result && !result->isEmpty())
				break;
			break;
		}
  	}

	return result;
}

std::shared_ptr<uml::ActivityParameterNode> ActivityParameterNodeImpl::getThisActivityParameterNodePtr() const
{
	return m_thisActivityParameterNodePtr.lock();
}
void ActivityParameterNodeImpl::setThisActivityParameterNodePtr(std::weak_ptr<uml::ActivityParameterNode> thisActivityParameterNodePtr)
{
	m_thisActivityParameterNodePtr = thisActivityParameterNodePtr;
	setThisObjectNodePtr(thisActivityParameterNodePtr);
}


text:
Changes
================

HEAD
---------

0.11.2
---------

* Update connection\_pool to latest (sferik)
* Clean up gemspec, Gemfile & add bundler install tasks (sferik)

0.11.1
---------

* Rescue RuntimeError when trying to load rubinius-actor on CRuby

0.11.0
---------

* Remove old Rubinius 1.2.3 monkeypatches
* Remove default `at_exit` handle which was causing issues [#67]
* Support the rubinius-actor gem for jruby/rbx (jc00ke)
  Avoids a nameclash for projects that define their own Actor class.

0.10.0
---------

* Update connection\_pool to latest
* Handle shutdown more gracefully, wait for work to be finished

0.9.7
---------

* Fix error handling (xshay)
* Add streaming batch support for adding elements to a batch one at a
  time rather than all at once.

0.9.6
---------

* Completely switch to connection\_pool for Redis backend.
  The Redis store no longer connects for you automatically, so it's mandatory to use
  connection\_pool.

0.9.5
---------

* Refactor thread usage so Queues can be properly shutdown and GC'd [GH-30]
* Use WeakRefs instead of ObjectSpace, as that plays better on JRuby.
* Can now pass a [connection\_pool](https://github.com/mperham/connection_pool) in as a Redis instance.
* Switch Redis.new to Redis.connect so a :url option can be passed in.
  Nice for using on Heroku with Redis To Go.
* Allow stacking of error handlers, fixes GH-11

0.9.4
---------

* You can now pass in an existing Redis instance - :store\_config => [{ :redis => $redis }]

0.9.3
---------

* Fix runtime error introduced in last release when running in Rails development environment

0.9.2
---------

* Remove use of weakrefs to track queue instances, use ObjectSpace
  instead.
* Add support for Batch operations, providing an easy way to fan out
  operations and then collect results when completed.
* Added WorkQueue.immediate! and WorkQueue.queue! to switch background processing off and back on respectively. Nice to use when testing. (jc00ke, ryanlecompte)
* Added some ajax updates to the girl\_friday status server. (jc00ke)

0.9.1
---------

* Lazy initialize the worker actors to avoid dead thread problems with Unicorn forking processes.
* Add initial pass at girl\_friday Rack server (see wiki).  It's awful looking, trust me, help wanted.

0.9.0
---------

* Initial release