text:
package org.apache.hadoop.hbase;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.testclassification.FlakeyTests;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.Threads;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

/**
 * Test whether region re-balancing works. (HBASE-71)
 */
@Ignore // This is broken since new RegionServers does proper average of regions
// and because Master is treated as a regionserver though it hosts two regions only.
@Category({FlakeyTests.class, LargeTests.class})
@RunWith(value = Parameterized.class)
public class TestRegionRebalancing {

  @Parameters
  public static Collection<Object[]> data() {
    Object[][] balancers =
        new String[][] { { "org.apache.hadoop.hbase.master.balancer.SimpleLoadBalancer" },
            { "org.apache.hadoop.hbase.master.balancer.StochasticLoadBalancer" } };
    return Arrays.asList(balancers);
  }

  private static final byte[] FAMILY_NAME = Bytes.toBytes("col");
  private static final Log LOG = LogFactory.getLog(TestRegionRebalancing.class);
  private final HBaseTestingUtility UTIL = new HBaseTestingUtility();
  private RegionLocator regionLocator;
  private HTableDescriptor desc;
  private String balancerName;

  public TestRegionRebalancing(String balancerName) {
    this.balancerName = balancerName;

  }

  @After
  public void after() throws Exception {
    UTIL.shutdownMiniCluster();
  }

  @Before
  public void before() throws Exception {
    UTIL.getConfiguration().set("hbase.master.loadbalancer.class", this.balancerName);
    // set minCostNeedBalance to 0, make sure balancer run
    UTIL.startMiniCluster(1);
    this.desc = new HTableDescriptor(TableName.valueOf("test"));
    this.desc.addFamily(new HColumnDescriptor(FAMILY_NAME));
  }

