text:
package com.hazelcast.internal.dynamicconfig.search;

import com.hazelcast.config.AtomicLongConfig;
import com.hazelcast.config.AtomicReferenceConfig;
import com.hazelcast.config.CacheSimpleConfig;
import com.hazelcast.config.CardinalityEstimatorConfig;
import com.hazelcast.config.Config;
import com.hazelcast.config.ConfigPatternMatcher;
import com.hazelcast.config.CountDownLatchConfig;
import com.hazelcast.config.DurableExecutorConfig;
import com.hazelcast.config.ExecutorConfig;
import com.hazelcast.config.FlakeIdGeneratorConfig;
import com.hazelcast.config.ListConfig;
import com.hazelcast.config.LockConfig;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.MultiMapConfig;
import com.hazelcast.config.PNCounterConfig;
import com.hazelcast.config.QueueConfig;
import com.hazelcast.config.ReliableTopicConfig;
import com.hazelcast.config.ReplicatedMapConfig;
import com.hazelcast.config.RingbufferConfig;
import com.hazelcast.config.ScheduledExecutorConfig;
import com.hazelcast.config.SemaphoreConfig;
import com.hazelcast.config.SetConfig;
import com.hazelcast.config.TopicConfig;
import com.hazelcast.internal.dynamicconfig.ConfigurationService;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Config search factory, which allows to build searchers for the given config types.
 *
 * @since 3.11
 * @see Searcher
 */
@SuppressWarnings({"checkstyle:methodcount", "checkstyle:executablestatementcount"})
public final class ConfigSearch {
    private static final Map<Class, ConfigSupplier> CONFIG_SUPPLIERS = new ConcurrentHashMap<Class, ConfigSupplier>();

    private ConfigSearch() {
    }