  /**
   * For HBASE-71. Try a few different configurations of starting and stopping
   * region servers to see if the assignment or regions is pretty balanced.
   * @throws IOException
   * @throws InterruptedException
   */
  @Test (timeout=300000)
  public void testRebalanceOnRegionServerNumberChange()
  throws IOException, InterruptedException {
    try(Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
        Admin admin = connection.getAdmin()) {
      admin.createTable(this.desc, Arrays.copyOfRange(HBaseTestingUtility.KEYS,
          1, HBaseTestingUtility.KEYS.length));
      this.regionLocator = connection.getRegionLocator(this.desc.getTableName());

      MetaTableAccessor.fullScanMetaAndPrint(admin.getConnection());

      assertEquals("Test table should have right number of regions",
        HBaseTestingUtility.KEYS.length,
        this.regionLocator.getStartKeys().length);

      // verify that the region assignments are balanced to start out
      assertRegionsAreBalanced();

      // add a region server - total of 2
      LOG.info("Started second server=" +
        UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
      UTIL.getHBaseCluster().getMaster().balance();
      assertRegionsAreBalanced();

      // On a balanced cluster, calling balance() should return true
      assert(UTIL.getHBaseCluster().getMaster().balance() == true);

      // if we add a server, then the balance() call should return true
      // add a region server - total of 3
      LOG.info("Started third server=" +
          UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
      assert(UTIL.getHBaseCluster().getMaster().balance() == true);
      assertRegionsAreBalanced();

      // kill a region server - total of 2
      LOG.info("Stopped third server=" + UTIL.getHBaseCluster().stopRegionServer(2, false));
      UTIL.getHBaseCluster().waitOnRegionServer(2);
      waitOnCrashProcessing();
      UTIL.getHBaseCluster().getMaster().balance();
      assertRegionsAreBalanced();

      // start two more region servers - total of 4
      LOG.info("Readding third server=" +
          UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
      LOG.info("Added fourth server=" +
          UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
      waitOnCrashProcessing();
      assert(UTIL.getHBaseCluster().getMaster().balance() == true);
      assertRegionsAreBalanced();
      for (int i = 0; i < 6; i++){
        LOG.info("Adding " + (i + 5) + "th region server");
        UTIL.getHBaseCluster().startRegionServer();
      }
      assert(UTIL.getHBaseCluster().getMaster().balance() == true);
      assertRegionsAreBalanced();
      regionLocator.close();
    }
  }

  /**
   * Wait on crash processing. Balancer won't run if processing a crashed server.
   */
  private void waitOnCrashProcessing() {
    while (UTIL.getHBaseCluster().getMaster().getServerManager().areDeadServersInProgress()) {
      LOG.info("Waiting on processing of crashed server before proceeding...");
      Threads.sleep(1000);
    }
  }

  /**
   * Determine if regions are balanced. Figure out the total, divide by the
   * number of online servers, then test if each server is +/- 1 of average
   * rounded up.
   */
  private void assertRegionsAreBalanced() throws IOException {
    // TODO: Fix this test.  Old balancer used to run with 'slop'.  New
    // balancer does not.
    boolean success = false;
    float slop = (float)UTIL.getConfiguration().getFloat("hbase.regions.slop", 0.1f);
    if (slop <= 0) slop = 1;

    for (int i = 0; i < 5; i++) {
      success = true;
      // make sure all the regions are reassigned before we test balance
      waitForAllRegionsAssigned();

      long regionCount = UTIL.getMiniHBaseCluster().countServedRegions();
      List<HRegionServer> servers = getOnlineRegionServers();
      double avg = UTIL.getHBaseCluster().getMaster().getAverageLoad();
      int avgLoadPlusSlop = (int)Math.ceil(avg * (1 + slop));
      int avgLoadMinusSlop = (int)Math.floor(avg * (1 - slop)) - 1;
      LOG.debug("There are " + servers.size() + " servers and " + regionCount
        + " regions. Load Average: " + avg + " low border: " + avgLoadMinusSlop
        + ", up border: " + avgLoadPlusSlop + "; attempt: " + i);

      for (HRegionServer server : servers) {
        int serverLoad =
          ProtobufUtil.getOnlineRegions(server.getRSRpcServices()).size();
        LOG.debug(server.getServerName() + " Avg: " + avg + " actual: " + serverLoad);
        if (!(avg > 2.0 && serverLoad <= avgLoadPlusSlop
            && serverLoad >= avgLoadMinusSlop)) {
          for (HRegionInfo hri :
              ProtobufUtil.getOnlineRegions(server.getRSRpcServices())) {
            if (hri.isMetaRegion()) serverLoad--;
            // LOG.debug(hri.getRegionNameAsString());
          }
          if (!(serverLoad <= avgLoadPlusSlop && serverLoad >= avgLoadMinusSlop)) {
            LOG.debug(server.getServerName() + " Isn't balanced!!! Avg: " + avg +
                " actual: " + serverLoad + " slop: " + slop);
            success = false;
            break;
          }
        }
      }

      if (!success) {
        // one or more servers are not balanced. sleep a little to give it a
        // chance to catch up. then, go back to the retry loop.
        try {
          Thread.sleep(10000);
        } catch (InterruptedException e) {}

        UTIL.getHBaseCluster().getMaster().balance();
        continue;
      }

      // if we get here, all servers were balanced, so we should just return.
      return;
    }
    // if we get here, we tried 5 times and never got to short circuit out of
    // the retry loop, so this is a failure.
    fail("After 5 attempts, region assignments were not balanced.");
  }

  private List<HRegionServer> getOnlineRegionServers() {
    List<HRegionServer> list = new ArrayList<>();
    for (JVMClusterUtil.RegionServerThread rst :
        UTIL.getHBaseCluster().getRegionServerThreads()) {
      if (rst.getRegionServer().isOnline()) {
        list.add(rst.getRegionServer());
      }
    }
    return list;
  }

  /**
   * Wait until all the regions are assigned.
   */
  private void waitForAllRegionsAssigned() throws IOException {
    int totalRegions = HBaseTestingUtility.KEYS.length;
    while (UTIL.getMiniHBaseCluster().countServedRegions() < totalRegions) {
    // while (!cluster.getMaster().allRegionsAssigned()) {
      LOG.debug("Waiting for there to be "+ totalRegions +" regions, but there are "
        + UTIL.getMiniHBaseCluster().countServedRegions() + " right now.");
      try {
        Thread.sleep(200);
      } catch (InterruptedException e) {}
    }
    UTIL.waitUntilNoRegionsInTransition();
  }

}


text:
<?php

namespace ErenMustafaOzdal\LaravelModulesBase\Controllers;

interface OperationInterface
{
    /**
     * store data of the eloquent model
     *
     * @param $class
     * @param string|null $path
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
     */
    public function storeModel($class, $path = null);

    /**
     * update data of the eloquent model
     *
     * @param $model
     * @param string|null $path
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
     */
    public function updateModel($model, $path = null);

    /**
     * destroy data of the eloquent model or models
     *
     * @param \Illuminate\Database\Eloquent\Model|array $model [Model|ids]
     * @param string|null $path
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
     */
    public function destroyModel($model, $path = null);
}

redpajama_set_name: RedPajamaGithub


text:
const TerserPlugin = require('terser-webpack-plugin');

// https://medium.com/webpack/webpack-4-mode-and-optimization-5423a6bc597a
// https://webpack.js.org/plugins/split-chunks-plugin/
// https://medium.com/dailyjs/webpack-4-splitchunks-plugin-d9fbbe091fd0
// https://hackernoon.com/the-100-correct-way-to-split-your-chunks-with-webpack-f8a9df5b7758
module.exports = config => {
  config.optimization = {
    // Don't need this since I only have 1 entry point bundle (main.js).
    // The default behaviour is actually really good as described on the plugin page for this.
    // The entrypoint (main.js) is combined with all neccessary vendor dependencies. However,
    // if one or more dynamic (page) bundles use a heavy dependency, then it will be broken out
    // into a separate shared vendor bundle.
    // splitChunks: {
    //   chunks: 'all', // https://webpack.js.org/guides/code-splitting/#prevent-duplication
    // },
    // https://webpack.js.org/configuration/optimization/#optimization-runtimechunk
    // Creates bundle/runtime~main.bundle.js (1.09 KiB)
    // runtimeChunk: true,
    // Creates bundle/runtime.bundle.js (1.08 KiB)
    // Don't need this since I only have 1 entry point bundle (main.js).
    // runtimeChunk: 'single',
  };

  if (process.env.NODE_ENV === 'production') {
    config.optimization.minimizer = [
      // https://github.com/terser-js/terser#minify-options
      new TerserPlugin({
        sourceMap: true,
        terserOptions: {
          output: {
            comments: false,
          },
        },
      }),
    ];
  }
};


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Phyllosticta immersa Bubák

### Remarks
null


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=utf8">
<TITLE>
AbstractLoadingFactory
</TITLE>

<META NAME="date" CONTENT="2009-08-05">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.jgentleframework.context.injecting

Class AbstractLoadingFactory

java.lang.Object
  org.jgentleframework.context.injecting.AbstractLoadingFactory

Direct Known Subclasses:
AbstractBeanCacher

public abstract class AbstractLoadingFactory
extends java.lang.Object

The Class AbstractLoadingFactory.

Author:

Quoc Chung - mailto: skydunkpro@yahoo.com

Constructor Summary

AbstractLoadingFactory()

Method Summary

 void
load_AnnotationBeanProcessor(java.util.Map<java.lang.Class,AnnotationBeanProcessor> ABPList)

          Inject load_ annotation bean processor.

 void
load_BeanClassList(java.util.List<java.lang.Class<?>> beanClassList,
                   java.util.List<java.lang.Object> notLazyList,
                   Types type)

          Inject load_ bean class list.

 void
load_BeanClassList(java.util.List<java.lang.Class<?>> beanClassList,
                   java.util.List<java.lang.Object> notLazyList,
                   Types type,
                   java.util.List<java.lang.Object> annotateIDList)

          Inject load_ bean class list.

 void
load_DefinitionPostProcessor(java.util.List<DefinitionPostProcessor> DPPList)

          Inject load_ definition post processor.

 void
load_ObjectAttachList(java.util.List<ObjectAttach<?>> objAthList,
                      java.util.List<java.lang.Object> notLazyList,
                      Types type)

          Inject load_ object attach list.

 void
load_ObjectAttachList(java.util.List<ObjectAttach<?>> objAthList,
                      java.util.List<java.lang.Object> notLazyList,
                      Types type,
                      java.util.List<java.lang.Object> annotateIDList)

          Inject load_ object attach list.

 void
load_ObjectBindingConstantList(java.util.List<ObjectBindingConstant> objBndCstList,
                               java.util.List<java.lang.Object> notLazyList,
                               boolean bool)

          Inject load_ object binding constant list.

 void
load_ObjectBindingConstantList(java.util.List<ObjectBindingConstant> objBndCstList,
                               java.util.List<java.lang.Object> notLazyList,
                               boolean bool,
                               java.util.List<java.lang.Object> annotateIDList)

          Inject load_ object binding constant list.

 void
load_ObjectConstantList(java.util.List<ObjectConstant> objCstList)

          Inject load_ object constant list.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

AbstractLoadingFactory

public AbstractLoadingFactory()

Method Detail

load_AnnotationBeanProcessor

public void load_AnnotationBeanProcessor(java.util.Map<java.lang.Class,AnnotationBeanProcessor> ABPList)

Inject load_ annotation bean processor.

Parameters:
ABPList - the aBP list

load_BeanClassList

public void load_BeanClassList(java.util.List<java.lang.Class<?>> beanClassList,
                               java.util.List<java.lang.Object> notLazyList,
                               Types type)

Inject load_ bean class list.

Parameters:
beanClassList - the bean class list
notLazyList - the not lazy list
type - the type

load_BeanClassList

public void load_BeanClassList(java.util.List<java.lang.Class<?>> beanClassList,
                               java.util.List<java.lang.Object> notLazyList,
                               Types type,
                               java.util.List<java.lang.Object> annotateIDList)

Inject load_ bean class list.

Parameters:
beanClassList - the bean class list
notLazyList - the not lazy list
type - the type
annotateIDList - the annotate id list

load_DefinitionPostProcessor

public void load_DefinitionPostProcessor(java.util.List<DefinitionPostProcessor> DPPList)

Inject load_ definition post processor.

Parameters:
DPPList - the dPP list

load_ObjectAttachList

public void load_ObjectAttachList(java.util.List<ObjectAttach<?>> objAthList,
                                  java.util.List<java.lang.Object> notLazyList,
                                  Types type)

Inject load_ object attach list.

Parameters:
objAthList - the obj ath list
notLazyList - the not lazy list
type - the type

load_ObjectAttachList

public void load_ObjectAttachList(java.util.List<ObjectAttach<?>> objAthList,
                                  java.util.List<java.lang.Object> notLazyList,
                                  Types type,
                                  java.util.List<java.lang.Object> annotateIDList)

Inject load_ object attach list.

Parameters:
objAthList - the obj ath list
notLazyList - the not lazy list
type - the type
annotateIDList - the annotate id list

load_ObjectBindingConstantList

public void load_ObjectBindingConstantList(java.util.List<ObjectBindingConstant> objBndCstList,
                                           java.util.List<java.lang.Object> notLazyList,
                                           boolean bool)

Inject load_ object binding constant list.

Parameters:
objBndCstList - the obj bnd cst list
notLazyList - the not lazy list
bool - if indicates true, this method will only load
            ObjectBindingConstants which are Annotation,
            if indicates false, only ObjectBindingConstants
            aren't Annotation will be load.

load_ObjectBindingConstantList

public void load_ObjectBindingConstantList(java.util.List<ObjectBindingConstant> objBndCstList,
                                           java.util.List<java.lang.Object> notLazyList,
                                           boolean bool,
                                           java.util.List<java.lang.Object> annotateIDList)

Inject load_ object binding constant list.

Parameters:
objBndCstList - the obj bnd cst list
notLazyList - the not lazy list
bool - if indicates true, this method will only load
            ObjectBindingConstants which are Annotation,
            if indicates false, only ObjectBindingConstants
            aren't Annotation will be load.
annotateIDList - the annotate id list

load_ObjectConstantList

public void load_ObjectConstantList(java.util.List<ObjectConstant> objCstList)

Inject load_ object constant list.

Parameters:
objCstList - the obj cst list

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
QStealthStatusBar::QStealthStatusBar(QWidget *parent) :
    QLabel(parent)
{
    setStyleSheet(SC_QSS_BOTTOM_BAR);

    for (int i = 0; i < SC_TRAY_ITEM_COUNT; i++) {
        lblIcons[i] = new QLabel(this);
        lblIcons[i]->setGeometry(5 + 35 * (i + 1), 10, 30, 30);
        setActive(i, true);
    }
    setActive(SC_STATUS_ID_CHECK, false);

    btnLock = new QPushButton(this);
    btnLock->setGeometry(0, 10, 30, 30);
    setLockState(SC_LS_UNLOCKED);
}

void QStealthStatusBar::setLockState(SC_LOCK_STATE nLockState)
{
    this->nLockState = nLockState;
    switch (nLockState) {
      case SC_LS_UNENCRYPTED: {
        btnLock->setStyleSheet(SC_QSS_BTN_UNENCRYPTED);
        break;
      }
      case SC_LS_UNLOCKED: {
        btnLock->setStyleSheet(SC_QSS_BTN_UNLOCKED);
        break;
      }
      case SC_LS_MINT_ONLY: {
        btnLock->setStyleSheet(SC_QSS_BTN_MINT_ONLY);
        break;
      }
      case SC_LS_LOCKED: {
        btnLock->setStyleSheet(SC_QSS_BTN_LOCKED);
        break;
      }
    }
}

SC_LOCK_STATE QStealthStatusBar::lockState()
{
    return nLockState;
}

void QStealthStatusBar::setActive(int index, bool active)
{
    // set icon
    QString iconPath[SC_TRAY_ITEM_COUNT] = {
        "ico_stealth",
        "ico_increase",
        "ico_check",
    };

    if (index < 0 || index > SC_TRAY_ITEM_COUNT - 1) return;
    state[index] = active;

    QString path = (active == false) ? SC_ICON_PATH_DEFAULT : SC_ICON_PATH_ACTIVE;
    path += iconPath[index];
    path += ".png";

    lblIcons[index]->setPixmap(QPixmap(path));
    lblIcons[index]->setObjectName("statusIcon");
    lblIcons[index]->setStyleSheet(SC_QSS_TOOLTIP_DEFAULT);
}

QBottomBar::QBottomBar(QWidget *parent) :
    QLabel(parent)
{
    setGeometry(0, 650, 1100, 50);
    setStyleSheet(SC_QSS_BOTTOM_BAR);

    QString qstrVersion = tr("AtlasCoin") +
                          "" + tr("client") + " " +
                          " V " + QString::fromStdString(FormatVersionNumbers()) +
                          "";

    lblVersion = new QLabel(this);
    lblVersion->setGeometry(0, 0, 250, 50);
    QFont fntVersion = GUIUtil::stealthBoldFont();
    fntVersion.setPixelSize(12);
    lblVersion->setFont(fntVersion);
    lblVersion->setText(qstrVersion);
    lblVersion->setAlignment(Qt::AlignCenter);
    lblVersion->setStyleSheet(SC_QSS_BOTTOM_BAR_VERSION);

    progressBar = new QStealthProgressBar(this);
    progressBar->setGeometry(250 + 25, 0, 310, 50);
    progressBarLabel = new QLabel(this);
    progressBarLabel->setGeometry(585, 0, 360, 50);
    progressBarLabel->setStyleSheet(QString(SC_QSS_PROGRESS_NORMAL));

    progressBarLabel->setVisible(false);

    statusBar = new QStealthStatusBar(this);
    statusBar->setGeometry(width() - 155, 0, 150, 50);

    progressBar->setPercent(0);
}


text:
#include <aws/connectparticipant/model/SendMessageRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>

#include <utility>

using namespace Aws::ConnectParticipant::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

SendMessageRequest::SendMessageRequest() :
    m_contentTypeHasBeenSet(false),
    m_contentHasBeenSet(false),
    m_clientToken(Aws::Utils::UUID::RandomUUID()),
    m_clientTokenHasBeenSet(true),
    m_connectionTokenHasBeenSet(false)
{
}

Aws::String SendMessageRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_contentTypeHasBeenSet)
  {
   payload.WithString("ContentType", m_contentType);

  }

  if(m_contentHasBeenSet)
  {
   payload.WithString("Content", m_content);

  }

  if(m_clientTokenHasBeenSet)
  {
   payload.WithString("ClientToken", m_clientToken);

  }

  return payload.View().WriteReadable();
}

Aws::Http::HeaderValueCollection SendMessageRequest::GetRequestSpecificHeaders() const
{
  Aws::Http::HeaderValueCollection headers;
  Aws::StringStream ss;
  if(m_connectionTokenHasBeenSet)
  {
    ss << m_connectionToken;
    headers.emplace("x-amz-bearer",  ss.str());
    ss.str("");
  }

  return headers;

}


text:
package opt

import (
	"encoding/json"
	"reflect"
)

// UnretrievableAttributesOption is a wrapper for an UnretrievableAttributes option parameter. It holds
// the actual value of the option that can be accessed by calling Get.
type UnretrievableAttributesOption struct {
	value []string
}

// UnretrievableAttributes wraps the given value into a UnretrievableAttributesOption.
func UnretrievableAttributes(v ...string) *UnretrievableAttributesOption {
	return &UnretrievableAttributesOption{v}
}

// Get retrieves the actual value of the option parameter.
func (o *UnretrievableAttributesOption) Get() []string {
	if o == nil {
		return []string{}
	}
	return o.value
}

// MarshalJSON implements the json.Marshaler interface for
// UnretrievableAttributesOption.
func (o UnretrievableAttributesOption) MarshalJSON() ([]byte, error) {
	return json.Marshal(o.value)
}

// UnmarshalJSON implements the json.Unmarshaler interface for
// UnretrievableAttributesOption.
func (o *UnretrievableAttributesOption) UnmarshalJSON(data []byte) error {
	if string(data) == "null" {
		o.value = []string{}
		return nil
	}
	return json.Unmarshal(data, &o.value)
}

// Equal returns true if the given option is equal to the instance one. In case
// the given option is nil, we checked the instance one is set to the default
// value of the option.
func (o *UnretrievableAttributesOption) Equal(o2 *UnretrievableAttributesOption) bool {
	if o == nil {
		return o2 == nil || reflect.DeepEqual(o2.value, []string{})
	}
	if o2 == nil {
		return o == nil || reflect.DeepEqual(o.value, []string{})
	}
	return reflect.DeepEqual(o.value, o2.value)
}

// UnretrievableAttributesEqual returns true if the two options are equal.
// In case of one option being nil, the value of the other must be nil as well
// or be set to the default value of this option.
func UnretrievableAttributesEqual(o1, o2 *UnretrievableAttributesOption) bool {
	return o1.Equal(o2)
}


text:
/* jshint globalstrict:false, strict:false, unused: false */
/* global assertEqual, assertTrue, assertFalse, assertNull, assertNotNull, arango, ARGUMENTS */

// //////////////////////////////////////////////////////////////////////////////
// / @brief test the global replication
// /
// / @file
// /
// / DISCLAIMER
// /
// / Copyright 2017 ArangoDB GmbH, Cologne, Germany
// /
// / Licensed under the Apache License, Version 2.0 (the "License");
// / you may not use this file except in compliance with the License.
// / You may obtain a copy of the License at
// /
// /     http://www.apache.org/licenses/LICENSE-2.0
// /
// / Unless required by applicable law or agreed to in writing, software
// / distributed under the License is distributed on an "AS IS" BASIS,
// / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// / See the License for the specific language governing permissions and
// / limitations under the License.
// /
// / Copyright holder is ArangoDB GmbH, Cologne, Germany
// /
// / @author Michael Hackstein
// / @author Copyright 2017, ArangoDB GmbH, Cologne, Germany
// //////////////////////////////////////////////////////////////////////////////

const jsunity = require('jsunity');
const arangodb = require('@arangodb');
const db = arangodb.db;

const replication = require('@arangodb/replication');
var deriveTestSuite = require('@arangodb/test-helper').deriveTestSuite;
const reconnectRetry = require('@arangodb/replication-common').reconnectRetry;
const compareTicks = replication.compareTicks;
const console = require('console');
const internal = require('internal');

const masterEndpoint = arango.getEndpoint();
const slaveEndpoint = ARGUMENTS[0];

const cn = 'UnitTestsReplication';
const cn2 = 'UnitTestsReplication2';

const connectToMaster = function () {
  reconnectRetry(masterEndpoint, db._name(), 'root', '');
  db._flushCache();
};

const connectToSlave = function () {
  reconnectRetry(slaveEndpoint, db._name(), 'root', '');
  db._flushCache();
};

const collectionChecksum = function (name) {
  var c = db._collection(name).checksum(true, true);
  return c.checksum;
};

const collectionCount = function (name) {
  return db._collection(name).count();
};

const compare = function (masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal, applierConfiguration) {
  var state = {};

  db._flushCache();
  masterFunc(state);

  connectToSlave();
  replication.globalApplier.stop();
  replication.globalApplier.forget();

  while (replication.globalApplier.state().state.running) {
    internal.wait(0.1, false);
  }

  applierConfiguration = applierConfiguration || {};
  applierConfiguration.endpoint = masterEndpoint;
  applierConfiguration.username = 'root';
  applierConfiguration.password = '';
  applierConfiguration.includeSystem = false;
  applierConfiguration.force32mode = false;
  applierConfiguration.requireFromPresent = true;

  var syncResult = replication.syncGlobal({
    endpoint: masterEndpoint,
    username: 'root',
    password: '',
    verbose: true,
    includeSystem: false,
    keepBarrier: true,
    restrictType: applierConfiguration.restrictType,
    restrictCollections: applierConfiguration.restrictCollections
  });

  assertTrue(syncResult.hasOwnProperty('lastLogTick'));

  connectToMaster();
  masterFunc2(state);

  // use lastLogTick as of now
  state.lastLogTick = replication.logger.state().state.lastUncommittedLogTick;

  if (!applierConfiguration.hasOwnProperty('chunkSize')) {
    applierConfiguration.chunkSize = 16384;
  }

  connectToSlave();

  replication.globalApplier.properties(applierConfiguration);
  replication.globalApplier.start(syncResult.lastLogTick, syncResult.barrierId);

  var printed = false;
  var handled = false;

  while (true) {
    if (!handled) {
      var r = slaveFuncOngoing(state);
      if (r === 'wait') {
        // special return code that tells us to hang on
        internal.wait(0.5, false);
        continue;
      }

      handled = true;
    }

    var slaveState = replication.globalApplier.state();

    if (slaveState.state.lastError.errorNum > 0) {
      console.topic('replication=error', 'slave has errored:', JSON.stringify(slaveState.state.lastError));
      throw JSON.stringify(slaveState.state.lastError);
    }

    if (!slaveState.state.running) {
      console.topic('replication=error', 'slave is not running');
      break;
    }
    if (compareTicks(slaveState.state.lastAppliedContinuousTick, state.lastLogTick) >= 0 ||
        compareTicks(slaveState.state.lastProcessedContinuousTick, state.lastLogTick) >= 0) {
      console.topic('replication=debug',
                    'slave has caught up. state.lastLogTick:', state.lastLogTick,
                    'slaveState.lastAppliedContinuousTick:', slaveState.state.lastAppliedContinuousTick,
                    'slaveState.lastProcessedContinuousTick:', slaveState.state.lastProcessedContinuousTick);
      break;
    }

    if (!printed) {
      console.topic('replication=debug', 'waiting for slave to catch up');
      printed = true;
    }
    internal.wait(0.5, false);
  }

  internal.wait(1.0, false);
  db._flushCache();
  slaveFuncFinal(state);
};

// //////////////////////////////////////////////////////////////////////////////
// / @brief Base Test Config. Identitical part for _system and other DB
// //////////////////////////////////////////////////////////////////////////////

function BaseTestConfig () {
  'use strict';

  return {
    testIncludeCollection: function () {
      connectToMaster();

      compare(
        function (state) {
          db._drop(cn);
          db._drop(cn + '2');
        },

        function (state) {
          db._create(cn);
          db._create(cn + '2');
          for (var i = 0; i < 100; ++i) {
            db._collection(cn).save({
              value: i
            });
            db._collection(cn + '2').save({
              value: i
            });
          }
          internal.wal.flush(true, true);
        },

        function (state) {
          return true;
        },

        function (state) {
          assertTrue(db._collection(cn).count() === 100);
          assertNull(db._collection(cn + '2'));
        },

        {
          restrictType: 'include',
          restrictCollections: [cn]
        }
      );
    },

    testExcludeCollection: function () {
      connectToMaster();

      compare(
        function (state) {
          db._drop(cn);
          db._drop(cn + '2');
        },

        function (state) {
          db._create(cn);
          db._create(cn + '2');
          for (var i = 0; i < 100; ++i) {
            db._collection(cn).save({
              value: i
            });
            db._collection(cn + '2').save({
              value: i
            });
          }
          internal.wal.flush(true, true);
        },

        function (state) {
          return true;
        },

        function (state) {
          assertTrue(db._collection(cn).count() === 100);
          assertNull(db._collection(cn + '2'));
        },

        {
          restrictType: 'exclude',
          restrictCollections: [cn + '2']
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test collection creation
    // //////////////////////////////////////////////////////////////////////////////

    testCreateCollection: function () {
      connectToMaster();

      compare(
        function (state) {
        },

        function (state) {
          db._create(cn);
          for (var i = 0; i < 100; ++i) {
            db._collection(cn).save({
              value: i
            });
          }
          internal.wal.flush(true, true);
        },

        function (state) {
          return true;
        },

        function (state) {
          assertTrue(db._collection(cn).count() === 100);
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test collection dropping
    // //////////////////////////////////////////////////////////////////////////////

    testDropCollection: function () {
      connectToMaster();

      compare(
        function (state) {
        },

        function (state) {
          db._create(cn);
          for (var i = 0; i < 100; ++i) {
            db._collection(cn).save({
              value: i
            });
          }
          db._drop(cn);
          internal.wal.flush(true, true);
        },

        function (state) {
          return true;
        },

        function (state) {
          assertNull(db._collection(cn));
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test index creation
    // //////////////////////////////////////////////////////////////////////////////

    testCreateIndex: function () {
      connectToMaster();

      compare(
        function (state) {
        },

        function (state) {
          db._create(cn);
          db._collection(cn).ensureIndex({
            type: 'hash',
            fields: ['value']
          });
        },

        function (state) {
          return true;
        },

        function (state) {
          var col = db._collection(cn);
          assertNotNull(col, 'collection does not exist');
          var idx = col.getIndexes();
          assertEqual(2, idx.length);
          assertEqual('primary', idx[0].type);
          assertEqual('hash', idx[1].type);
          assertEqual(['value'], idx[1].fields);
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test index dropping
    // //////////////////////////////////////////////////////////////////////////////

    testDropIndex: function () {
      connectToMaster();

      compare(
        function (state) {
        },

        function (state) {
          db._create(cn);
          var idx = db._collection(cn).ensureIndex({
            type: 'hash',
            fields: ['value']
          });
          db._collection(cn).dropIndex(idx);
        },

        function (state) {
          return true;
        },

        function (state) {
          var idx = db._collection(cn).getIndexes();
          assertEqual(1, idx.length);
          assertEqual('primary', idx[0].type);
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test renaming
    // //////////////////////////////////////////////////////////////////////////////

    testRenameCollection: function () {
      connectToMaster();

      compare(
        function (state) {
        },

        function (state) {
          db._create(cn);
          db._collection(cn).rename(cn + 'Renamed');
        },

        function (state) {
          return true;
        },

        function (state) {
          assertNull(db._collection(cn));
          assertNotNull(db._collection(cn + 'Renamed'));
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test renaming
    // //////////////////////////////////////////////////////////////////////////////

    testChangeCollection: function () {
      connectToMaster();

      compare(
        function (state) {
        },

        function (state) {
          db._create(cn);
          assertFalse(db._collection(cn).properties().waitForSync);
          db._collection(cn).properties({
            waitForSync: true
          });
        },

        function (state) {
          return true;
        },

        function (state) {
          assertTrue(db._collection(cn).properties().waitForSync);
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test truncating a small collection
    // //////////////////////////////////////////////////////////////////////////////

    testTruncateCollectionSmall: function () {
      connectToMaster();

      compare(
        function (state) {
          let c = db._create(cn);
          for (let i = 0; i < 1000; i++) {
            c.insert({
              value: i
            });
          }
        },

        function (state) {
          db._collection(cn).truncate();
          assertEqual(db._collection(cn).count(), 0);
          assertEqual(db._collection(cn).toArray().length, 0);
        },

        function (state) {
          return true;
        },

        function (state) {
          assertEqual(db._collection(cn).count(), 0);
          assertEqual(db._collection(cn).toArray().length, 0);
        }
      );
    },

    testTruncateCollectionBiggerAndThenSome: function () {
      connectToMaster();

      compare(
        function (state) {
          let c = db._create(cn);
          let docs = [];
          for (let i = 0; i < (32 * 1024 + 1); i++) {
            docs.push({
              value: i
            });
            if (docs.length >= 1000) {
              c.insert(docs);
              docs = [];
            }
          }
          c.insert(docs);
        },

        function (state) {
          db._collection(cn).truncate(); // should hit range-delete in rocksdb
          assertEqual(db._collection(cn).count(), 0);
          assertEqual(db._collection(cn).toArray().length, 0);
          db._collection(cn).insert({_key: "a"});
          db._collection(cn).insert({_key: "b"});
        },

        function (state) {
          return true;
        },

        function (state) {
          const c = db._collection(cn);
          assertEqual(c.count(), 2);
          assertEqual(c.toArray().length, 2);
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test truncating a bigger collection
    // //////////////////////////////////////////////////////////////////////////////

    testTruncateCollectionBigger: function () {
      connectToMaster();

      compare(
        function (state) {
          let c = db._create(cn);
          let docs = [];
          for (let i = 0; i < (32 * 1024 + 1); i++) {
            docs.push({
              value: i
            });
            if (docs.length >= 1000) {
              c.insert(docs);
              docs = [];
            }
          }
          c.insert(docs);
        },

        function (state) {
          db._collection(cn).truncate(); // should hit range-delete in rocksdb
          assertEqual(db._collection(cn).count(), 0);
          assertEqual(db._collection(cn).toArray().length, 0);
        },

        function (state) {
          return true;
        },

        function (state) {
          const c = db._collection(cn);
          assertEqual(c.count(), 0);
          assertEqual(c.toArray().length, 0);
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test long transaction, blocking
    // //////////////////////////////////////////////////////////////////////////////

    testLongTransactionBlocking: function () {
      connectToMaster();

      compare(
        function (state) {
          db._create(cn);
        },

        function (state) {
          db._executeTransaction({
            collections: {
              write: cn
            },
            action: function (params) {
              var wait = require('internal').wait;
              var db = require('internal').db;
              var c = db._collection(params.cn);

              for (var i = 0; i < 10; ++i) {
                c.save({
                  test1: i,
                  type: 'longTransactionBlocking',
                  coll: 'UnitTestsReplication'
                });
                c.save({
                  test2: i,
                  type: 'longTransactionBlocking',
                  coll: 'UnitTestsReplication'
                });

                // intentionally delay the transaction
                wait(0.75, false);
              }
            },
            params: {
              cn: cn
            }
          });

          state.checksum = collectionChecksum(cn);
          state.count = collectionCount(cn);
          assertEqual(20, state.count);
        },

        function (state) {
          // stop and restart replication on the slave
          assertTrue(replication.globalApplier.state().state.running);
          replication.globalApplier.stop();
          assertFalse(replication.globalApplier.state().state.running);

          internal.wait(0.5, false);
          replication.globalApplier.start();
          internal.wait(0.5, false);
          assertTrue(replication.globalApplier.state().state.running);

          return true;
        },

        function (state) {
          internal.wait(3, false);
          assertEqual(state.count, collectionCount(cn));
          assertEqual(state.checksum, collectionChecksum(cn));
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test long transaction, asynchronous
    // //////////////////////////////////////////////////////////////////////////////

    testLongTransactionAsync: function () {
      connectToMaster();

      compare(
        function (state) {
          db._create(cn);
        },

        function (state) {
          var func = db._executeTransaction({
            collections: {
              write: cn
            },
            action: function (params) {
              var wait = require('internal').wait;
              var db = require('internal').db;
              var c = db._collection(params.cn);

              for (var i = 0; i < 10; ++i) {
                c.save({
                  test1: i,
                  type: 'longTransactionAsync',
                  coll: 'UnitTestsReplication'
                });
                c.save({
                  test2: i,
                  type: 'longTransactionAsync',
                  coll: 'UnitTestsReplication'
                });

                // intentionally delay the transaction
                wait(3.0, false);
              }
            },
            params: {
              cn: cn
            }
          });

          state.task = require('@arangodb/tasks').register({
            name: 'replication-test-async',
            command: String(func),
            params: {
              cn: cn
            }
          }).id;
        },

        function (state) {
          assertTrue(replication.globalApplier.state().state.running);

          connectToMaster();
          try {
            require('@arangodb/tasks').get(state.task);
            // task exists
            connectToSlave();
            return 'wait';
          } catch (err) {
            // task does not exist. we're done
            state.lastLogTick = replication.logger.state().state.lastUncommittedLogTick;
            state.checksum = collectionChecksum(cn);
            state.count = collectionCount(cn);
            assertEqual(20, state.count);
            connectToSlave();
            return true;
          }
        },

        function (state) {
          assertTrue(state.hasOwnProperty('count'));
          assertEqual(state.count, collectionCount(cn));
        }
      );
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test long transaction, asynchronous
    // //////////////////////////////////////////////////////////////////////////////

    testLongTransactionAsyncWithSlaveRestarts: function () {
      connectToMaster();

      compare(
        function (state) {
          db._create(cn);
        },

        function (state) {
          var func = db._executeTransaction({
            collections: {
              write: cn
            },
            action: function (params) {
              var wait = require('internal').wait;
              var db = require('internal').db;
              var c = db._collection(params.cn);

              for (var i = 0; i < 10; ++i) {
                c.save({
                  test1: i,
                  type: 'longTransactionAsyncWithSlaveRestarts',
                  coll: 'UnitTestsReplication'
                });
                c.save({
                  test2: i,
                  type: 'longTransactionAsyncWithSlaveRestarts',
                  coll: 'UnitTestsReplication'
                });

                // intentionally delay the transaction
                wait(0.75, false);
              }
            },
            params: {
              cn: cn
            }
          });

          state.task = require('@arangodb/tasks').register({
            name: 'replication-test-async-with-restart',
            command: String(func),
            params: {
              cn: cn
            }
          }).id;
        },

        function (state) {
          // stop and restart replication on the slave
          assertTrue(replication.globalApplier.state().state.running);
          replication.globalApplier.stop();
          assertFalse(replication.globalApplier.state().state.running);

          connectToMaster();
          try {
            require('@arangodb/tasks').get(state.task);
            // task exists
            connectToSlave();

            internal.wait(0.5, false);
            replication.globalApplier.start();
            assertTrue(replication.globalApplier.state().state.running);
            return 'wait';
          } catch (err) {
            // task does not exist anymore. we're done
            state.lastLogTick = replication.logger.state().state.lastUncommittedLogTick;
            state.checksum = collectionChecksum(cn);
            state.count = collectionCount(cn);
            assertEqual(20, state.count);
            connectToSlave();
            replication.globalApplier.start();
            assertTrue(replication.globalApplier.state().state.running);
            return true;
          }
        },

        function (state) {
          assertEqual(state.count, collectionCount(cn));
        }
      );
    },

    testViewBasic: function () {
      connectToMaster();

      compare(
        function () {},
        function (state) {
          try {
            db._create(cn);
            let view = db._createView('UnitTestsSyncView', 'arangosearch', {});
            let links = {};
            links[cn] = {
              includeAllFields: true,
              fields: {
                text: { analyzers: [ 'text_en' ] }
              }
            };
            view.properties({
              'links': links
            });
            state.arangoSearchEnabled = true;
          } catch (err) { }
        },
        function () {},
        function (state) {
          if (!state.arangoSearchEnabled) {
            return;
          }

          let view = db._view('UnitTestsSyncView');
          assertTrue(view !== null);
          let props = view.properties();
          assertEqual(Object.keys(props.links).length, 1);
          assertTrue(props.hasOwnProperty('links'));
          assertTrue(props.links.hasOwnProperty(cn));
        },
        {}
      );
    },

    testViewRename: function () {
      connectToMaster();

      compare(
        function (state) {
          try {
            db._create(cn);
            let view = db._createView('UnitTestsSyncView', 'arangosearch', {});
            let links = {};
            links[cn] = {
              includeAllFields: true,
              fields: {
                text: {
                  analyzers: [ 'text_en' ] }
              }
            };
            view.properties({
              'links': links
            });
            state.arangoSearchEnabled = true;
          } catch (err) { }
        },
        function (state) {
          if (!state.arangoSearchEnabled) {
            return;
          }
          // rename view on master
          let view = db._view('UnitTestsSyncView');
          view.rename('UnitTestsSyncViewRenamed');
          view = db._view('UnitTestsSyncViewRenamed');
          assertTrue(view !== null);
          let props = view.properties();
          assertEqual(Object.keys(props.links).length, 1);
          assertTrue(props.hasOwnProperty('links'));
          assertTrue(props.links.hasOwnProperty(cn));
        },
        function (state) {},
        function (state) {
          if (!state.arangoSearchEnabled) {
            return;
          }

          let view = db._view('UnitTestsSyncViewRenamed');
          assertTrue(view !== null);
          let props = view.properties();
          assertEqual(Object.keys(props.links).length, 1);
          assertTrue(props.hasOwnProperty('links'));
          assertTrue(props.links.hasOwnProperty(cn));
        },
        {}
      );
    },

    testViewDrop: function () {
      connectToMaster();

      compare(
        function (state) {
          try {
            db._createView('UnitTestsSyncView', 'arangosearch', {});
            state.arangoSearchEnabled = true;
          } catch (err) { }
        },
        function (state) {
          if (!state.arangoSearchEnabled) {
            return;
          }
          // drop view on master
          let view = db._view('UnitTestsSyncView');
          view.drop();
        },
        function (state) {},
        function (state) {
          if (!state.arangoSearchEnabled) {
            return;
          }

          let view = db._view('UnitTestsSyncView');
          let x = 10;
          while (view && x-- > 0) {
            internal.sleep(1);
            db._flushCache();
            view = db._view('UnitTestsSyncView');
          }
          assertNull(view);
        },
        {}
      );
    }

  };
}

// //////////////////////////////////////////////////////////////////////////////
// / @brief test suite for _system
// //////////////////////////////////////////////////////////////////////////////

function ReplicationSuite () {
  'use strict';
  let suite = {
    // //////////////////////////////////////////////////////////////////////////////
    // / @brief set up
    // //////////////////////////////////////////////////////////////////////////////

    setUp: function () {
      connectToSlave();
      try {
        replication.global.stop();
        replication.global.forget();
      } catch (err) {
      }

      connectToMaster();

      db._drop(cn);
      db._drop(cn2);
      db._drop(cn + 'Renamed');
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief tear down
    // //////////////////////////////////////////////////////////////////////////////

    tearDown: function () {
      connectToMaster();

      db._dropView('UnitTestsSyncView');
      db._dropView('UnitTestsSyncViewRenamed');
      db._drop(cn);
      db._drop(cn2);

      connectToSlave();
      replication.globalApplier.stop();
      replication.globalApplier.forget();

      db._dropView('UnitTestsSyncView');
      db._dropView('UnitTestsSyncViewRenamed');
      db._drop(cn);
      db._drop(cn2);
      db._drop(cn + 'Renamed');
    }
  };
  deriveTestSuite(BaseTestConfig(), suite, '_Repl');

  return suite;
}

// //////////////////////////////////////////////////////////////////////////////
// / @brief test suite for other database
// //////////////////////////////////////////////////////////////////////////////

function ReplicationOtherDBSuite () {
  'use strict';
  const dbName = 'UnitTestDB';

  // Setup documents to be stored on the master.

  let docs = [];
  for (let i = 0; i < 50; ++i) {
    docs.push({
      value: i
    });
  }

  // Shared function that sets up replication
  // of the collection and inserts 50 documents.
  const setupReplication = function () {
    // Section - Master
    connectToMaster();

    // Create the collection
    db._flushCache();
    db._create(cn);

    // Section - Follower
    connectToSlave();

    // Setup Replication
    replication.globalApplier.stop();
    replication.globalApplier.forget();

    while (replication.globalApplier.state().state.running) {
      internal.wait(0.1, false);
    }

    let config = {
      endpoint: masterEndpoint,
      username: 'root',
      password: '',
      verbose: true,
      includeSystem: false,
      restrictType: '',
      restrictCollections: [],
      keepBarrier: false
    };

    replication.setupReplicationGlobal(config);

    // Section - Master
    connectToMaster();
    // Insert some documents
    db._collection(cn).save(docs);
    // Flush wal to trigger replication
    internal.wal.flush(true, true);
    internal.wait(6, false);
    // Use counter as indicator
    let count = collectionCount(cn);
    assertEqual(50, count);

    // Section - Slave
    connectToSlave();

    // Give it some time to sync
    internal.wait(6, false);
    // Now we should have the same amount of documents
    assertEqual(count, collectionCount(cn));
  };

  let suite = {
    // //////////////////////////////////////////////////////////////////////////////
    // / @brief set up
    // //////////////////////////////////////////////////////////////////////////////

    setUp: function () {
      db._useDatabase('_system');
      connectToSlave();
      try {
        replication.globalApplier.stop();
        replication.globalApplier.forget();
      } catch (err) {
      }

      try {
        db._dropDatabase(dbName);
      } catch (e) {
      }

      db._createDatabase(dbName);

      connectToMaster();

      try {
        db._dropDatabase(dbName);
      } catch (e) {
      }
      db._createDatabase(dbName);
      db._useDatabase(dbName);
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief tear down
    // //////////////////////////////////////////////////////////////////////////////

    tearDown: function () {
      db._useDatabase('_system');

      connectToSlave();
      db._useDatabase(dbName);

      replication.globalApplier.stop();
      replication.globalApplier.forget();

      db._useDatabase('_system');
      try {
        db._dropDatabase(dbName);
      } catch (e) {
      }

      connectToMaster();

      db._useDatabase('_system');
      try {
        db._dropDatabase(dbName);
      } catch (e) {
      }
    },

    // //////////////////////////////////////////////////////////////////////////////
    // / @brief test dropping a database on slave while replication is ongoing
    // //////////////////////////////////////////////////////////////////////////////

    testDropDatabaseOnSlaveDuringReplication: function () {
      setupReplication();

      // Section - Slave
      connectToSlave();

      assertTrue(replication.globalApplier.state().state.running);

      // Now do the evil stuff: drop the database that is replicating right now.
      db._useDatabase('_system');

      // This shall not fail.
      db._dropDatabase(dbName);

      // Section - Master
      connectToMaster();

      // Just write some more
      db._useDatabase(dbName);
      db._collection(cn).save(docs);
      internal.wal.flush(true, true);
      internal.wait(6, false);

      db._useDatabase('_system');

      // Section - Slave
      connectToSlave();

      // The DB should be gone and the server should be running.
      let dbs = db._databases();
      assertEqual(-1, dbs.indexOf(dbName));

      // We can setup everything here without problems.
      try {
        db._createDatabase(dbName);
      } catch (e) {
        assertFalse(true, 'Could not recreate database on slave: ' + e);
      }

      db._useDatabase(dbName);

      try {
        db._createDocumentCollection(cn);
      } catch (e) {
        assertFalse(true, 'Could not recreate collection on slave: ' + e);
      }

      // Collection should be empty
      assertEqual(0, collectionCount(cn));

      // now test if the replication is actually
      // switched off

      // Section - Master
      connectToMaster();
      // Insert some documents
      db._collection(cn).save(docs);
      // Flush wal to trigger replication
      internal.wal.flush(true, true);

      // Section - Slave
      connectToSlave();

      // Give it some time to sync (eventually, should not do anything...)
      internal.wait(6, false);

      // Now should still have empty collection
      assertEqual(0, collectionCount(cn));

      assertFalse(replication.globalApplier.state().state.running);
    },

    testDropDatabaseOnMasterDuringReplication: function () {
      var waitUntil = function (cb) {
        var tries = 0;
        while (tries++ < 60 * 2) {
          if (cb()) {
            return;
          }
          internal.wait(0.5, false);
        }
        assertFalse(true, 'required condition not satisified: ' + String(cb));
      };

      setupReplication();

      db._useDatabase('_system');
      connectToSlave();
      // wait until database is present on slave as well
      waitUntil(function () { return (db._databases().indexOf(dbName) !== -1); });

      // Section - Master
      // Now do the evil stuff: drop the database that is replicating from right now.
      connectToMaster();
      // This shall not fail.
      db._dropDatabase(dbName);

      db._useDatabase('_system');
      connectToSlave();
      waitUntil(function () { return (db._databases().indexOf(dbName) === -1); });

      // Now recreate a new database with this name
      connectToMaster();
      db._createDatabase(dbName);

      db._useDatabase(dbName);
      db._createDocumentCollection(cn);
      db._collection(cn).save(docs);

      // Section - Slave
      db._useDatabase('_system');
      connectToSlave();
      waitUntil(function () { return (db._databases().indexOf(dbName) !== -1); });
      // database now present on slave

      // Now test if the Slave did replicate the new database...
      db._useDatabase(dbName);
      // wait for collection to appear
      waitUntil(function () {
        let cc = db._collection(cn);
        return cc !== null && cc.count() >= 50;
      });
      assertEqual(50, collectionCount(cn), 'The slave inserted the new collection data into the old one, it skipped the drop.');

      assertTrue(replication.globalApplier.state().state.running);
    },

    testSplitUpLargeTransactions: function () {
      // Section - Master
      connectToMaster();

      // Create the collection
      db._flushCache();
      db._create(cn);

      // Section - Follower
      connectToSlave();

      // Setup Replication
      replication.globalApplier.stop();
      replication.globalApplier.forget();

      while (replication.globalApplier.state().state.running) {
        internal.wait(0.1, false);
      }

      let config = {
        endpoint: masterEndpoint,
        username: 'root',
        password: '',
        verbose: true,
        includeSystem: false,
        restrictType: '',
        restrictCollections: [],
        keepBarrier: false,
        chunkSize: 16384 // small chunksize should split up trxs
      };

      replication.setupReplicationGlobal(config);

      connectToMaster();

      let coll = db._collection(cn);
      const count = 100000;
      let docs = [];
      for (let i = 0; i < count; i++) {
        if (docs.length > 10000) {
          coll.save(docs);
          docs = [];
        }
        docs.push({
          value: i
        });
      }
      coll.save(docs);

      // try to perform another operation afterwards
      const cn2 = cn + 'Test';
      db._create(cn2);

      let lastLogTick = replication.logger.state().state.lastUncommittedLogTick;

      // Section - Follower
      connectToSlave();

      let printed = false;
      while (true) {
        let slaveState = replication.globalApplier.state();
        if (slaveState.state.lastError.errorNum > 0) {
          console.topic('replication=error', 'slave has errored:', JSON.stringify(slaveState.state.lastError));
          throw JSON.stringify(slaveState.state.lastError);
        }

        if (!slaveState.state.running) {
          console.topic('replication=error', 'slave is not running');
          break;
        }
        if (compareTicks(slaveState.state.lastAppliedContinuousTick, lastLogTick) >= 0 ||
            compareTicks(slaveState.state.lastProcessedContinuousTick, lastLogTick) >= 0) {
          console.topic('replication=debug',
                        'slave has caught up. state.lastLogTick:', slaveState.state.lastLogTick,
                        'slaveState.lastAppliedContinuousTick:', slaveState.state.lastAppliedContinuousTick,
                        'slaveState.lastProcessedContinuousTick:', slaveState.state.lastProcessedContinuousTick);
          break;
        }

        if (!printed) {
          console.topic('replication=debug', 'waiting for slave to catch up');
          printed = true;
        }
        internal.wait(0.5, false);
      }

      // Now we should have the same amount of documents
      assertEqual(count, collectionCount(cn));
      assertNotNull(db._collection(cn2));
      assertTrue(replication.globalApplier.state().state.running);
    }
  };

  deriveTestSuite(BaseTestConfig(), suite, '_ReplOther');

  return suite;
}

// //////////////////////////////////////////////////////////////////////////////
// / @brief executes the test suite
// //////////////////////////////////////////////////////////////////////////////

jsunity.run(ReplicationSuite);
jsunity.run(ReplicationOtherDBSuite);

// TODO Add test for:
// Accessing globalApplier in non system database.
// Try to setup global repliaction in non system database.

return jsunity.done();


text:
NS_ASSUME_NONNULL_BEGIN

MK_CLASS_AVAILABLE(10_9, 7_0) __TVOS_AVAILABLE(9_2) __WATCHOS_PROHIBITED
@interface MKTileOverlayRenderer : MKOverlayRenderer

- (instancetype)initWithTileOverlay:(MKTileOverlay *)overlay;

- (void)reloadData;

@end

NS_ASSUME_NONNULL_END


text:
export class Article {
  _id: number;
  title: string;
  author: { name: string; email: string; };
  date: Date;
  category: string;
  content: string;
  sticky: boolean;
  image: string;
  image_dimensions: { width: number, height: number };
}


text:
"""
Exception definitions.
"""

class UnsupportedVersion(Exception):
    """Indicates that the user is trying to use an unsupported
    version of the API.
    """
    pass

class UnsupportedAttribute(AttributeError):
    """Indicates that the user is trying to transmit the argument to a method,
    which is not supported by selected version.
    """

    def __init__(self, argument_name, start_version, end_version=None):
        if end_version:
            self.message = (
                "'%(name)s' argument is only allowed for microversions "
                "%(start)s - %(end)s." % {"name": argument_name,
                                          "start": start_version,
                                          "end": end_version})
        else:
            self.message = (
                "'%(name)s' argument is only allowed since microversion "
                "%(start)s." % {"name": argument_name, "start": start_version})

class CommandError(Exception):
    pass

class AuthorizationFailure(Exception):
    pass

class NoUniqueMatch(Exception):
    pass

class AuthSystemNotFound(Exception):
    """When the user specify a AuthSystem but not installed."""
    def __init__(self, auth_system):
        self.auth_system = auth_system

    def __str__(self):
        return "AuthSystemNotFound: %s" % repr(self.auth_system)

class NoTokenLookupException(Exception):
    """This form of authentication does not support looking up
       endpoints from an existing token.
    """
    pass

class EndpointNotFound(Exception):
    """Could not find Service or Region in Service Catalog."""
    pass

class AmbiguousEndpoints(Exception):
    """Found more than one matching endpoint in Service Catalog."""
    def __init__(self, endpoints=None):
        self.endpoints = endpoints

    def __str__(self):
        return "AmbiguousEndpoints: %s" % repr(self.endpoints)

class ConnectionRefused(Exception):
    """
    Connection refused: the server refused the connection.
    """
    def __init__(self, response=None):
        self.response = response

    def __str__(self):
        return "ConnectionRefused: %s" % repr(self.response)

class ResourceInErrorState(Exception):
    """Resource is in the error state."""

    def __init__(self, obj):
        msg = "`%s` resource is in the error state" % obj.__class__.__name__
        fault_msg = getattr(obj, "fault", {}).get("message")
        if fault_msg:
            msg += "due to '%s'" % fault_msg
        self.message = "%s." % msg

class VersionNotFoundForAPIMethod(Exception):
    msg_fmt = "API version '%(vers)s' is not supported on '%(method)s' method."

    def __init__(self, version, method):
        self.version = version
        self.method = method

    def __str__(self):
        return self.msg_fmt % {"vers": self.version, "method": self.method}

class InstanceInDeletedState(Exception):
    """Instance is in the deleted state."""
    pass

class ClientException(Exception):
    """
    The base exception class for all exceptions this library raises.
    """
    message = 'Unknown Error'

    def __init__(self, code, message=None, details=None, request_id=None,
                 url=None, method=None):
        self.code = code
        self.message = message or self.__class__.message
        self.details = details
        self.request_id = request_id
        self.url = url
        self.method = method

    def __str__(self):
        formatted_string = "%s (HTTP %s)" % (self.message, self.code)
        if self.request_id:
            formatted_string += " (Request-ID: %s)" % self.request_id

        return formatted_string

class RetryAfterException(ClientException):
    """
    The base exception class for ClientExceptions that use Retry-After header.
    """
    def __init__(self, *args, **kwargs):
        try:
            self.retry_after = int(kwargs.pop('retry_after'))
        except (KeyError, ValueError):
            self.retry_after = 0

        super(RetryAfterException, self).__init__(*args, **kwargs)

class BadRequest(ClientException):
    """
    HTTP 400 - Bad request: you sent some malformed data.
    """
    http_status = 400
    message = "Bad request"

class Unauthorized(ClientException):
    """
    HTTP 401 - Unauthorized: bad credentials.
    """
    http_status = 401
    message = "Unauthorized"

class Forbidden(ClientException):
    """
    HTTP 403 - Forbidden: your credentials don't give you access to this
    resource.
    """
    http_status = 403
    message = "Forbidden"

class NotFound(ClientException):
    """
    HTTP 404 - Not found
    """
    http_status = 404
    message = "Not found"

class MethodNotAllowed(ClientException):
    """
    HTTP 405 - Method Not Allowed
    """
    http_status = 405
    message = "Method Not Allowed"

class NotAcceptable(ClientException):
    """
    HTTP 406 - Not Acceptable
    """
    http_status = 406
    message = "Not Acceptable"

class Conflict(ClientException):
    """
    HTTP 409 - Conflict
    """
    http_status = 409
    message = "Conflict"

class OverLimit(RetryAfterException):
    """
    HTTP 413 - Over limit: you're over the API limits for this time period.
    """
    http_status = 413
    message = "Over limit"

class RateLimit(RetryAfterException):
    """
    HTTP 429 - Rate limit: you've sent too many requests for this time period.
    """
    http_status = 429
    message = "Rate limit"

# NotImplemented is a python keyword.
class HTTPNotImplemented(ClientException):
    """
    HTTP 501 - Not Implemented: the server does not support this operation.
    """
    http_status = 501
    message = "Not Implemented"

# In Python 2.4 Exception is old-style and thus doesn't have a __subclasses__()
# so we can do this:
#     _code_map = dict((c.http_status, c)
#                      for c in ClientException.__subclasses__())
#
# Instead, we have to hardcode it:
_error_classes = [BadRequest, Unauthorized, Forbidden, NotFound,
                  MethodNotAllowed, NotAcceptable, Conflict, OverLimit,
                  RateLimit, HTTPNotImplemented]
_code_map = dict((c.http_status, c) for c in _error_classes)

class InvalidUsage(RuntimeError):
    """This function call is invalid in the way you are using this client.

    Due to the transition to using keystoneauth some function calls are no
    longer available. You should make a similar call to the session object
    instead.
    """
    pass

def from_response(response, body, url, method=None):
    """
    Return an instance of an ClientException or subclass
    based on a requests response.

    Usage::

        resp, body = requests.request(...)
        if resp.status_code != 200:
            raise exception_from_response(resp, rest.text)
    """
    cls = _code_map.get(response.status_code, ClientException)

    kwargs = {
        'code': response.status_code,
        'method': method,
        'url': url,
        'request_id': None,
    }

    if response.headers:
        kwargs['request_id'] = response.headers.get('x-compute-request-id')

        if (issubclass(cls, RetryAfterException) and
                'retry-after' in response.headers):
            kwargs['retry_after'] = response.headers.get('retry-after')

    if body:
        message = "n/a"
        details = "n/a"

        if hasattr(body, 'keys'):
            # NOTE(mriedem): WebOb<1.6.0 will return a nested dict structure
            # where the error keys to the message/details/code. WebOb>=1.6.0
            # returns just a response body as a single dict, not nested,
            # so we have to handle both cases (since we can't trust what we're
            # given with content_type: application/json either way.
            if 'message' in body:
                # WebOb 1.6.0 case
                message = body.get('message')
                details = body.get('details')
            else:
                # WebOb<1.6.0 where we assume there is a single error message
                # key to the body that has the message and details.
                error = body[list(body)[0]]
                message = error.get('message')
                details = error.get('details')

        kwargs['message'] = message
        kwargs['details'] = details

    return cls(**kwargs)

class ResourceNotFound(Exception):
    """Error in getting the resource."""
    pass


text:
import re
from django import template
from django.conf import settings

numeric_test = re.compile("^\d+$")
register = template.Library()

def getattribute(value, arg):
    """Gets an attribute of an object dynamically from a string name"""

    if hasattr(value, str(arg)):
        if callable(getattr(value, arg)):
            return getattr(value, arg)()
        return getattr(value, arg)
    elif hasattr(value, 'has_key') and value.has_key(arg):
        return value[arg]
    elif numeric_test.match(str(arg)) and len(value) > int(arg):
        return value[int(arg)]
    elif str(arg) in value:
        return value.get(arg)
    try: return value[arg]
    except: return settings.TEMPLATE_STRING_IF_INVALID

register.filter('getattribute', getattribute)

from api.models import japanese_attribute as jpa

def japanese_attribute(attribute):
    return jpa(attribute)

register.filter('japanese_attribute', japanese_attribute)

# Then, in template:
# {% load getattribute %}
# {{ object|getattribute:dynamic_string_var }}


text:
package joptsimple;

import static java.util.Arrays.*;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @author Paul Holser
 */
public class ParsingSeparatedStringOptionValuesTest extends AbstractOptionParserFixture {
    @Test
    public void parsesSeparatedValuesAsSeparateArgument() {
        assertCorrectParse( "classpath", ":::", "--classpath", "/usr:::/opt:::/var" );
    }

    @Test
    public void parsesSeparatedValuesWhenArgumentAbuttedWithEquals() {
        assertCorrectParse( "classpath", ":", "--classpath=/usr:/opt:/var" );
    }

    @Test
    public void parsesEqualsSeparatedValuesWhenArgumentAbuttedWithEquals() {
        assertCorrectParse( "classpath", ":=", "--classpath=/usr:=/opt:=/var" );
    }

    @Test
    public void parsesSeparatedValuesAbutting() {
        assertCorrectParse( "c", ";", "-c/usr;/opt;/var" );
    }

    @Test
    public void parsesHyphenSeparatedValuesAbutting() {
        assertCorrectParse( "c", "--", "-c/usr--/opt--/var" );
    }

    @Test
    public void handlesConsecutiveDelimiters() {
        assertCorrectParse( "c", ",", "-c,/usr,,,/opt,,,/var,,,,," );
    }

    private void assertCorrectParse( String option, String separator, String... args ) {
        parser.accepts( option ).withRequiredArg().withValuesSeparatedBy( separator );

        OptionSet options = parser.parse( args );

        assertEquals( asList( "/usr", "/opt", "/var" ), options.valuesOf( option ) );
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.kikermo.blepotcontroller">

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

    <application
        android:name=".BLEPotControllerApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".activity.SelectServiceActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".activity.MainActivity"></activity>
    </application>

</manifest>


text:
package com.amazonaws.services.iot.model;

import java.io.Serializable;
import javax.annotation.Generated;

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeThingRegistrationTaskResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable,
        Cloneable {

    /**
     *

     * The task ID.
     *

     */
    private String taskId;
    /**
     *

     * The task creation date.
     *

     */
    private java.util.Date creationDate;
    /**
     *

     * The date when the task was last modified.
     *

     */
    private java.util.Date lastModifiedDate;
    /**
     *

     * The task's template.
     *

     */
    private String templateBody;
    /**
     *

     * The S3 bucket that contains the input file.
     *

     */
    private String inputFileBucket;
    /**
     *

     * The input file key.
     *

     */
    private String inputFileKey;
    /**
     *

     * The role ARN that grants access to the input file bucket.
     *

     */
    private String roleArn;
    /**
     *

     * The status of the bulk thing provisioning task.
     *

     */
    private String status;
    /**
     *

     * The message.
     *

     */
    private String message;
    /**
     *

     * The number of things successfully provisioned.
     *

     */
    private Integer successCount;
    /**
     *

     * The number of things that failed to be provisioned.
     *

     */
    private Integer failureCount;
    /**
     *

     * The progress of the bulk provisioning task expressed as a percentage.
     *

     */
    private Integer percentageProgress;

    /**
     *

     * The task ID.
     *

     *
     * @param taskId
     *        The task ID.
     */

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    /**
     *

     * The task ID.
     *

     *
     * @return The task ID.
     */

    public String getTaskId() {
        return this.taskId;
    }

    /**
     *

     * The task ID.
     *

     *
     * @param taskId
     *        The task ID.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withTaskId(String taskId) {
        setTaskId(taskId);
        return this;
    }

    /**
     *

     * The task creation date.
     *

     *
     * @param creationDate
     *        The task creation date.
     */

    public void setCreationDate(java.util.Date creationDate) {
        this.creationDate = creationDate;
    }

    /**
     *

     * The task creation date.
     *

     *
     * @return The task creation date.
     */

    public java.util.Date getCreationDate() {
        return this.creationDate;
    }

    /**
     *

     * The task creation date.
     *

     *
     * @param creationDate
     *        The task creation date.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withCreationDate(java.util.Date creationDate) {
        setCreationDate(creationDate);
        return this;
    }

    /**
     *

     * The date when the task was last modified.
     *

     *
     * @param lastModifiedDate
     *        The date when the task was last modified.
     */

    public void setLastModifiedDate(java.util.Date lastModifiedDate) {
        this.lastModifiedDate = lastModifiedDate;
    }

    /**
     *

     * The date when the task was last modified.
     *

     *
     * @return The date when the task was last modified.
     */

    public java.util.Date getLastModifiedDate() {
        return this.lastModifiedDate;
    }

    /**
     *

     * The date when the task was last modified.
     *

     *
     * @param lastModifiedDate
     *        The date when the task was last modified.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withLastModifiedDate(java.util.Date lastModifiedDate) {
        setLastModifiedDate(lastModifiedDate);
        return this;
    }

    /**
     *

     * The task's template.
     *

     *
     * @param templateBody
     *        The task's template.
     */

    public void setTemplateBody(String templateBody) {
        this.templateBody = templateBody;
    }

    /**
     *

     * The task's template.
     *

     *
     * @return The task's template.
     */

    public String getTemplateBody() {
        return this.templateBody;
    }

    /**
     *

     * The task's template.
     *

     *
     * @param templateBody
     *        The task's template.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withTemplateBody(String templateBody) {
        setTemplateBody(templateBody);
        return this;
    }

    /**
     *

     * The S3 bucket that contains the input file.
     *

     *
     * @param inputFileBucket
     *        The S3 bucket that contains the input file.
     */

    public void setInputFileBucket(String inputFileBucket) {
        this.inputFileBucket = inputFileBucket;
    }

    /**
     *

     * The S3 bucket that contains the input file.
     *

     *
     * @return The S3 bucket that contains the input file.
     */

    public String getInputFileBucket() {
        return this.inputFileBucket;
    }

    /**
     *

     * The S3 bucket that contains the input file.
     *

     *
     * @param inputFileBucket
     *        The S3 bucket that contains the input file.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withInputFileBucket(String inputFileBucket) {
        setInputFileBucket(inputFileBucket);
        return this;
    }

    /**
     *

     * The input file key.
     *

     *
     * @param inputFileKey
     *        The input file key.
     */

    public void setInputFileKey(String inputFileKey) {
        this.inputFileKey = inputFileKey;
    }

    /**
     *

     * The input file key.
     *

     *
     * @return The input file key.
     */

    public String getInputFileKey() {
        return this.inputFileKey;
    }

    /**
     *

     * The input file key.
     *

     *
     * @param inputFileKey
     *        The input file key.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withInputFileKey(String inputFileKey) {
        setInputFileKey(inputFileKey);
        return this;
    }

    /**
     *

     * The role ARN that grants access to the input file bucket.
     *

     *
     * @param roleArn
     *        The role ARN that grants access to the input file bucket.
     */

    public void setRoleArn(String roleArn) {
        this.roleArn = roleArn;
    }

    /**
     *

     * The role ARN that grants access to the input file bucket.
     *

     *
     * @return The role ARN that grants access to the input file bucket.
     */

    public String getRoleArn() {
        return this.roleArn;
    }

    /**
     *

     * The role ARN that grants access to the input file bucket.
     *

     *
     * @param roleArn
     *        The role ARN that grants access to the input file bucket.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withRoleArn(String roleArn) {
        setRoleArn(roleArn);
        return this;
    }

    /**
     *

     * The status of the bulk thing provisioning task.
     *

     *
     * @param status
     *        The status of the bulk thing provisioning task.
     * @see Status
     */

    public void setStatus(String status) {
        this.status = status;
    }

    /**
     *

     * The status of the bulk thing provisioning task.
     *

     *
     * @return The status of the bulk thing provisioning task.
     * @see Status
     */

    public String getStatus() {
        return this.status;
    }

    /**
     *

     * The status of the bulk thing provisioning task.
     *

     *
     * @param status
     *        The status of the bulk thing provisioning task.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see Status
     */

    public DescribeThingRegistrationTaskResult withStatus(String status) {
        setStatus(status);
        return this;
    }

    /**
     *

     * The status of the bulk thing provisioning task.
     *

     *
     * @param status
     *        The status of the bulk thing provisioning task.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see Status
     */

    public DescribeThingRegistrationTaskResult withStatus(Status status) {
        this.status = status.toString();
        return this;
    }

    /**
     *

     * The message.
     *

     *
     * @param message
     *        The message.
     */

    public void setMessage(String message) {
        this.message = message;
    }

    /**
     *

     * The message.
     *

     *
     * @return The message.
     */

    public String getMessage() {
        return this.message;
    }

    /**
     *

     * The message.
     *

     *
     * @param message
     *        The message.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withMessage(String message) {
        setMessage(message);
        return this;
    }

    /**
     *

     * The number of things successfully provisioned.
     *

     *
     * @param successCount
     *        The number of things successfully provisioned.
     */

    public void setSuccessCount(Integer successCount) {
        this.successCount = successCount;
    }

    /**
     *

     * The number of things successfully provisioned.
     *

     *
     * @return The number of things successfully provisioned.
     */

    public Integer getSuccessCount() {
        return this.successCount;
    }

    /**
     *

     * The number of things successfully provisioned.
     *

     *
     * @param successCount
     *        The number of things successfully provisioned.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withSuccessCount(Integer successCount) {
        setSuccessCount(successCount);
        return this;
    }

    /**
     *

     * The number of things that failed to be provisioned.
     *

     *
     * @param failureCount
     *        The number of things that failed to be provisioned.
     */

    public void setFailureCount(Integer failureCount) {
        this.failureCount = failureCount;
    }

    /**
     *

     * The number of things that failed to be provisioned.
     *

     *
     * @return The number of things that failed to be provisioned.
     */

    public Integer getFailureCount() {
        return this.failureCount;
    }

    /**
     *

     * The number of things that failed to be provisioned.
     *

     *
     * @param failureCount
     *        The number of things that failed to be provisioned.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withFailureCount(Integer failureCount) {
        setFailureCount(failureCount);
        return this;
    }

    /**
     *

     * The progress of the bulk provisioning task expressed as a percentage.
     *

     *
     * @param percentageProgress
     *        The progress of the bulk provisioning task expressed as a percentage.
     */

    public void setPercentageProgress(Integer percentageProgress) {
        this.percentageProgress = percentageProgress;
    }

    /**
     *

     * The progress of the bulk provisioning task expressed as a percentage.
     *

     *
     * @return The progress of the bulk provisioning task expressed as a percentage.
     */

    public Integer getPercentageProgress() {
        return this.percentageProgress;
    }

    /**
     *

     * The progress of the bulk provisioning task expressed as a percentage.
     *

     *
     * @param percentageProgress
     *        The progress of the bulk provisioning task expressed as a percentage.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeThingRegistrationTaskResult withPercentageProgress(Integer percentageProgress) {
        setPercentageProgress(percentageProgress);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getTaskId() != null)
            sb.append("TaskId: ").append(getTaskId()).append(",");
        if (getCreationDate() != null)
            sb.append("CreationDate: ").append(getCreationDate()).append(",");
        if (getLastModifiedDate() != null)
            sb.append("LastModifiedDate: ").append(getLastModifiedDate()).append(",");
        if (getTemplateBody() != null)
            sb.append("TemplateBody: ").append(getTemplateBody()).append(",");
        if (getInputFileBucket() != null)
            sb.append("InputFileBucket: ").append(getInputFileBucket()).append(",");
        if (getInputFileKey() != null)
            sb.append("InputFileKey: ").append(getInputFileKey()).append(",");
        if (getRoleArn() != null)
            sb.append("RoleArn: ").append(getRoleArn()).append(",");
        if (getStatus() != null)
            sb.append("Status: ").append(getStatus()).append(",");
        if (getMessage() != null)
            sb.append("Message: ").append(getMessage()).append(",");
        if (getSuccessCount() != null)
            sb.append("SuccessCount: ").append(getSuccessCount()).append(",");
        if (getFailureCount() != null)
            sb.append("FailureCount: ").append(getFailureCount()).append(",");
        if (getPercentageProgress() != null)
            sb.append("PercentageProgress: ").append(getPercentageProgress());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof DescribeThingRegistrationTaskResult == false)
            return false;
        DescribeThingRegistrationTaskResult other = (DescribeThingRegistrationTaskResult) obj;
        if (other.getTaskId() == null ^ this.getTaskId() == null)
            return false;
        if (other.getTaskId() != null && other.getTaskId().equals(this.getTaskId()) == false)
            return false;
        if (other.getCreationDate() == null ^ this.getCreationDate() == null)
            return false;
        if (other.getCreationDate() != null && other.getCreationDate().equals(this.getCreationDate()) == false)
            return false;
        if (other.getLastModifiedDate() == null ^ this.getLastModifiedDate() == null)
            return false;
        if (other.getLastModifiedDate() != null && other.getLastModifiedDate().equals(this.getLastModifiedDate()) == false)
            return false;
        if (other.getTemplateBody() == null ^ this.getTemplateBody() == null)
            return false;
        if (other.getTemplateBody() != null && other.getTemplateBody().equals(this.getTemplateBody()) == false)
            return false;
        if (other.getInputFileBucket() == null ^ this.getInputFileBucket() == null)
            return false;
        if (other.getInputFileBucket() != null && other.getInputFileBucket().equals(this.getInputFileBucket()) == false)
            return false;
        if (other.getInputFileKey() == null ^ this.getInputFileKey() == null)
            return false;
        if (other.getInputFileKey() != null && other.getInputFileKey().equals(this.getInputFileKey()) == false)
            return false;
        if (other.getRoleArn() == null ^ this.getRoleArn() == null)
            return false;
        if (other.getRoleArn() != null && other.getRoleArn().equals(this.getRoleArn()) == false)
            return false;
        if (other.getStatus() == null ^ this.getStatus() == null)
            return false;
        if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
            return false;
        if (other.getMessage() == null ^ this.getMessage() == null)
            return false;
        if (other.getMessage() != null && other.getMessage().equals(this.getMessage()) == false)
            return false;
        if (other.getSuccessCount() == null ^ this.getSuccessCount() == null)
            return false;
        if (other.getSuccessCount() != null && other.getSuccessCount().equals(this.getSuccessCount()) == false)
            return false;
        if (other.getFailureCount() == null ^ this.getFailureCount() == null)
            return false;
        if (other.getFailureCount() != null && other.getFailureCount().equals(this.getFailureCount()) == false)
            return false;
        if (other.getPercentageProgress() == null ^ this.getPercentageProgress() == null)
            return false;
        if (other.getPercentageProgress() != null && other.getPercentageProgress().equals(this.getPercentageProgress()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getTaskId() == null) ? 0 : getTaskId().hashCode());
        hashCode = prime * hashCode + ((getCreationDate() == null) ? 0 : getCreationDate().hashCode());
        hashCode = prime * hashCode + ((getLastModifiedDate() == null) ? 0 : getLastModifiedDate().hashCode());
        hashCode = prime * hashCode + ((getTemplateBody() == null) ? 0 : getTemplateBody().hashCode());
        hashCode = prime * hashCode + ((getInputFileBucket() == null) ? 0 : getInputFileBucket().hashCode());
        hashCode = prime * hashCode + ((getInputFileKey() == null) ? 0 : getInputFileKey().hashCode());
        hashCode = prime * hashCode + ((getRoleArn() == null) ? 0 : getRoleArn().hashCode());
        hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
        hashCode = prime * hashCode + ((getMessage() == null) ? 0 : getMessage().hashCode());
        hashCode = prime * hashCode + ((getSuccessCount() == null) ? 0 : getSuccessCount().hashCode());
        hashCode = prime * hashCode + ((getFailureCount() == null) ? 0 : getFailureCount().hashCode());
        hashCode = prime * hashCode + ((getPercentageProgress() == null) ? 0 : getPercentageProgress().hashCode());
        return hashCode;
    }

    @Override
    public DescribeThingRegistrationTaskResult clone() {
        try {
            return (DescribeThingRegistrationTaskResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
#include "test/cpp/qps/benchmark_config.h"

#include "absl/flags/flag.h"

#include <grpc/support/log.h>
#include <grpcpp/create_channel.h>
#include <grpcpp/security/credentials.h>

#include "test/cpp/util/test_credentials_provider.h"

ABSL_FLAG(bool, enable_log_reporter, true,
          "Enable reporting of benchmark results through GprLog");

ABSL_FLAG(std::string, scenario_result_file, "",
          "Write JSON benchmark report to the file specified.");

ABSL_FLAG(std::string, hashed_id, "", "Hash of the user id");

ABSL_FLAG(std::string, test_name, "", "Name of the test being executed");

ABSL_FLAG(std::string, sys_info, "", "System information");

ABSL_FLAG(std::string, server_address, "localhost:50052",
          "Address of the performance database server");

ABSL_FLAG(std::string, tag, "", "Optional tag for the test");

ABSL_FLAG(std::string, rpc_reporter_server_address, "",
          "Server address for rpc reporter to send results to");

ABSL_FLAG(bool, enable_rpc_reporter, false, "Enable use of RPC reporter");

ABSL_FLAG(
    std::string, rpc_reporter_credential_type,
    grpc::testing::kInsecureCredentialsType,
    "Credential type for communication to the QPS benchmark report server");

namespace grpc {
namespace testing {

static std::shared_ptr<Reporter> InitBenchmarkReporters() {
  auto* composite_reporter = new CompositeReporter;
  if (absl::GetFlag(FLAGS_enable_log_reporter)) {
    composite_reporter->add(
        std::unique_ptr<Reporter>(new GprLogReporter("LogReporter")));
  }
  if (!absl::GetFlag(FLAGS_scenario_result_file).empty()) {
    composite_reporter->add(std::unique_ptr<Reporter>(new JsonReporter(
        "JsonReporter", absl::GetFlag(FLAGS_scenario_result_file))));
  }
  if (absl::GetFlag(FLAGS_enable_rpc_reporter)) {
    ChannelArguments channel_args;
    std::shared_ptr<ChannelCredentials> channel_creds =
        testing::GetCredentialsProvider()->GetChannelCredentials(
            absl::GetFlag(FLAGS_rpc_reporter_credential_type), &channel_args);
    GPR_ASSERT(!absl::GetFlag(FLAGS_rpc_reporter_server_address).empty());
    composite_reporter->add(std::unique_ptr<Reporter>(new RpcReporter(
        "RpcReporter",
        grpc::CreateChannel(absl::GetFlag(FLAGS_rpc_reporter_server_address),
                            channel_creds))));
  }

  return std::shared_ptr<Reporter>(composite_reporter);
}

std::shared_ptr<Reporter> GetReporter() {
  static std::shared_ptr<Reporter> reporter(InitBenchmarkReporters());
  return reporter;
}

}  // namespace testing
}  // namespace grpc


text:
<?php

namespace Sonata\DoctrineORMAdminBundle\Tests\Fixtures\Entity\Embeddable;

class EmbeddedEntity
{
    /**
     * @var bool
     */
    protected $plainField;
    /**
     * @var SubEmbeddedEntity
     */
    protected $subEmbeddedEntity;
}