    static {
        CONFIG_SUPPLIERS.put(MapConfig.class, new ConfigSupplier<MapConfig>() {
            @Override
            public MapConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findMapConfig(name);
            }

            @Override
            public MapConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getMapConfig(name);
            }

            @Override
            public Map<String, MapConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getMapConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(CacheSimpleConfig.class, new ConfigSupplier<CacheSimpleConfig>() {
            @Override
            public CacheSimpleConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findCacheSimpleConfig(name);
            }

            @Override
            public CacheSimpleConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getCacheConfig(name);
            }

            @Override
            public Map<String, CacheSimpleConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getCacheConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(QueueConfig.class, new ConfigSupplier<QueueConfig>() {
            @Override
            public QueueConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findQueueConfig(name);
            }

            @Override
            public QueueConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getQueueConfig(name);
            }

            @Override
            public Map<String, QueueConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getQueueConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(LockConfig.class, new ConfigSupplier<LockConfig>() {
            @Override
            public LockConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findLockConfig(name);
            }

            @Override
            public LockConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getLockConfig(name);
            }

            @Override
            public Map<String, LockConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getLockConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(ListConfig.class, new ConfigSupplier<ListConfig>() {
            @Override
            public ListConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findListConfig(name);
            }

            @Override
            public ListConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getListConfig(name);
            }

            @Override
            public Map<String, ListConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getListConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(SetConfig.class, new ConfigSupplier<SetConfig>() {
            @Override
            public SetConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findSetConfig(name);
            }

            @Override
            public SetConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getSetConfig(name);
            }

            @Override
            public Map<String, SetConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getSetConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(MultiMapConfig.class, new ConfigSupplier<MultiMapConfig>() {
            @Override
            public MultiMapConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findMultiMapConfig(name);
            }

            @Override
            public MultiMapConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getMultiMapConfig(name);
            }

            @Override
            public Map<String, MultiMapConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getMultiMapConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(ReplicatedMapConfig.class, new ConfigSupplier<ReplicatedMapConfig>() {
            @Override
            public ReplicatedMapConfig getDynamicConfig(@Nonnull ConfigurationService configurationService,
                                                        @Nonnull String name) {
                return configurationService.findReplicatedMapConfig(name);
            }

            @Override
            public ReplicatedMapConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getReplicatedMapConfig(name);
            }

            @Override
            public Map<String, ReplicatedMapConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getReplicatedMapConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(RingbufferConfig.class, new ConfigSupplier<RingbufferConfig>() {
            @Override
            public RingbufferConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findRingbufferConfig(name);
            }

            @Override
            public RingbufferConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getRingbufferConfig(name);
            }

            @Override
            public Map<String, RingbufferConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getRingbufferConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(AtomicLongConfig.class, new ConfigSupplier<AtomicLongConfig>() {
            @Override
            public AtomicLongConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findAtomicLongConfig(name);
            }

            @Override
            public AtomicLongConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getAtomicLongConfig(name);
            }

            @Override
            public Map<String, AtomicLongConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getAtomicLongConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(AtomicReferenceConfig.class, new ConfigSupplier<AtomicReferenceConfig>() {
            @Override
            public AtomicReferenceConfig getDynamicConfig(@Nonnull ConfigurationService configurationService,
                                                          @Nonnull String name) {
                return configurationService.findAtomicReferenceConfig(name);
            }

            @Override
            public AtomicReferenceConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getAtomicReferenceConfig(name);
            }

            @Override
            public Map<String, AtomicReferenceConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getAtomicReferenceConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(CountDownLatchConfig.class, new ConfigSupplier<CountDownLatchConfig>() {
            @Override
            public CountDownLatchConfig getDynamicConfig(@Nonnull ConfigurationService configurationService,
                                                         @Nonnull String name) {
                return configurationService.findCountDownLatchConfig(name);
            }

            @Override
            public CountDownLatchConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getCountDownLatchConfig(name);
            }

            @Override
            public Map<String, CountDownLatchConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getCountDownLatchConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(TopicConfig.class, new ConfigSupplier<TopicConfig>() {
            @Override
            public TopicConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findTopicConfig(name);
            }

            @Override
            public TopicConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getTopicConfig(name);
            }

            @Override
            public Map<String, TopicConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getTopicConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(ReliableTopicConfig.class, new ConfigSupplier<ReliableTopicConfig>() {
            @Override
            public ReliableTopicConfig getDynamicConfig(@Nonnull ConfigurationService configurationService,
                                                        @Nonnull String name) {
                return configurationService.findReliableTopicConfig(name);
            }

            @Override
            public ReliableTopicConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getReliableTopicConfig(name);
            }

            @Override
            public Map<String, ReliableTopicConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getReliableTopicConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(ExecutorConfig.class, new ConfigSupplier<ExecutorConfig>() {
            @Override
            public ExecutorConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findExecutorConfig(name);
            }

            @Override
            public ExecutorConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getExecutorConfig(name);
            }

            @Override
            public Map<String, ExecutorConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getExecutorConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(DurableExecutorConfig.class, new ConfigSupplier<DurableExecutorConfig>() {
            @Override
            public DurableExecutorConfig getDynamicConfig(@Nonnull ConfigurationService configurationService,
                                                          @Nonnull String name) {
                return configurationService.findDurableExecutorConfig(name);
            }

            @Override
            public DurableExecutorConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getDurableExecutorConfig(name);
            }

            @Override
            public Map<String, DurableExecutorConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getDurableExecutorConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(ScheduledExecutorConfig.class, new ConfigSupplier<ScheduledExecutorConfig>() {
            @Override
            public ScheduledExecutorConfig getDynamicConfig(@Nonnull ConfigurationService configurationService,
                                                            @Nonnull String name) {
                return configurationService.findScheduledExecutorConfig(name);
            }

            @Override
            public ScheduledExecutorConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getScheduledExecutorConfig(name);
            }

            @Override
            public Map<String, ScheduledExecutorConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getScheduledExecutorConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(CardinalityEstimatorConfig.class, new ConfigSupplier<CardinalityEstimatorConfig>() {
            @Override
            public CardinalityEstimatorConfig getDynamicConfig(@Nonnull ConfigurationService configurationService,
                                                               @Nonnull String name) {
                return configurationService.findCardinalityEstimatorConfig(name);
            }

            @Override
            public CardinalityEstimatorConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getCardinalityEstimatorConfig(name);
            }

            @Override
            public Map<String, CardinalityEstimatorConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getCardinalityEstimatorConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(SemaphoreConfig.class, new ConfigSupplier<SemaphoreConfig>() {
            @Override
            public SemaphoreConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findSemaphoreConfig(name);
            }

            @Override
            public SemaphoreConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getSemaphoreConfig(name);
            }

            @Override
            public Map<String, SemaphoreConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getSemaphoreConfigsAsMap();
            }
        });
        CONFIG_SUPPLIERS.put(FlakeIdGeneratorConfig.class, new ConfigSupplier<FlakeIdGeneratorConfig>() {
            @Override
            public FlakeIdGeneratorConfig getDynamicConfig(@Nonnull ConfigurationService configurationService,
                                                           @Nonnull String name) {
                return configurationService.findFlakeIdGeneratorConfig(name);
            }

            @Override
            public FlakeIdGeneratorConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getFlakeIdGeneratorConfig(name);
            }

            @Override
            public Map<String, FlakeIdGeneratorConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getFlakeIdGeneratorConfigs();
            }
        });
        CONFIG_SUPPLIERS.put(PNCounterConfig.class, new ConfigSupplier<PNCounterConfig>() {
            @Override
            public PNCounterConfig getDynamicConfig(@Nonnull ConfigurationService configurationService, @Nonnull String name) {
                return configurationService.findPNCounterConfig(name);
            }

            @Override
            public PNCounterConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
                return staticConfig.getPNCounterConfig(name);
            }

            @Override
            public Map<String, PNCounterConfig> getStaticConfigs(@Nonnull Config staticConfig) {
                return staticConfig.getPNCounterConfigs();
            }
        });
    }

    /**
     * Factory method for providing {@link ConfigSupplier} instances for the given config class
     *
     * @param cls class of the config we're looking for
     * @param <T> type of config class
     * @return {@link ConfigSupplier} config supplier for the given config type
     * @see com.hazelcast.spi.properties.GroupProperty#SEARCH_DYNAMIC_CONFIG_FIRST
     */
    @Nullable
    public static <T extends IdentifiedDataSerializable> ConfigSupplier<T> supplierFor(@Nonnull Class<T> cls) {
        return CONFIG_SUPPLIERS.get(cls);
    }

    /**
     * Factory method for creating {@link Searcher} instances
     *
     * @param staticConfig hazelcast static config
     * @param configurationService configuration service
     * @param isStaticFirst true if {@link Searcher} should look into static config first, and
     *                      false otherwise.
     * @param <T> type of config class
     * @return {@link Searcher} for the given config type and conditions
     * @see com.hazelcast.spi.properties.GroupProperty#SEARCH_DYNAMIC_CONFIG_FIRST
     * @see ConfigSupplier
     */
    @Nonnull
    public static <T extends IdentifiedDataSerializable>
    Searcher<T> searcherFor(@Nonnull final Config staticConfig,
                            @Nonnull final ConfigurationService configurationService,
                            @Nonnull final ConfigPatternMatcher configPatternMatcher, boolean isStaticFirst) {
        return isStaticFirst
                ? new StaticFirstSearcher<T>(configurationService, staticConfig, configPatternMatcher)
                : new DynamicFirstSearcher<T>(configurationService, staticConfig, configPatternMatcher);
    }
}


text:
[![Dependency Status](https://gemnasium.com/tmcw/force-geojson.png)](https://gemnasium.com/tmcw/force-geojson)

[![](http://api.tiles.mapbox.com/v3/tmcw.miserables/0,0,2/400x300.png)](http://a.tiles.mapbox.com/v3/tmcw.miserables/page.html#1.00/0/20)

Marrying [d3js](http://d3js.org/)'s [force directed graph implementation](http://bl.ocks.org/mbostock/4062045)
with [GeoJSON](http://www.geojson.org/) so you can abuse map-making tools
like [TileMill](http://www.mapbox.com/tilemill/) to make big big force directed
graphs.

    npm install -g force-geojson

    force-geojson foo.json > foo.geojson

The input needs to be formatted like d3 wants it to be: [read the docs](https://github.com/mbostock/d3/wiki/Force-Layout).

Takes a few options:

* `times`: how many iterations to work on the graph position
* `padx`: how close points can get to -180 and 180 longitude
* `pady`: how close points can get to -90 and 90 latitude

redpajama_set_name: RedPajamaGithub


text:
/**
 * @author Igor V. Stolyarov
 */
package com.google.code.appengine.awt.image.renderable;

import com.google.code.appengine.awt.geom.Rectangle2D;
import com.google.code.appengine.awt.image.RenderedImage;
import com.google.code.appengine.awt.image.renderable.ParameterBlock;
import com.google.code.appengine.awt.image.renderable.RenderContext;
import com.google.code.appengine.awt.image.renderable.RenderableImage;
import com.google.code.appengine.awt.image.renderable.RenderedImageFactory;

public interface ContextualRenderedImageFactory extends RenderedImageFactory {

    public RenderContext mapRenderContext(int a0, RenderContext a1, ParameterBlock a2, RenderableImage a3);

    public Object getProperty(ParameterBlock a0, String a1);

    public RenderedImage create(RenderContext a0, ParameterBlock a1);

    public Rectangle2D getBounds2D(ParameterBlock a0);

    public String[] getPropertyNames();

    public boolean isDynamic();

}


text:
code: true
type: page
title: getSpecifications
description: Collection:getSpecifications
---

# getSpecifications

Retrieves the specifications linked to the collection object.

---

## getSpecifications([options], callback)

| Arguments  | Type        | Description                    |
| ---------- | ----------- | ------------------------------ |
| `options`  | JSON Object | Optional parameters            |
| `callback` | function    | Callback handling the response |

---

## Options

| Option     | Type    | Description                       | Default |
| ---------- | ------- | --------------------------------- | ------- |
| `queuable` | boolean | Make this request queuable or not | `true`  |

## Usage

<<< ./snippets/get-specifications-1.java

> Callback response

```json
{
  "validation": {
    "strict": "true",
    "fields": {
      "foo": {
        "mandatory": "true",
        "type": "string",
        "defaultValue": "bar"
      }
    }
  },
  "index": "index",
  "collection": "collection"
}
```


text:
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateQrcodesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('qrcodes', function (Blueprint $table) {
            $table->increments('id');
            $table->string('code')->unique()->comment('代碼');
            $table->string('student_nid')->nullable()->comment('對應學生');
            $table->timestamp('bind_at')->nullable()->comment('綁定時間');
            $table->unsignedInteger('qrcode_set_id')->nullable();
            $table->boolean('auto_generated')->default(true)->comment('自動建立');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('qrcodes');
    }
}


text:
class LoreSchool < ApplicationRecord
  belongs_to :lore
  belongs_to :school, optional: true

  belongs_to :user, optional: true
end


text:
require 'bundler/setup'

begin
  require 'byebug'
rescue LoadError
  # no debugger available
end

ENV['RACK_ENV'] = 'test'

require 'minitest/autorun'
require 'minitest/pride'
require 'rack/test'
require 'json'
require 'webmock/minitest'
require 'openssl'
require 'base64'

require File.expand_path('../../lib/sheldon', __FILE__)

WebMock.disable_net_connect! allow_localhost: true

include Rack::Test::Methods

FIXTURES = File.expand_path('../fixtures', __FILE__)

def fixtures(name)
  File.read File.join(FIXTURES, name)
end

def payloads(name)
  JSON.parse fixtures("#{name}.json")
end

def app
  Sheldon::Bot
end

KEY = OpenSSL::PKey::RSA.new 512

def travis_config
  JSON.generate({
    config: {
      notifications: { webhook: { public_key: KEY.public_key.to_pem } }
    }
  })
end

def hookshot(path, type = 'test', data = {})
  data = payloads(data) unless data.is_a? Hash

  post path, data.to_json,
    'HTTP_X_GITHUB_EVENT' => type.to_s,
    'CONTENT_TYPE' => 'application/json',
    'HTTP_USER_AGENT' => 'GitHub-Hookshot/b4dc0de'
end

def travis_notify(path, data = {}, tamper = '')
  data = payloads(data) unless data.is_a? Hash
  repo = 'inukshuk/styles'
  payload = data.to_json

  post path, { payload: payload },
    'HTTP_SIGNATURE' =>
      Base64.encode64(KEY.sign(OpenSSL::Digest::SHA1.new, payload + tamper)),
    'HTTP_TRAVIS_REPO_SLUG' => repo
end


text:
#include "config.h"
#include "modules/crypto/SubtleCrypto.h"

#include "bindings/core/v8/Dictionary.h"
#include "core/dom/ExecutionContext.h"
#include "modules/crypto/CryptoKey.h"
#include "modules/crypto/CryptoResultImpl.h"
#include "modules/crypto/NormalizeAlgorithm.h"
#include "platform/JSONValues.h"
#include "public/platform/Platform.h"
#include "public/platform/WebCrypto.h"
#include "public/platform/WebCryptoAlgorithm.h"

namespace blink {

template <>
DOMArrayPiece::DOMArrayPiece(const BufferSource& bufferSource)
{
    void* data = nullptr;
    unsigned len = 0;

    if (bufferSource.isArrayBuffer()) {
        data = bufferSource.getAsArrayBuffer()->data();
        len = bufferSource.getAsArrayBuffer()->byteLength();
    } else if (bufferSource.isArrayBufferView()) {
        data = bufferSource.getAsArrayBufferView()->baseAddress();
        len = bufferSource.getAsArrayBufferView()->byteLength();
    }
    initWithData(data, len);
}

static bool parseAlgorithm(const AlgorithmIdentifier& raw, WebCryptoOperation op, WebCryptoAlgorithm& algorithm, CryptoResult* result)
{
    AlgorithmError error;
    bool success = normalizeAlgorithm(raw, op, algorithm, &error);
    if (!success)
        result->completeWithError(error.errorType, error.errorDetails);
    return success;
}

static bool canAccessWebCrypto(ScriptState* scriptState, CryptoResult* result)
{
    const SecurityOrigin* origin = scriptState->executionContext()->securityOrigin();
    String errorMessage;
    if (!origin->canAccessFeatureRequiringSecureOrigin(errorMessage)) {
        result->completeWithError(WebCryptoErrorTypeNotSupported, errorMessage);
        return false;
    }

    return true;
}

static bool copyStringProperty(const char* property, const Dictionary& source, JSONObject* destination)
{
    String value;
    if (!DictionaryHelper::get(source, property, value))
        return false;
    destination->setString(property, value);
    return true;
}

static bool copySequenceOfStringProperty(const char* property, const Dictionary& source, JSONObject* destination)
{
    Vector<String> value;
    if (!DictionaryHelper::get(source, property, value))
        return false;
    RefPtr<JSONArray> jsonArray = JSONArray::create();
    for (unsigned i = 0; i < value.size(); ++i)
        jsonArray->pushString(value[i]);
    destination->setArray(property, jsonArray.release());
    return true;
}

// FIXME: At the time of writing this is not a part of the spec. It is based an
// an unpublished editor's draft for:
//   https://www.w3.org/Bugs/Public/show_bug.cgi?id=24963
// See http://crbug.com/373917.
static bool copyJwkDictionaryToJson(const Dictionary& dict, CString& jsonUtf8, CryptoResult* result)
{
    RefPtr<JSONObject> jsonObject = JSONObject::create();

    if (!copyStringProperty("kty", dict, jsonObject.get())) {
        result->completeWithError(WebCryptoErrorTypeData, "The required JWK member \"kty\" was missing");
        return false;
    }

    copyStringProperty("use", dict, jsonObject.get());
    copySequenceOfStringProperty("key_ops", dict, jsonObject.get());
    copyStringProperty("alg", dict, jsonObject.get());

    bool ext;
    if (DictionaryHelper::get(dict, "ext", ext))
        jsonObject->setBoolean("ext", ext);

    const char* const propertyNames[] = { "d", "n", "e", "p", "q", "dp", "dq", "qi", "k", "crv", "x", "y" };
    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(propertyNames); ++i)
        copyStringProperty(propertyNames[i], dict, jsonObject.get());

    String json = jsonObject->toJSONString();
    jsonUtf8 = json.utf8();
    return true;
}

SubtleCrypto::SubtleCrypto()
{
}

ScriptPromise SubtleCrypto::encrypt(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, CryptoKey* key, const DOMArrayPiece& data)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoAlgorithm algorithm;
    if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationEncrypt, algorithm, result.get()))
        return promise;

    if (!key->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageEncrypt, result.get()))
        return promise;

    Platform::current()->crypto()->encrypt(algorithm, key->key(), data.bytes(), data.byteLength(), result->result());
    return promise;
}

ScriptPromise SubtleCrypto::decrypt(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, CryptoKey* key, const DOMArrayPiece& data)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoAlgorithm algorithm;
    if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDecrypt, algorithm, result.get()))
        return promise;

    if (!key->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageDecrypt, result.get()))
        return promise;

    Platform::current()->crypto()->decrypt(algorithm, key->key(), data.bytes(), data.byteLength(), result->result());
    return promise;
}

ScriptPromise SubtleCrypto::sign(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, CryptoKey* key, const DOMArrayPiece& data)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoAlgorithm algorithm;
    if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationSign, algorithm, result.get()))
        return promise;

    if (!key->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageSign, result.get()))
        return promise;

    Platform::current()->crypto()->sign(algorithm, key->key(), data.bytes(), data.byteLength(), result->result());
    return promise;
}

ScriptPromise SubtleCrypto::verifySignature(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, CryptoKey* key, const DOMArrayPiece& signature, const DOMArrayPiece& data)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoAlgorithm algorithm;
    if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationVerify, algorithm, result.get()))
        return promise;

    if (!key->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageVerify, result.get()))
        return promise;

    Platform::current()->crypto()->verifySignature(algorithm, key->key(), signature.bytes(), signature.byteLength(), data.bytes(), data.byteLength(), result->result());
    return promise;
}

ScriptPromise SubtleCrypto::digest(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, const DOMArrayPiece& data)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoAlgorithm algorithm;
    if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDigest, algorithm, result.get()))
        return promise;

    Platform::current()->crypto()->digest(algorithm, data.bytes(), data.byteLength(), result->result());
    return promise;
}

ScriptPromise SubtleCrypto::generateKey(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, bool extractable, const Vector<String>& rawKeyUsages)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoKeyUsageMask keyUsages;
    if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result.get()))
        return promise;

    WebCryptoAlgorithm algorithm;
    if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationGenerateKey, algorithm, result.get()))
        return promise;

    Platform::current()->crypto()->generateKey(algorithm, extractable, keyUsages, result->result());
    return promise;
}

ScriptPromise SubtleCrypto::importKey(ScriptState* scriptState, const String& rawFormat, const ArrayBufferOrArrayBufferViewOrDictionary& keyData, const AlgorithmIdentifier& rawAlgorithm, bool extractable, const Vector<String>& rawKeyUsages)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoKeyFormat format;
    if (!CryptoKey::parseFormat(rawFormat, format, result.get()))
        return promise;

    if (keyData.isDictionary()) {
        if (format != WebCryptoKeyFormatJwk) {
            result->completeWithError(WebCryptoErrorTypeData, "Key data must be a buffer for non-JWK formats");
            return promise;
        }
    } else if (format == WebCryptoKeyFormatJwk) {
        result->completeWithError(WebCryptoErrorTypeData, "Key data must be an object for JWK import");
        return promise;
    }

    WebCryptoKeyUsageMask keyUsages;
    if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result.get()))
        return promise;

    WebCryptoAlgorithm algorithm;
    if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationImportKey, algorithm, result.get()))
        return promise;

    const unsigned char* ptr = nullptr;
    unsigned len = 0;

    CString jsonUtf8;
    if (keyData.isArrayBuffer()) {
        ptr = static_cast<const unsigned char*>(keyData.getAsArrayBuffer()->data());
        len = keyData.getAsArrayBuffer()->byteLength();
    } else if (keyData.isArrayBufferView()) {
        ptr = static_cast<const unsigned char*>(keyData.getAsArrayBufferView()->baseAddress());
        len = keyData.getAsArrayBufferView()->byteLength();
    } else if (keyData.isDictionary()) {
        if (!copyJwkDictionaryToJson(keyData.getAsDictionary(), jsonUtf8, result.get()))
            return promise;
        ptr = reinterpret_cast<const unsigned char*>(jsonUtf8.data());
        len = jsonUtf8.length();
    }
    Platform::current()->crypto()->importKey(format, ptr, len, algorithm, extractable, keyUsages, result->result());
    return promise;
}

ScriptPromise SubtleCrypto::exportKey(ScriptState* scriptState, const String& rawFormat, CryptoKey* key)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoKeyFormat format;
    if (!CryptoKey::parseFormat(rawFormat, format, result.get()))
        return promise;

    if (!key->extractable()) {
        result->completeWithError(WebCryptoErrorTypeInvalidAccess, "key is not extractable");
        return promise;
    }

    Platform::current()->crypto()->exportKey(format, key->key(), result->result());
    return promise;
}

ScriptPromise SubtleCrypto::wrapKey(ScriptState* scriptState, const String& rawFormat, CryptoKey* key, CryptoKey* wrappingKey, const AlgorithmIdentifier& rawWrapAlgorithm)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoKeyFormat format;
    if (!CryptoKey::parseFormat(rawFormat, format, result.get()))
        return promise;

    WebCryptoAlgorithm wrapAlgorithm;
    if (!parseAlgorithm(rawWrapAlgorithm, WebCryptoOperationWrapKey, wrapAlgorithm, result.get()))
        return promise;

    if (!key->extractable()) {
        result->completeWithError(WebCryptoErrorTypeInvalidAccess, "key is not extractable");
        return promise;
    }

    if (!wrappingKey->canBeUsedForAlgorithm(wrapAlgorithm, WebCryptoKeyUsageWrapKey, result.get()))
        return promise;

    Platform::current()->crypto()->wrapKey(format, key->key(), wrappingKey->key(), wrapAlgorithm, result->result());
    return promise;
}

ScriptPromise SubtleCrypto::unwrapKey(ScriptState* scriptState, const String& rawFormat, const DOMArrayPiece& wrappedKey, CryptoKey* unwrappingKey, const AlgorithmIdentifier& rawUnwrapAlgorithm, const AlgorithmIdentifier& rawUnwrappedKeyAlgorithm, bool extractable, const Vector<String>& rawKeyUsages)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoKeyFormat format;
    if (!CryptoKey::parseFormat(rawFormat, format, result.get()))
        return promise;

    WebCryptoKeyUsageMask keyUsages;
    if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result.get()))
        return promise;

    WebCryptoAlgorithm unwrapAlgorithm;
    if (!parseAlgorithm(rawUnwrapAlgorithm, WebCryptoOperationUnwrapKey, unwrapAlgorithm, result.get()))
        return promise;

    WebCryptoAlgorithm unwrappedKeyAlgorithm;
    if (!parseAlgorithm(rawUnwrappedKeyAlgorithm, WebCryptoOperationImportKey, unwrappedKeyAlgorithm, result.get()))
        return promise;

    if (!unwrappingKey->canBeUsedForAlgorithm(unwrapAlgorithm, WebCryptoKeyUsageUnwrapKey, result.get()))
        return promise;

    Platform::current()->crypto()->unwrapKey(format, wrappedKey.bytes(), wrappedKey.byteLength(), unwrappingKey->key(), unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages, result->result());
    return promise;
}

ScriptPromise SubtleCrypto::deriveBits(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, CryptoKey* baseKey, unsigned lengthBits)
{
    RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoAlgorithm algorithm;
    if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDeriveBits, algorithm, result.get()))
        return promise;

    if (!baseKey->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageDeriveBits, result.get()))
        return promise;

    Platform::current()->crypto()->deriveBits(algorithm, baseKey->key(), lengthBits, result->result());
    return promise;
}

ScriptPromise SubtleCrypto::deriveKey(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, CryptoKey* baseKey, const AlgorithmIdentifier& rawDerivedKeyType, bool extractable, const Vector<String>& rawKeyUsages)
{
    RefPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
    ScriptPromise promise = result->promise();

    if (!canAccessWebCrypto(scriptState, result.get()))
        return promise;

    WebCryptoKeyUsageMask keyUsages;
    if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result.get()))
        return promise;

    WebCryptoAlgorithm algorithm;
    if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDeriveBits, algorithm, result.get()))
        return promise;

    if (!baseKey->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageDeriveKey, result.get()))
        return promise;

    WebCryptoAlgorithm importAlgorithm;
    if (!parseAlgorithm(rawDerivedKeyType, WebCryptoOperationImportKey, importAlgorithm, result.get()))
        return promise;

    WebCryptoAlgorithm keyLengthAlgorithm;
    if (!parseAlgorithm(rawDerivedKeyType, WebCryptoOperationGetKeyLength, keyLengthAlgorithm, result.get()))
        return promise;

    Platform::current()->crypto()->deriveKey(algorithm, baseKey->key(), importAlgorithm, keyLengthAlgorithm, extractable, keyUsages, result->result());
    return promise;
}

} // namespace blink


text:
NAME = batteries

VERSION := $(shell grep "^Version:" _oasis | cut -c 15-)
OCAML_MAJOR_VERSION := $(firstword $(subst ., , $(shell ocamlfind ocamlc -version)))
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')

# Define variables and export them for mkconf.ml
DOCROOT ?= /usr/share/doc/ocaml-batteries
export DOCROOT
BROWSER_COMMAND ?= x-www-browser
export BROWSER_COMMAND

OCAMLBUILD ?= ocamlbuild
OCAMLBUILDFLAGS ?= -no-links

ifeq ($(uname_S),Darwin)
  BATTERIES_NATIVE ?= yes
  BATTERIES_NATIVE_SHLIB ?= no
else
  BATTERIES_NATIVE ?= yes
  BATTERIES_NATIVE_SHLIB ?= $(BATTERIES_NATIVE)
endif

# Directory where to build the qtest suite
QTESTDIR ?= qtest

INSTALL_FILES = _build/META _build/src/*.cma \
	battop.ml _build/src/*.cmi _build/src/*.mli \
	_build/src/batteriesHelp.cmo _build/src/batteriesConfig.cmo _build/src/batteriesPrint.cmo \
	ocamlinit build/ocaml
OPT_INSTALL_FILES = _build/src/*.cmx _build/src/*.a _build/src/*.cmxa \
	_build/src/*.cmxs _build/src/*.lib

# What to build
TARGETS  = src/batteries.cma
TARGETS += src/batteriesHelp.cmo
TARGETS += src/batteriesThread.cma
TARGETS += META
BENCH_TARGETS  = benchsuite/bench_int.native
BENCH_TARGETS += benchsuite/flip.native
BENCH_TARGETS += benchsuite/deque.native
BENCH_TARGETS += benchsuite/lines_of.native
BENCH_TARGETS += benchsuite/bitset.native
BENCH_TARGETS += benchsuite/bench_map.native
BENCH_TARGETS += benchsuite/bench_nreplace.native
TEST_TARGET = test-byte

ifeq ($(BATTERIES_NATIVE_SHLIB), yes)
  EXT = native
  MODE = shared
  TARGETS += src/batteries.cmxs src/batteriesThread.cmxs
  TEST_TARGET = test-native
else
ifeq ($(BATTERIES_NATIVE), yes)
  EXT = native
  MODE = native
  TARGETS += src/batteries.cmxa src/batteriesThread.cmxa
  TEST_TARGET = test-native
else
  EXT = byte
  MODE = bytecode
endif
endif

.PHONY: all clean doc install uninstall reinstall test qtest qtest-clean camfail camfailunk coverage man

all: prefilter
	@echo "Build mode:" $(MODE)
	$(OCAMLBUILD) $(OCAMLBUILDFLAGS) $(TARGETS)

clean:
	@${RM} src/batteriesConfig.ml src/batUnix.mli batteries.odocl bench.log
	@${RM} -r man/
	@$(OCAMLBUILD) -clean
	@git clean -xfd
	@echo " Cleaned up working copy" # Note: ocamlbuild eats the first char!

batteries.odocl: src/batteries.mllib src/batteriesThread.mllib
	cat $^ > $@

doc: prefilter batteries.odocl
	$(OCAMLBUILD) batteries.docdir/index.html

man: all batteries.odocl
	-mkdir man
	ocamlfind ocamldoc -package threads.posix -sort -man -hide-warnings -d man -I _build/libs -I _build/src libs/uniclib.mli src/*.mli

install: all uninstall_packages
	ocamlfind install $(NAME) $(INSTALL_FILES) \
		-optional $(OPT_INSTALL_FILES)

uninstall_packages:
	ocamlfind remove $(NAME)

uninstall: uninstall_packages
	${RM} -r $(DOCROOT)

install-doc: doc
	mkdir -p $(DOCROOT)
	mkdir -p $(DOCROOT)/html/api
	cp _build/batteries.docdir/* $(DOCROOT)/html/api
	cp LICENSE README.md FAQ $(DOCROOT)

install-man: man
	install man/* /usr/local/man/man3/

reinstall:
	$(MAKE) uninstall
	$(MAKE) install

###############################################################################
#	Pre-Processing of Source Code
###############################################################################

prefilter: src/batMarshal.mli src/batUnix.mli src/batPervasives.mli \
	   src/batInnerPervasives.ml src/batHashtbl.ml

# Ocaml 4.00 can benefit strongly from some pre-processing to expose
# slightly different interfaces
.SUFFIXES: .mli .mliv .ml .mlv

# Look for lines starting with ##Vx##, and delete just the tag or the
# whole line depending whether the x matches the ocaml major version
.mliv.mli:
	ocaml str.cma build/prefilter.ml < $^ > $@

.mlv.ml:
	ocaml str.cma build/prefilter.ml < $^ > $@

###############################################################################
#	BUILDING AND RUNNING UNIT TESTS
###############################################################################

### List of source files that it's okay to try to test

DONTTEST=src/batteriesHelp.ml
TESTABLE ?= $(filter-out $(DONTTEST), $(wildcard src/*.ml))
TESTDEPS = $(TESTABLE)

### Test suite: "offline" unit tests
##############################################

_build/testsuite/main.byte: $(TESTDEPS) $(wildcard testsuite/*.ml)
	$(OCAMLBUILD) $(OCAMLBUILDFLAGS) testsuite/main.byte
_build/testsuite/main.native: $(TESTDEPS) $(wildcard testsuite/*.ml)
	$(OCAMLBUILD) $(OCAMLBUILDFLAGS) testsuite/main.native

### qtest: "inline" unit tests
##############################################

# extract all qtest unit tests into a single ml file
$(QTESTDIR)/all_tests.ml: $(TESTABLE)
	qtest -o $@ --shuffle --preamble-file qtest/qtest_preamble.ml extract $(TESTABLE)

_build/$(QTESTDIR)/all_tests.byte: $(QTESTDIR)/all_tests.ml
	$(OCAMLBUILD) $(OCAMLBUILDFLAGS) -cflags -warn-error,+26 -use-ocamlfind -pkg oUnit,QTest2Lib $(QTESTDIR)/all_tests.byte
_build/$(QTESTDIR)/all_tests.native: $(QTESTDIR)/all_tests.ml
	$(OCAMLBUILD) $(OCAMLBUILDFLAGS) -cflags -warn-error,+26 -use-ocamlfind -pkg oUnit,QTest2Lib $(QTESTDIR)/all_tests.native

### qtest: quick run of inline unit tests
##############################################
# $ make qtest TESTABLE=foo.ml
# will only test the module Foo.

qtest-clean:
	@${RM} $(QTESTDIR)/all_tests.ml
	@${MAKE} _build/$(QTESTDIR)/all_tests.$(EXT)

qtest: prefilter qtest-clean
	@_build/$(QTESTDIR)/all_tests.$(EXT)

### run all unit tests
##############################################

test-byte: prefilter _build/testsuite/main.byte _build/$(QTESTDIR)/all_tests.byte
	@_build/testsuite/main.byte
	@echo "" # newline after "OK"
	@_build/$(QTESTDIR)/all_tests.byte

test-native: prefilter _build/testsuite/main.native _build/$(QTESTDIR)/all_tests.native
	@_build/testsuite/main.native
	@echo "" # newline after "OK"
	@_build/$(QTESTDIR)/all_tests.native

full-test: $(TEST_TARGET)

test-compat: src/batteries_compattest.ml
	ocamlbuild src/batteries_compattest.byte -no-links

test: test-byte test-compat

###############################################################################
#	BENCHMARK SUITE
###############################################################################

bench:
	$(OCAMLBUILD) $(OCAMLBUILDFLAGS) $(TARGETS) $(BENCH_TARGETS)
	$(RM) bench.log
	$(foreach BENCH, $(BENCH_TARGETS), _build/$(BENCH) | tee -a bench.log; )
	@echo "Benchmarking results are written to bench.log"

###############################################################################
#	PREPARING RELEASE FILES
###############################################################################

release:
	$(MAKE) clean
	git stash save "stashing local modifications before release"
	$(MAKE) release-cleaned

# assumes irreproachably pristine working directory
release-cleaned: setup.ml doc test
	git archive --format=tar --prefix=batteries-$(VERSION)/ HEAD \
	  | gzip > batteries-$(VERSION).tar.gz

setup.ml: _oasis
	oasis setup
	git commit setup.ml -m"Update setup.ml based on _oasis"

# uploads the current documentation to github hdoc2/ directory
upload-docs:
	make doc && git checkout gh-pages && rm -f hdoc2/*.html && cp _build/batteries.docdir/*.html hdoc2/ && git add hdoc2/*.html && git commit -a -m"Update to latest documentation" && git push github gh-pages

###############################################################################
#	CODE COVERAGE REPORTS
###############################################################################

coverage/index.html: $(TESTDEPS) $(QTESTDIR)/all_tests.ml
	$(OCAMLBUILD) coverage/index.html

coverage: coverage/index.html

.PHONY: tags
tags:


text: DEFAULT_DATA_RETENTION_HOURS = ENV["DEFAULT_DATA_RETENTION_HOURS"].to_i


text:
/*
    This file is part of the WebKit open source project.
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library 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
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#include "config.h"

#if ENABLE(XSLT)

#include "JSXSLTProcessor.h"

#include "Document.h"
#include "DocumentFragment.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "NodeFilter.h"
#include "XSLTProcessor.h"
#include <runtime/Error.h>
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

ASSERT_CLASS_FITS_IN_CELL(JSXSLTProcessor);

/* Hash table */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif

static const HashTableValue JSXSLTProcessorTableValues[2] =
{
    { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXSLTProcessorConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
};

#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSXSLTProcessorTable = { 2, 1, JSXSLTProcessorTableValues, 0 };
/* Hash table for constructor */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif

static const HashTableValue JSXSLTProcessorConstructorTableValues[1] =
{
    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
};

#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSXSLTProcessorConstructorTable = { 1, 0, JSXSLTProcessorConstructorTableValues, 0 };
const ClassInfo JSXSLTProcessorConstructor::s_info = { "XSLTProcessorConstructor", &DOMConstructorObject::s_info, &JSXSLTProcessorConstructorTable, 0 };

JSXSLTProcessorConstructor::JSXSLTProcessorConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
    : DOMConstructorObject(structure, globalObject)
{
    ASSERT(inherits(&s_info));
    putDirect(exec->globalData(), exec->propertyNames().prototype, JSXSLTProcessorPrototype::self(exec, globalObject), DontDelete | ReadOnly);
}

bool JSXSLTProcessorConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSXSLTProcessorConstructor, JSDOMWrapper>(exec, &JSXSLTProcessorConstructorTable, this, propertyName, slot);
}

bool JSXSLTProcessorConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSXSLTProcessorConstructor, JSDOMWrapper>(exec, &JSXSLTProcessorConstructorTable, this, propertyName, descriptor);
}

ConstructType JSXSLTProcessorConstructor::getConstructData(ConstructData& constructData)
{
    constructData.native.function = constructJSXSLTProcessor;
    return ConstructTypeHost;
}

/* Hash table for prototype */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif

static const HashTableValue JSXSLTProcessorPrototypeTableValues[9] =
{
    { "importStylesheet", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionImportStylesheet), (intptr_t)1 THUNK_GENERATOR(0) },
    { "transformToFragment", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionTransformToFragment), (intptr_t)2 THUNK_GENERATOR(0) },
    { "transformToDocument", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionTransformToDocument), (intptr_t)1 THUNK_GENERATOR(0) },
    { "setParameter", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionSetParameter), (intptr_t)3 THUNK_GENERATOR(0) },
    { "getParameter", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionGetParameter), (intptr_t)2 THUNK_GENERATOR(0) },
    { "removeParameter", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionRemoveParameter), (intptr_t)2 THUNK_GENERATOR(0) },
    { "clearParameters", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionClearParameters), (intptr_t)0 THUNK_GENERATOR(0) },
    { "reset", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXSLTProcessorPrototypeFunctionReset), (intptr_t)0 THUNK_GENERATOR(0) },
    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
};

#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSXSLTProcessorPrototypeTable = { 17, 15, JSXSLTProcessorPrototypeTableValues, 0 };
const ClassInfo JSXSLTProcessorPrototype::s_info = { "XSLTProcessorPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSXSLTProcessorPrototypeTable, 0 };

JSObject* JSXSLTProcessorPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSXSLTProcessor>(exec, globalObject);
}

bool JSXSLTProcessorPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticFunctionSlot<JSObject>(exec, &JSXSLTProcessorPrototypeTable, this, propertyName, slot);
}

bool JSXSLTProcessorPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticFunctionDescriptor<JSObject>(exec, &JSXSLTProcessorPrototypeTable, this, propertyName, descriptor);
}

const ClassInfo JSXSLTProcessor::s_info = { "XSLTProcessor", &JSDOMWrapper::s_info, &JSXSLTProcessorTable, 0 };

JSXSLTProcessor::JSXSLTProcessor(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<XSLTProcessor> impl)
    : JSDOMWrapper(structure, globalObject)
    , m_impl(impl)
{
    ASSERT(inherits(&s_info));
}

JSObject* JSXSLTProcessor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
    return new (exec) JSXSLTProcessorPrototype(exec->globalData(), globalObject, JSXSLTProcessorPrototype::createStructure(globalObject->globalData(), globalObject->objectPrototype()));
}

bool JSXSLTProcessor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSXSLTProcessor, Base>(exec, &JSXSLTProcessorTable, this, propertyName, slot);
}

bool JSXSLTProcessor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSXSLTProcessor, Base>(exec, &JSXSLTProcessorTable, this, propertyName, descriptor);
}

JSValue jsXSLTProcessorConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXSLTProcessor* domObject = static_cast<JSXSLTProcessor*>(asObject(slotBase));
    return JSXSLTProcessor::getConstructor(exec, domObject->globalObject());
}

JSValue JSXSLTProcessor::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMConstructor<JSXSLTProcessorConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
}

EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionImportStylesheet(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXSLTProcessor::s_info))
        return throwVMTypeError(exec);
    JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
    return JSValue::encode(castedThis->importStylesheet(exec));
}

EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionTransformToFragment(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXSLTProcessor::s_info))
        return throwVMTypeError(exec);
    JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
    return JSValue::encode(castedThis->transformToFragment(exec));
}

EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionTransformToDocument(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXSLTProcessor::s_info))
        return throwVMTypeError(exec);
    JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
    return JSValue::encode(castedThis->transformToDocument(exec));
}

EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionSetParameter(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXSLTProcessor::s_info))
        return throwVMTypeError(exec);
    JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
    return JSValue::encode(castedThis->setParameter(exec));
}

EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionGetParameter(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXSLTProcessor::s_info))
        return throwVMTypeError(exec);
    JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
    return JSValue::encode(castedThis->getParameter(exec));
}

EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionRemoveParameter(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXSLTProcessor::s_info))
        return throwVMTypeError(exec);
    JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
    return JSValue::encode(castedThis->removeParameter(exec));
}

EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionClearParameters(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXSLTProcessor::s_info))
        return throwVMTypeError(exec);
    JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
    XSLTProcessor* imp = static_cast<XSLTProcessor*>(castedThis->impl());

    imp->clearParameters();
    return JSValue::encode(jsUndefined());
}

EncodedJSValue JSC_HOST_CALL jsXSLTProcessorPrototypeFunctionReset(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXSLTProcessor::s_info))
        return throwVMTypeError(exec);
    JSXSLTProcessor* castedThis = static_cast<JSXSLTProcessor*>(asObject(thisValue));
    XSLTProcessor* imp = static_cast<XSLTProcessor*>(castedThis->impl());

    imp->reset();
    return JSValue::encode(jsUndefined());
}

JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XSLTProcessor* impl)
{
    return wrap<JSXSLTProcessor>(exec, globalObject, impl);
}

XSLTProcessor* toXSLTProcessor(JSC::JSValue value)
{
    return value.inherits(&JSXSLTProcessor::s_info) ? static_cast<JSXSLTProcessor*>(asObject(value))->impl() : 0;
}

}

#endif // ENABLE(XSLT)


text:
function checkStrStart(str, startsWithStr) {

    let checkSubstr = str.substr(0, startsWithStr.length)

    if (checkSubstr === startsWithStr) {
        return true
    }

    return false
}

console.log(checkStrStart('The quick brown fox…',
'The quick brown fox…'))


text:
package eu.neoteric.starter.mvc.logging;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.IThrowableProxy;
import ch.qos.logback.core.Appender;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.slf4j.LoggerFactory;

import java.util.LinkedList;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.atMost;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;

public class LogbackVerifier implements TestRule {
    private List<ExpectedLogEvent> expectedEvents = new LinkedList<>();

    @Mock
    private Appender<ILoggingEvent> appender;

    @Override
    public Statement apply(final Statement base, Description description) {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                before();
                try {
                    base.evaluate();
                    verify();
                } finally {
                    after();
                }
            }
        };
    }

    public void expectMessage(Level level) {
        expectMessage(level, "");
    }

    public void expectMessage(Level level, String msg) {
        expectMessage(level, msg, null);
    }

    public void expectMessage(Level level, String msg, Class<? extends Throwable> throwableClass) {
        expectedEvents.add(new ExpectedLogEvent(level, msg, throwableClass));
    }

    private void before() {
        initMocks(this);
        when(appender.getName()).thenReturn("MOCK");
        ((Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).addAppender(appender);
    }

    private void verify() throws Throwable {
        ArgumentCaptor<ILoggingEvent> captor = ArgumentCaptor.forClass(ILoggingEvent.class);
        Mockito.verify(appender, atMost(10)).doAppend(captor.capture());
        List<ILoggingEvent> allValues = captor.getAllValues();
        assertThat(expectedEvents)
                .filteredOn(event -> allValues.stream().noneMatch(event::matches))
                .hasSize(0);
    }

    private void after() {
        ((Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).detachAppender(appender);
    }

    private final static class ExpectedLogEvent {
        private final String message;
        private final Level level;
        private final Class<? extends Throwable> throwableClass;

        private ExpectedLogEvent(Level level, String message, Class<? extends Throwable> throwableClass) {
            this.message = message;
            this.level = level;
            this.throwableClass = throwableClass;
        }

        private boolean matches(ILoggingEvent actual) {
            boolean match = actual.getFormattedMessage().contains(message);
            match &= actual.getLevel().equals(level);
            match &= matchThrowables(actual);
            return match;
        }

        private boolean matchThrowables(ILoggingEvent actual) {
            IThrowableProxy eventProxy = actual.getThrowableProxy();
            return throwableClass == null || eventProxy != null && throwableClass.getName().equals(eventProxy.getClassName());
        }
    }
}


text:
#ifndef ZEPHIR_KERNEL_DEBUG_H
#define ZEPHIR_KERNEL_DEBUG_H

#ifndef ZEPHIR_RELEASE

#include <php.h>

#define PHV(v) zephir_vdump(v)
#define PHPR(v) zephir_print_r(v)

typedef struct _zephir_debug_entry {
	struct _zephir_debug_entry *prev;
	struct _zephir_debug_entry *next;
	char *class_name;
	char *method_name;
	int lineno;
} zephir_debug_entry;

int zephir_start_debug();
int zephir_stop_debug();

int zephir_print_r(zval *userval TSRMLS_DC);
int zephir_vdump(zval *uservar TSRMLS_DC);
int zephir_debug_assign(char *name, zval *value TSRMLS_DC);
int zephir_vpdump(const zval **uservar TSRMLS_DC);
int zephir_dump_ce(zend_class_entry *ce TSRMLS_DC);
int zephir_class_debug(zval *val TSRMLS_DC);

int zephir_debug_backtrace_internal();
int zephir_debug_str(char *what, char *message);
int zephir_debug_long(char *what, uint vlong);
int zephir_debug_screen(char *message);

int zephir_step_over(char *message);
int zephir_step_into(char *message);
int zephir_step_out(char *message);

int zephir_step_into_entry(char *class_name, char *method_name, int lineno);
int zephir_step_out_entry();

int zephir_debug_method_call(zval *obj, char *method_name TSRMLS_DC);
int zephir_debug_vdump(char *preffix, zval *value TSRMLS_DC);
int zephir_debug_param(zval *param TSRMLS_DC);

int zephir_error_space();
int zephir_debug_space();

#endif
#endif


text:
package com.planet_ink.coffee_mud.Items.Weapons;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

public class Sabre extends StdWeapon
{
	public String ID(){	return "Sabre";}
	public Sabre()
	{
		super();

		setName("a sabre");
		setDisplayText("a sabre has been dropped by someone.");
		setDescription("A slender piece of metal with a fancy silver basket-hilt.");
		baseEnvStats().setAbility(0);
		baseEnvStats().setLevel(2);
		baseEnvStats.setWeight(5);
		baseEnvStats().setAttackAdjustment(0);
		baseEnvStats().setDamage(6);
		baseGoldValue=15;
		recoverEnvStats();
		material=RawMaterial.RESOURCE_STEEL;
		weaponType=TYPE_SLASHING;//?????????
		weaponClassification=Weapon.CLASS_SWORD;
	}

}


text:
<?php

namespace Rmc\Core\UserSearchBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
    public function indexAction()
    {
        $users = $this->get('rmc_core_user.search_manager')->getQueryByCriteria(array('firstName' => 'Samir1'))->execute();

        return $this->render('RmcCoreUserSearchBundle:Default:index.html.twig');
    }
}


text:
package org.bigiot.examples;

import java.io.IOException;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.ExecutionException;

import org.eclipse.bigiot.lib.Consumer;
import org.eclipse.bigiot.lib.exceptions.AccessToNonActivatedOfferingException;
import org.eclipse.bigiot.lib.exceptions.AccessToNonSubscribedOfferingException;
import org.eclipse.bigiot.lib.exceptions.IncompleteOfferingQueryException;
import org.eclipse.bigiot.lib.feed.AccessFeed;
import org.eclipse.bigiot.lib.misc.BridgeIotProperties;
import org.eclipse.bigiot.lib.model.BigIotTypes.LicenseType;
import org.eclipse.bigiot.lib.model.BigIotTypes.PricingModel;
import org.eclipse.bigiot.lib.model.BigIotTypes.ValueType;
import org.eclipse.bigiot.lib.model.Price.Euros;
import org.eclipse.bigiot.lib.offering.AccessResponse;
import org.eclipse.bigiot.lib.offering.Offering;
import org.eclipse.bigiot.lib.offering.SubscribableOfferingDescription;
import org.eclipse.bigiot.lib.offering.parameters.AccessParameters;
import org.eclipse.bigiot.lib.query.OfferingQuery;

import org.joda.time.Duration;

public class ExampleConsumer {

	public static void main(String args[]) throws InterruptedException, ExecutionException, IncompleteOfferingQueryException, IOException, AccessToNonSubscribedOfferingException, AccessToNonActivatedOfferingException {

	    // Load example properties file
        BridgeIotProperties prop = BridgeIotProperties.load("example.properties");

		// Initialize consumer with Consumer ID and Marketplace URL
		Consumer consumer = Consumer.create(prop.CONSUMER_ID, prop.MARKETPLACE_URI)
		                            .authenticate(prop.CONSUMER_SECRET);

	    // Construct Offering Query incrementally
		OfferingQuery query = OfferingQuery.create("RandomNumberQuery")
				.withName("Random Number Query")
                .withCategory("urn:proposed:RandomValues")
                // .addInputData("http://schema.org/latitude", ValueType.NUMBER)
                .addOutputData("proposed:randomValue", ValueType.NUMBER)
                //.inRegion(BoundingBox.create(Location.create(42.1, 9.0), Location.create(43.2, 10.0)))
                //.withTimePeriod(new DateTime(2017, 1, 1, 0, 0, 0), new DateTime())
				.withPricingModel(PricingModel.PER_ACCESS)
				.withMaxPrice(Euros.amount(0.002))
				.withLicenseType(LicenseType.OPEN_DATA_LICENSE);

		// Discover available offerings based on Offering Query
		List<SubscribableOfferingDescription> list = consumer.discover(query).get();

		// Select Offering that has been offered by a local provider instance
		SubscribableOfferingDescription selectedOfferingDescription = list.get(0);

		if (selectedOfferingDescription != null) {

			// Subscribe to a selected OfferingDescription (if successful, returns accessible Offering instance)
			Offering offering = selectedOfferingDescription.subscribe().get();

			// Prepare Access Parameters
			AccessParameters accessParameters = AccessParameters.create();
			        // .addRdfTypeValue("http://schema.org/latitude", 41);

			// EXAMPLE 1: ONE-TIME ACCESS to the Offering
			AccessResponse response = offering.accessOneTime(accessParameters).get();
            System.out.println("Received data: " + response.asJsonNode().toString());

            // EXAMPLE 2: CONTINUOUS ACCESS to the Offering
			// Create an Access Feed with callbacks for the received results
			Duration feedDuration = Duration.standardHours(2);
			Duration feedInterval = Duration.standardSeconds(2);
			AccessFeed accessFeed = offering.accessContinuous(accessParameters,
										feedDuration.getMillis(),
										feedInterval.getMillis(),
										(f,r) -> {
											System.out.println("Received data: " + r.asJsonNode().toString());
										},
										(f,r) -> {
											System.out.println("Feed operation failed");
											f.stop();
										});

			// Run until user presses the ENTER key
			System.out.println(">>>>>>  Terminate ExampleConsumer by pressing ENTER  <<<<<<");
			Scanner keyboard = new Scanner(System.in);
			keyboard.nextLine();

			// Stop Access Feed
			accessFeed.stop();

			// Unsubscribe the Offering
			offering.unsubscribe();

		}
		else {
			// No active Offerings could be discovered
			System.out.println(">>>>>>  No matching offering found  <<<<<<");
		}

		// Terminate consumer instance
		consumer.terminate();

	}

}


text:
//
//  PDUIInstagramShareViewController.m
//  PopdeemSDK
//
//  Created by Niall Quinn on 20/06/2016.
//  Copyright © 2016 Popdeem. All rights reserved.
//

#import "PDUIInstagramShareViewController.h"
#import "PDTheme.h"
#import "PDUtils.h"
#import "PDConstants.h"
#import "PDUser.h"
#import "PopdeemSDK.h"

@implementation NSString (NSString_Extended)

- (NSString *)urlencode {
	NSMutableString *output = [NSMutableString string];
	const unsigned char *source = (const unsigned char *)[self UTF8String];
	unsigned long sourceLen = strlen((const char *)source);
	for (int i = 0; i < sourceLen; ++i) {
		const unsigned char thisChar = source[i];
		if (thisChar == ' '){
			[output appendString:@"+"];
		} else if (thisChar == '.' || thisChar == '-' || thisChar == '_' || thisChar == '~' ||
							 (thisChar >= 'a' && thisChar <= 'z') ||
							 (thisChar >= 'A' && thisChar <= 'Z') ||
							 (thisChar >= '0' && thisChar <= '9')) {
			[output appendFormat:@"%c", thisChar];
		} else {
			[output appendFormat:@"%%%02X", thisChar];
		}
	}
	return output;
}
@end

@interface PDUIInstagramShareViewController () {
    CGFloat _cardWidth;
}
@property (nonatomic) BOOL leavingToInstagram;
@end

@implementation PDUIInstagramShareViewController

- (instancetype) initForParent:(PDUIClaimV2ViewController*)parent withMessage:(NSString*)message image:(UIImage*)image imageUrlString:(NSString *)urlString{
	if (self = [super init]) {
		_parent = parent;
		_message = message;
		_image = image;
		_imageURLString = urlString;
		_viewModel = [[PDUIInstagramShareViewModel alloc] initWithController:self];
		//[_viewModel setup];
		return self;
	}
	return nil;
}

- (void)viewDidLoad {

	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];
	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];

	_leavingToInstagram = NO;
	[super viewDidLoad];
	[self.view setBackgroundColor:[UIColor clearColor]];
	self.backingView = [[UIView alloc] initWithFrame:_parent.view.frame];
	[self.view addSubview:_backingView];
	[self.backingView setBackgroundColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.8]];
	UITapGestureRecognizer *backingTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismiss)];
	[self.view addGestureRecognizer:backingTap];

	CGFloat currentY = 0;

	CGFloat cardWidth = _parent.view.frame.size.width * 0.8;
	CGFloat cardHeight = _parent.view.frame.size.height * 0.8;
	CGFloat cardX = _parent.view.frame.size.width * 0.1;
	CGFloat cardY = _parent.view.frame.size.height * 0.25;
	CGRect cardRect = CGRectMake(cardX, cardY, cardWidth, cardHeight);

	_cardView = [[UIView alloc] initWithFrame:cardRect];
	[_cardView setBackgroundColor:[UIColor whiteColor]];
	_cardView.layer.cornerRadius = 5.0;
	_cardView.layer.masksToBounds = YES;
	[self.view addSubview:_cardView];

	_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, cardWidth, cardHeight)];
	[_scrollView setContentSize:CGSizeMake(3*cardWidth, cardHeight)];
	[_scrollView setBounces:NO];
	[_scrollView setDelegate:self];
	[_scrollView setShowsVerticalScrollIndicator:NO];
	[_scrollView setShowsHorizontalScrollIndicator:NO];
	[_scrollView setPagingEnabled:YES];
	[_scrollView setScrollEnabled:NO];
	[_scrollView setUserInteractionEnabled:YES];
	[_cardView addSubview:_scrollView];

	_secondView = [[UIView alloc] initWithFrame:CGRectMake(cardWidth, 0, cardWidth, cardHeight)];
	[_scrollView addSubview:_secondView];

  _thirdView = [[UIView alloc] initWithFrame:CGRectMake(2*cardWidth, 0, cardWidth, cardHeight)];
  [_scrollView addSubview:_thirdView];

	_viewTwoLabelOne = [[UILabel alloc] initWithFrame:CGRectMake(20, 30, cardWidth-40, 70)];
	[_viewTwoLabelOne setText:_viewModel.viewTwoLabelOneText];
	[_viewTwoLabelOne setFont:_viewModel.viewTwoLabelOneFont];
	[_viewTwoLabelOne setTextColor:_viewModel.viewTwoLabelOneColor];
	[_viewTwoLabelOne setNumberOfLines:4];
	[_viewTwoLabelOne setTextAlignment:NSTextAlignmentCenter];
	CGSize labelSize = [_viewTwoLabelOne sizeThatFits:_viewTwoLabelOne.bounds.size];
	[_viewTwoLabelOne setFrame:CGRectMake(_viewTwoLabelOne.frame.origin.x, 40 , _viewTwoLabelOne.frame.size.width, labelSize.height)];
	[_secondView addSubview:_viewTwoLabelOne];
	currentY = 30 + labelSize.height;

	_viewTwoLabelTwo = [[UILabel alloc] initWithFrame:CGRectMake(20, currentY+30, _viewTwoLabelOne.frame.size.width, 70)];
	[_viewTwoLabelTwo setText:_viewModel.viewTwoLabelTwoText];
	[_viewTwoLabelTwo setFont:_viewModel.viewTwoLabelTwoFont];
	[_viewTwoLabelTwo setTextColor:_viewModel.viewTwoLabelTwoColor];
	[_viewTwoLabelTwo setNumberOfLines:4];
	[_viewTwoLabelTwo setTextAlignment:NSTextAlignmentCenter];
	labelSize = [_viewTwoLabelTwo sizeThatFits:_viewTwoLabelTwo.bounds.size];
	[_viewTwoLabelTwo setFrame:CGRectMake(_viewTwoLabelTwo.frame.origin.x, currentY+30 , _viewTwoLabelTwo.frame.size.width, labelSize.height)];
	[_secondView addSubview:_viewTwoLabelTwo];

	currentY += 30 + labelSize.height + 30;

	_viewTwoImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, currentY, cardWidth-30, cardHeight*0.25)];
	[_viewTwoImageView setImage:_viewModel.viewTwoImage];
	[_viewTwoImageView setContentMode:UIViewContentModeScaleAspectFit];
	_viewTwoImageView.backgroundColor = [UIColor clearColor];
	_viewTwoImageView.clipsToBounds = YES;
	[_secondView addSubview:_viewTwoImageView];

	currentY += _viewTwoImageView.frame.size.height;

    UIColor *buttonColor;

    if (PopdeemThemeHasValueForKey(PDThemeColorButtons)) {
        buttonColor = PopdeemColor(PDThemeColorButtons);
    } else {
        buttonColor = PopdeemColor(PDThemeColorPrimaryApp);
    }

	_viewTwoActionButton = [[UIButton alloc] initWithFrame:CGRectMake(15, currentY+30, cardWidth-30, 40)];
  [_viewTwoActionButton setBackgroundColor:[UIColor whiteColor]];
  [_viewTwoActionButton setTitleColor:buttonColor forState:UIControlStateNormal];
	[_viewTwoActionButton.titleLabel setFont:_viewModel.viewTwoActionButtonFont];
	[_viewTwoActionButton setTitle:_viewModel.viewTwoActionButtonText forState:UIControlStateNormal];
	[_viewTwoActionButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
	[_viewTwoActionButton setTag:1];
	[_viewTwoActionButton addTarget:self action:@selector(scroll) forControlEvents:UIControlEventTouchUpInside];
	[_secondView addSubview:_viewTwoActionButton];
  _viewTwoActionButton.layer.borderColor = PopdeemColor(PDThemeColorButtons).CGColor;
  _viewTwoActionButton.layer.borderWidth = 1.0;

	cardHeight = currentY + 30 + 40 + 20;
	[_secondView setFrame:CGRectMake(cardWidth, 0, cardWidth, cardHeight)];

	CGFloat midY = cardHeight/2;
	_firstView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, cardWidth, cardHeight)];
	[_scrollView addSubview:_firstView];

	_viewOneLabelOne = [[UILabel alloc] initWithFrame:_viewTwoLabelOne.frame];
	[_viewOneLabelOne setText:_viewModel.viewOneLabelOneText];
	[_viewOneLabelOne setFont:_viewModel.viewOneLabelOneFont];
	[_viewOneLabelOne setTextColor:_viewModel.viewOneLabelOneColor];
	[_viewOneLabelOne setNumberOfLines:4];
	[_viewOneLabelOne setTextAlignment:NSTextAlignmentCenter];
	[_firstView addSubview:_viewOneLabelOne];

	_viewOneLabelTwo = [[UILabel alloc] initWithFrame:_viewTwoLabelTwo.frame];
	[_viewOneLabelTwo setText:_viewModel.viewOneLabelTwoText];
	[_viewOneLabelTwo setFont:_viewModel.viewOneLabelTwoFont];
	[_viewOneLabelTwo setTextColor:_viewModel.viewOneLabelTwoColor];
	[_viewOneLabelTwo setNumberOfLines:4];
	[_viewOneLabelTwo setTextAlignment:NSTextAlignmentCenter];
	[_firstView addSubview:_viewOneLabelTwo];

	_viewOneImageView = [[UIImageView alloc] initWithFrame:_viewTwoImageView.frame];
	[_viewOneImageView setImage:_viewModel.viewOneImage];
	[_viewOneImageView setContentMode:UIViewContentModeScaleAspectFit];
	_viewOneImageView.backgroundColor = [UIColor clearColor];
	_viewOneImageView.clipsToBounds = YES;
	[_firstView addSubview:_viewOneImageView];

	_viewOneActionButton = [[UIButton alloc] initWithFrame:_viewTwoActionButton.frame];
  [_viewOneActionButton setBackgroundColor:[UIColor whiteColor]];
	[_viewOneActionButton.titleLabel setFont:_viewModel.viewOneActionButtonFont];
	[_viewOneActionButton setTitleColor:_viewModel.viewOneActionButtonTextColor forState:UIControlStateNormal];
	[_viewOneActionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
	[_viewOneActionButton setTitle:_viewModel.viewOneActionButtonText forState:UIControlStateNormal];
	[_viewOneActionButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
	[_viewOneActionButton setTag:1];
	[_viewOneActionButton addTarget:self action:@selector(scroll) forControlEvents:UIControlEventTouchUpInside];
	[_firstView addSubview:_viewOneActionButton];
  _viewOneActionButton.layer.borderColor = PopdeemColor(PDThemeColorButtons).CGColor;
  _viewOneActionButton.layer.borderWidth = 1.0;

  currentY = 0;

    /*

        NSString *forcedTagString = (self.parent.reward.forcedTag) ? self.parent.reward.forcedTag : @"hashtag";
        NSDictionary *attributes = @{
                                     NSFontAttributeName: PopdeemFont(PDThemeFontPrimary, 12),
                                     NSForegroundColorAttributeName: [UIColor blackColor],
                                     NSBackgroundColorAttributeName: [UIColor colorWithRed:0.87 green:0.90 blue:0.96 alpha:1.00]
                                     };
        NSMutableAttributedString *hashtagString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@" %@ ",forcedTagString] attributes:attributes];
        UILabel *hashLabel = [[UILabel alloc] init];
        [hashLabel setAttributedText:hashtagString];
        [hashLabel sizeToFit];
        [hashLabel setFrame:CGRectMake(70, 58, hashLabel.frame.size.width, hashLabel.frame.size.height)];
        hashLabel.layer.cornerRadius = 3.0f;
        hashLabel.clipsToBounds = YES;
        [_viewOneImageView addSubview:hashLabel];

     */

  _viewThreeLabelOne = [[UILabel alloc] initWithFrame:CGRectMake(20, 30, cardWidth-40, 70)];
  [_viewThreeLabelOne setText:_viewModel.viewThreeLabelOneText];
  [_viewThreeLabelOne setFont:_viewModel.viewThreeLabelOneFont];
  [_viewThreeLabelOne setTextColor:_viewModel.viewThreeLabelOneColor];
  [_viewThreeLabelOne setNumberOfLines:4];
  [_viewThreeLabelOne setTextAlignment:NSTextAlignmentCenter];
  labelSize = [_viewThreeLabelOne sizeThatFits:_viewThreeLabelOne.bounds.size];
  [_viewThreeLabelOne setFrame:CGRectMake(_viewThreeLabelOne.frame.origin.x, 40 , _viewThreeLabelOne.frame.size.width, labelSize.height)];
  [_thirdView addSubview:_viewThreeLabelOne];
  currentY = 30 + labelSize.height;

  _viewThreeLabelTwo = [[UILabel alloc] initWithFrame:CGRectMake(20, currentY+30, _viewThreeLabelOne.frame.size.width, 70)];
  [_viewThreeLabelTwo setText:_viewModel.viewThreeLabelTwoText];
  [_viewThreeLabelTwo setFont:_viewModel.viewThreeLabelTwoFont];
  [_viewThreeLabelTwo setTextColor:_viewModel.viewThreeLabelTwoColor];
  [_viewThreeLabelTwo setNumberOfLines:4];
  [_viewThreeLabelTwo setTextAlignment:NSTextAlignmentCenter];
  labelSize = [_viewThreeLabelTwo sizeThatFits:_viewThreeLabelTwo.bounds.size];
  [_viewThreeLabelTwo setFrame:CGRectMake(_viewThreeLabelTwo.frame.origin.x, currentY+30 , _viewThreeLabelTwo.frame.size.width, labelSize.height)];
  [_thirdView addSubview:_viewThreeLabelTwo];

  currentY += 30 + labelSize.height + 30;

  _viewThreeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, currentY, cardWidth-20, cardHeight*0.30)];
  [_viewThreeImageView setImage:_viewModel.viewThreeImage];
  [_viewThreeImageView setContentMode:UIViewContentModeScaleAspectFit];
  _viewThreeImageView.backgroundColor = [UIColor clearColor];
  _viewThreeImageView.clipsToBounds = YES;
  [_thirdView addSubview:_viewThreeImageView];

  currentY += _viewTwoImageView.frame.size.height;

  _viewThreeActionButton = [[UIButton alloc] initWithFrame:CGRectMake(15, currentY+30, cardWidth-30, 40)];
  [_viewThreeActionButton setBackgroundColor:buttonColor];
  [_viewThreeActionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  [_viewThreeActionButton.titleLabel setFont:_viewModel.viewThreeActionButtonFont];
  [_viewThreeActionButton setTitle:_viewModel.viewThreeActionButtonText forState:UIControlStateNormal];
  [_viewThreeActionButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
  [_viewThreeActionButton setTag:1];
  [_viewThreeActionButton addTarget:self action:@selector(shareOnInstagram) forControlEvents:UIControlEventTouchUpInside];
  [_thirdView addSubview:_viewThreeActionButton];

	_cardWidth = cardWidth;
	midY = self.view.frame.size.height/2;
	cardY = midY - (cardHeight/2);
	[_cardView setFrame:CGRectMake(cardX, cardY, cardWidth, cardHeight)];

}

- (void) scroll {
  if (_scrollView.contentOffset.x == 0) {
    [_scrollView setContentOffset:CGPointMake(_cardWidth, 0) animated:YES];
  }
  if (_scrollView.contentOffset.x > 0 && _scrollView.contentOffset.x <  2*_cardWidth) {
    [_scrollView setContentOffset:CGPointMake(2*_cardWidth, 0) animated:YES];
  }
	AbraLogEvent(ABRA_EVENT_PAGE_VIEWED, @{ABRA_PROPERTYNAME_SOURCE_PAGE : ABRA_PROPERTYVALUE_PAGE_INSTA_TUTORIAL_MODULE_TWO});
}

- (void) shareOnInstagram {

	NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];

	if ([[UIApplication sharedApplication] canOpenURL:instagramURL])
	{
		NSString *escapedString   = [_imageURLString urlencode];
//		NSString *escapedCaption  = [@"test" urlencode];
		NSURL *instagramURL       = [NSURL URLWithString:[NSString stringWithFormat:@"instagram://library?LocalIdentifier=%@", escapedString]];
		UIPasteboard *pb = [UIPasteboard generalPasteboard];
		[pb setString:_message];
		if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
			_leavingToInstagram = YES;
			[[UIApplication sharedApplication] openURL:instagramURL];
		} else {
			[self openInDocumentController];
		}
	}
	else
	{
		UIAlertView *errMsg = [[UIAlertView alloc] initWithTitle:@"Instagram Required"
																										 message:@"It appears that you do not have Instagram installed. You will now be directed to the App Store to download the Instagram App."
																										delegate:self
																					 cancelButtonTitle:@"Ok"
																					 otherButtonTitles:nil];
		[errMsg setTag:2];
		[errMsg show];
		_leavingToInstagram = NO;
	}
}

- (void) openInDocumentController {
	NSData *imageData = UIImagePNGRepresentation(_image); //convert image into .png format.
	NSFileManager *fileManager = [NSFileManager defaultManager];//create instance of NSFileManager
	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); //create an array and store result of our search for the documents directory in it
	NSString *documentsDirectory = [paths objectAtIndex:0]; //create NSString object, that holds our exact path to the documents directory
	NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"insta.igo"]]; //add our image to the path
	[fileManager createFileAtPath:fullPath contents:imageData attributes:nil]; //finally save the path (image)
	PDLog(@"image saved");

	CGRect rect = CGRectMake(0 ,0 , 0, 0);
	UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
	[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
	UIGraphicsEndImageContext();
	NSString *fileNameToSave = [NSString stringWithFormat:@"Documents/insta.igo"];
	NSString  *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:fileNameToSave];
	NSString *newJpgPath = [NSString stringWithFormat:@"file://%@",jpgPath];
	NSURL *igImageHookFile = [NSURL URLWithString:newJpgPath];
	self.dic.UTI = @"com.instagram.exclusivegram";
	// self.documentController = [self setupControllerWithURL:igImageHookFile usingDelegate:self];

	UIPasteboard *pb = [UIPasteboard generalPasteboard];
	[pb setString:_message];

	self.dic=[UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
	NSString *caption = _message; //settext as Default Caption
	self.dic.annotation=[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"%@",caption],@"InstagramCaption", nil];
	[self.dic presentOpenInMenuFromRect:rect inView: self.view animated:YES];
	_leavingToInstagram = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void) setMessage:(NSString *)message {
	self.message = message;

	UIPasteboard *pb = [UIPasteboard generalPasteboard];
	[pb setString:message];
}

- (void) dismiss {
	[self dismissViewControllerAnimated:YES completion:^(void){

	}];
}

- (NSParagraphStyle*) createParagraphAttribute {
	NSMutableParagraphStyle *paragraphStyle;
	paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
	[paragraphStyle setTabStops:@[[[NSTextTab alloc] initWithTextAlignment:NSTextAlignmentLeft location:15 options:@{}]]];
	[paragraphStyle setDefaultTabInterval:15];
	[paragraphStyle setFirstLineHeadIndent:0];
	[paragraphStyle setHeadIndent:15];

	return paragraphStyle;
}

- (void) viewDidAppear:(BOOL)animated {
	[super viewDidAppear:animated];
	AbraLogEvent(ABRA_EVENT_PAGE_VIEWED, @{ABRA_PROPERTYNAME_SOURCE_PAGE : ABRA_PROPERTYVALUE_PAGE_INSTA_TUTORIAL_MODULE_ONE});
}

- (void)viewDidDisappear:(BOOL)animated {
	[super viewDidDisappear:animated];
}

- (void) viewWillDisappear:(BOOL)animated {
	[super viewWillDisappear:animated];
}

- (void)appDidBecomeActive:(NSNotification *)notification {
}

- (void)appWillEnterForeground:(NSNotification *)notification {
}

- (void)appDidEnterBackground:(NSNotification *)notification {
	if (_leavingToInstagram) {
		[self dismissViewControllerAnimated:YES completion:^(void){
      [[NSNotificationCenter defaultCenter] postNotificationName:PDUserLinkedToInstagram object:nil];
      [[NSNotificationCenter defaultCenter] removeObserver:self];
		}];
		AbraLogEvent(ABRA_EVENT_CLICKED_NEXT_INSTAGRAM_TUTORIAL, nil);
	}
}

- (void) scrollViewDidScroll:(UIScrollView *)scrollView{

}

- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
	if (alertView.tag == 2) {
		NSString *simple = @"itms-apps://itunes.apple.com/app/id389801252";
		[[UIApplication sharedApplication] openURL:[NSURL URLWithString:simple]];
	}
}

@end


text:
export {useFloating} from './';

export {
  arrow,
  autoPlacement,
  flip,
  hide,
  offset,
  shift,
  limitShift,
  size,
  inline,
  detectOverflow,
} from '@floating-ui/core';

export type {
  Platform,
  Placement,
  Strategy,
  Middleware,
  Alignment,
  Side,
  AlignedPlacement,
  Axis,
  Length,
  Coords,
  SideObject,
  Dimensions,
  Rect,
  ElementRects,
  ElementContext,
  ClientRectObject,
  Padding,
  RootBoundary,
  MiddlewareArguments,
  MiddlewareReturn,
  MiddlewareData,
  ComputePositionConfig,
  ComputePositionReturn,
} from '@floating-ui/core';


text:
package iso20022

// Choice between formats to express the corporate event type.
type CorporateActionEventType32Choice struct {

	// Event types expressed as a code.
	Code *CorporateActionEventType15Code `xml:"Cd"`

	// Event types expressed as a proprietary code.
	Proprietary *GenericIdentification30 `xml:"Prtry"`
}

func (c *CorporateActionEventType32Choice) SetCode(value string) {
	c.Code = (*CorporateActionEventType15Code)(&value)
}

func (c *CorporateActionEventType32Choice) AddProprietary() *GenericIdentification30 {
	c.Proprietary = new(GenericIdentification30)
	return c.Proprietary
}


text:
using namespace tr064;
using namespace ::testing;

namespace
{
  const std::string location = "the loc";
  const std::string server = "the server";
  const std::string cache_ctrl = "the cache ctrl";
  const std::string s_type = "the s type";
  const std::string usn = "the usn";
  const std::string device_desc_doc = "the dev desc doc";
  const std::string host = "the host";
  const std::string port = "the port";
  const std::string cpe_dev_name = "the cpe device";
  const std::string cpe_dev_model = "the cpe device model";
}

//------------------------------------------------------------------------------

TEST(RootDeviceTest, GetSubDevices)
{
  auto dev = new Device();

  Device::Ptr sub1(new Device());
  dev->add_device(sub1);

  Device::Ptr sub2(new Device());
  Device::Ptr subsub1(new Device());
  Device::Ptr subsub2(new Device());
  sub2->add_device(subsub1);
  sub2->add_device(subsub2);
  dev->add_device(sub2);

  RootDevice root(location, server, cache_ctrl, s_type, usn,
                  device_desc_doc, host, port, dev);

  EXPECT_EQ(5, root.devices().size());
}