text:
export ZEPPELIN_MEM="-Xmx4096m -XX:MaxPermSize=512m"            # Zeppelin jvm mem options Default -Xmx1024m -XX:MaxPermSize=512m
# export ZEPPELIN_INTP_MEM       # zeppelin interpreter process jvm mem options. Default = ZEPPELIN_MEM
# export ZEPPELIN_INTP_JAVA_OPTS # zeppelin interpreter process jvm options. Default = ZEPPELIN_JAVA_OPTS

# export ZEPPELIN_LOG_DIR        # Where log files are stored.  PWD by default.
# export ZEPPELIN_PID_DIR        # The pid files are stored. /tmp by default.
# export ZEPPELIN_NOTEBOOK_DIR   # Where notebook saved
# export ZEPPELIN_IDENT_STRING   # A string representing this instance of zeppelin. $USER by default.
# export ZEPPELIN_NICENESS       # The scheduling priority for daemons. Defaults to 0.

# export ZEPPELIN_SPARK_USEHIVECONTEXT    # Use HiveContext instead of SQLContext if set true. true by default.
# export ZEPPELIN_SPARK_CONCURRENTSQL     # Execute multiple SQL concurrently if set true. false by default.
# export ZEPPELIN_SPARK_MAXRESULT         # Max number of SparkSQL result to display. 1000 by default.

# Options read in YARN client mode
# export HADOOP_CONF_DIR         # yarn-site.xml is located in configuration directory in HADOOP_CONF_DIR.

# Pyspark (supported with Spark 1.2.1 and above)
# To configure pyspark, you need to set spark distribution's path to 'spark.home' property in Interpreter setting screen in Zeppelin GUI
# export PYSPARK_PYTHON          # path to the python command. must be the same path on the driver(Zeppelin) and all workers.
# export PYTHONPATH              # extra PYTHONPATH.


text:
%%
% The following simple ODE uncovers a surprise.
f = @(t,u) u.^2 - u.^3;
u0 = 0.005;

%%
% We will solve the problem first with the implicit AM2 method using
% $n=200$ steps.
[tI,uI] = am2(f,[0 400],u0,200);
plot(tI,uI)
xlabel('t'), ylabel('u(t)')   % ignore this line
title('AM2 solution')   % ignore this line

%%
% Now we repeat the process using the explicit AB4 method.
[tE,uE] = ab4(f,[0 400],u0,200);
hold on, plot(tE,uE), ylim([-1 2])
title('AM2 and AB4 solutions')  % ignore this line

%%
% Once the solution starts to take off, the AB4 result goes
% catastrophically wrong.
format short e, uE(105:111)

%%
% We hope that AB4 will converge in the limit $h\to 0$, so let's try using
% more steps.
for n = [1000 1600]
    [tE,uE] = ab4(f,[0 400],u0,n);
    plot(tE,uE)
end

%%
% So AB4, which is supposed to be _more_ accurate than AM2, actually needs
% something like 8 times as many steps to get a reasonable-looking answer!

redpajama_set_name: RedPajamaGithub


text:
.class Landroid/media/SoundPool$SoundPoolStub;
.super Ljava/lang/Object;
.source "SoundPool.java"

# interfaces
.implements Landroid/media/SoundPool$SoundPoolDelegate;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/media/SoundPool;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = "SoundPoolStub"
.end annotation

# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 625
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public final autoPause()V
    .locals 0

    .prologue
    .line 656
    return-void
.end method

.method public final autoResume()V
    .locals 0

    .prologue
    .line 658
    return-void
.end method

.method public load(Landroid/content/Context;II)I
    .locals 1
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "resId"    # I
    .param p3, "priority"    # I

    .prologue
    .line 632
    const/4 v0, 0x0

    return v0
.end method

.method public load(Landroid/content/res/AssetFileDescriptor;I)I
    .locals 1
    .param p1, "afd"    # Landroid/content/res/AssetFileDescriptor;
    .param p2, "priority"    # I

    .prologue
    .line 636
    const/4 v0, 0x0

    return v0
.end method

.method public load(Ljava/io/FileDescriptor;JJI)I
    .locals 1
    .param p1, "fd"    # Ljava/io/FileDescriptor;
    .param p2, "offset"    # J
    .param p4, "length"    # J
    .param p6, "priority"    # I

    .prologue
    .line 640
    const/4 v0, 0x0

    return v0
.end method

.method public load(Ljava/lang/String;I)I
    .locals 1
    .param p1, "path"    # Ljava/lang/String;
    .param p2, "priority"    # I

    .prologue
    .line 628
    const/4 v0, 0x0

    return v0
.end method

.method public final pause(I)V
    .locals 0
    .param p1, "streamID"    # I

    .prologue
    .line 652
    return-void
.end method

.method public final play(IFFIIF)I
    .locals 1
    .param p1, "soundID"    # I
    .param p2, "leftVolume"    # F
    .param p3, "rightVolume"    # F
    .param p4, "priority"    # I
    .param p5, "loop"    # I
    .param p6, "rate"    # F

    .prologue
    .line 649
    const/4 v0, 0x0

    return v0
.end method

.method public final release()V
    .locals 0

    .prologue
    .line 677
    return-void
.end method

.method public final resume(I)V
    .locals 0
    .param p1, "streamID"    # I

    .prologue
    .line 654
    return-void
.end method

.method public final setLoop(II)V
    .locals 0
    .param p1, "streamID"    # I
    .param p2, "loop"    # I

    .prologue
    .line 670
    return-void
.end method

.method public setOnLoadCompleteListener(Landroid/media/SoundPool$OnLoadCompleteListener;)V
    .locals 0
    .param p1, "listener"    # Landroid/media/SoundPool$OnLoadCompleteListener;

    .prologue
    .line 675
    return-void
.end method

.method public final setPriority(II)V
    .locals 0
    .param p1, "streamID"    # I
    .param p2, "priority"    # I

    .prologue
    .line 668
    return-void
.end method

.method public final setRate(IF)V
    .locals 0
    .param p1, "streamID"    # I
    .param p2, "rate"    # F

    .prologue
    .line 672
    return-void
.end method

.method public setVolume(IF)V
    .locals 0
    .param p1, "streamID"    # I
    .param p2, "volume"    # F

    .prologue
    .line 666
    return-void
.end method

.method public final setVolume(IFF)V
    .locals 0
    .param p1, "streamID"    # I
    .param p2, "leftVolume"    # F
    .param p3, "rightVolume"    # F

    .prologue
    .line 663
    return-void
.end method

.method public final stop(I)V
    .locals 0
    .param p1, "streamID"    # I

    .prologue
    .line 660
    return-void
.end method

.method public final unload(I)Z
    .locals 1
    .param p1, "soundID"    # I

    .prologue
    .line 644
    const/4 v0, 0x1

    return v0
.end method


text:
// Copyright 2021 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE

using System;
using System.Linq;

namespace Nuke.Common.Tools.Git
{
    public static partial class GitTasks
    {
        public static bool GitIsDetached()
        {
            return GitIsDetached(workingDirectory: null);
        }

        public static bool GitIsDetached(string workingDirectory)
        {
            return !Git("branch --show-current", workingDirectory, logOutput: false).Any();
        }

        public static bool GitHasCleanWorkingCopy()
        {
            return GitHasCleanWorkingCopy(workingDirectory: null);
        }

        public static bool GitHasCleanWorkingCopy(string workingDirectory)
        {
            return !Git("status --short", workingDirectory, logOutput: false).Any();
        }

        public static string GitCurrentBranch()
        {
            return GitCurrentBranch(workingDirectory: null);
        }

        public static string GitCurrentBranch(string workingDirectory)
        {
            return Git("rev-parse --abbrev-ref HEAD", workingDirectory, logOutput: false).Select(x => x.Text).Single();
        }

        public static string GitCurrentCommit()
        {
            return GitCurrentCommit(workingDirectory: null);
        }

        public static string GitCurrentCommit(string workingDirectory)
        {
            return Git("rev-parse HEAD", workingDirectory, logOutput: false).Select(x => x.Text).Single();
        }
    }
}


text:
<?php

namespace Google\Service\Datapipelines;

class GoogleCloudDatapipelinesV1SdkVersion extends \Google\Model
{
  /**
   * @var string
   */
  public $sdkSupportStatus;
  /**
   * @var string
   */
  public $version;
  /**
   * @var string
   */
  public $versionDisplayName;

  /**
   * @param string
   */
  public function setSdkSupportStatus($sdkSupportStatus)
  {
    $this->sdkSupportStatus = $sdkSupportStatus;
  }
  /**
   * @return string
   */
  public function getSdkSupportStatus()
  {
    return $this->sdkSupportStatus;
  }
  /**
   * @param string
   */
  public function setVersion($version)
  {
    $this->version = $version;
  }
  /**
   * @return string
   */
  public function getVersion()
  {
    return $this->version;
  }
  /**
   * @param string
   */
  public function setVersionDisplayName($versionDisplayName)
  {
    $this->versionDisplayName = $versionDisplayName;
  }
  /**
   * @return string
   */
  public function getVersionDisplayName()
  {
    return $this->versionDisplayName;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(GoogleCloudDatapipelinesV1SdkVersion::class, 'Google_Service_Datapipelines_GoogleCloudDatapipelinesV1SdkVersion');


text:
"""
Every project needs a "Map" class - it allows you to "dot" into dict.
This saves a lot of annoyance in typing and makes things easier to work with
"""

class Map(dict):
    """
    Acts like a dict and can also be dotted-into
    Adapted from a few StackOverflow Q&As

    Example:
    my_instance = Map(foo="a")
    my_instance["bar"] = "b"
    print(myinstance.foo)
    print(myinstance.bar)
    """

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    def __getattr__(self, attr):
        return self.get(attr)

    def __setattr__(self, key, value):
        self.__setitem__(key, value)

    def __setitem__(self, key, value):
        super().__setitem__(key, value)
        self.__dict__.update({key: value})

    def __delattr__(self, item):
        self.__delitem__(item)

    def __delitem__(self, key):
        super().__delitem__(key)
        del self.__dict__[key]


text:
@import '../variables';

/* https://github.com/dvtng/react-loading-skeleton/blob/master/src/index.css */
@keyframes progress {
  0% {
    background-position: -200px 0;
  }

  100% {
    background-position: calc(200px + 100%) 0;
  }

  /*
  0% {
    background-position: -100px;
  }

  100% {
    background-position: 140px;
  } */
}

.root {
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
  animation: progress 2s ease-in-out infinite;
  background-color: #eee;
  background-image: linear-gradient(90deg, #eee, #f5f5f5, #eee);
  background-size: 200px 100%;
  background-repeat: no-repeat;
  border-radius: 4px;
  display: inline-flex;
  line-height: 1;
  width: 100%;
  height: 100%;
}


text:
package com.ikaimen.pattern.BuilderPattern.demo1;

import java.util.ArrayList;

/**
 * Created by ChenTao on 2017/7/13.
 * 抽象汽车组装者
 */
public  abstract  class CarBuilder {

    public abstract  void setSequence(ArrayList<String> sequence);

    public abstract  CarModel getCarModel();
}


text:
require 'brakeman/checks/base_check'

#This check looks for calls to +eval+, +instance_eval+, etc. which include
#user input.
class Brakeman::CheckEvaluation < Brakeman::BaseCheck
  Brakeman::Checks.add self

  @description = "Searches for evaluation of user input"

  #Process calls
  def run_check
    Brakeman.debug "Finding eval-like calls"
    calls = tracker.find_call :method => [:eval, :instance_eval, :class_eval, :module_eval]

    Brakeman.debug "Processing eval-like calls"
    calls.each do |call|
      process_result call
    end
  end

  #Warns if result includes user input
  def process_result result
    if include_user_input? result[:call]
      warn :result => result,
        :warning_type => "Dangerous Eval",
        :message => "User input in eval",
        :code => result[:call],
        :confidence => CONFIDENCE[:high]
    end
  end
end


text:
<title>Results for Test Suite Example</title>
Select a result on the left-hand pane.


text:
class CreateQuizAttemptAnswers < ActiveRecord::Migration
  def self.up
    create_table :quiz_attempt_answers do |t|
      t.column :quiz_attempt_id, :integer, :null => false
      t.column :quiz_question_id, :integer, :null => false
      # this could be null if it is a text response
      t.column :quiz_question_answer_id, :integer, :null => true
      t.column :text_answer, :text, :null => true

      t.column :correct, :boolean, :null => false, :default => false

      t.timestamps
    end

    add_index(:quiz_attempt_answers, [:quiz_attempt_id], :unique => false)
    add_index(:quiz_attempt_answers, [:quiz_question_id], :unique => false)
  end

  def self.down
    drop_table :quiz_attempt_answers
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/detailTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/DeepBlue"
        android:textSize="16dp" />

    <TextView
        android:id="@+id/detailSubtitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/DeepBlue"
        android:textSize="12dp" />

</LinearLayout>


text:
<?php

namespace Surume\Runtime\Command\Threads;

use Surume\Runtime\Command\Command;
use Surume\Command\CommandInterface;
use Surume\Throwable\Exception\Runtime\Execution\RejectionException;

class ThreadsStartCommand extends Command implements CommandInterface
{
    /**
     * @param mixed[] $params
     * @return mixed
     * @throws RejectionException
     */
    protected function command($params = [])
    {
        if (!isset($params['aliases']))
        {
            throw new RejectionException('Invalid params.');
        }

        return $this->runtime->manager()->startThreads($params['aliases']);
    }
}


text:
title: Coodie Simmons, Chike Ozah
date: 2017-03-02 12:00:00 -0500

---
Coodie Simmons and Chike Ozah, (aka, Coodie and Chike) are the talented, award-winning, and directorial  duo behind work featured in high profile outlets and venues including ESPN, MTV and at the American Black Film Festival. Their latest project, _The First to Do It_ – a documentary on the life of Early Lloyd, the first African American to play in the NBA – premiered at the NBA All-Star Weekend. They worked with executive producers including Carmelo Anthony and Tony Parker on this important piece.

Notably, they directed the music video for Kanye West's breakthrough hit "Through the Wire." Their feature-length credentials include _Muhammad Ali: The People's Champ_ and _Benji_, an ESPN 30 for 30 documentary.


text:
package com.computing.cloud.to.request;

import lombok.Getter;

@Getter
public abstract class UserRequestTO {

	private String creditCard;
	private String email;
	private String username;

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<blog>
  <topic>Coding</topic>
  <author>amitesh</author>
  <tags>
    <tag>Computer Science</tag>
  </tags>
  <content>It's not a science , it's an art</content>
</blog>


text:
//
// GLSoundLevelScene.m
//
// Copyright (c) 2012 Mykhaylo Dutka
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "GLVisualizerScene.h"

@implementation GLVisualizerScene
@synthesize dataValues, sceneObjects;

-(id)init{
    self = [super init];
    if (self) {
        [self initSceneObjects];
    }
    return self;
}

/**
 * anarray with scene objects should be initialized there
 */
-(void)initSceneObjects{
    self.sceneObjects = nil;
}

-(void)awakeSceneObjects{
    [self.sceneObjects makeObjectsPerformSelector:@selector(awake)];
}

-(void)renderSceneObjects{
    [self.sceneObjects makeObjectsPerformSelector:@selector(render)];
}

-(void)upateSceneObjects{
    int c = [self.sceneObjects count];
    if(c > 0 && c <= [self.dataValues count]){
        for (int i=0; i<c; i++) {
            [self applyValue:i];
        }
    }
}

-(void)applyValue:(int)index{
    [[self.sceneObjects objectAtIndex:index] performSelector:@selector(updateWithDataValue:) withObject:[self.dataValues objectAtIndex:index]];
}

/**
 * required size for projection matrix
 */
-(CGSize)requiredProjectionSize{
    return CGSizeMake(2., 1.);
}

-(void)dealloc{
    [sceneObjects release];
    [dataValues release];
    [super dealloc];
}
@end


text:
<?php

namespace ANDS\API\Task\ImportSubTask;

use ANDS\Registry\Group;
use ANDS\Registry\Providers\RIFCS\CoreMetadataProvider;
use ANDS\Registry\Providers\RIFCS\DatesProvider;
use ANDS\Registry\Providers\RIFCS\SlugProvider;
use ANDS\Registry\Providers\RIFCS\TitleProvider;
use ANDS\RegistryObject;
use ANDS\Util\XMLUtil;

/**
 * Class ProcessCoreMetadata
 * @package ANDS\API\Task\ImportSubTask
 */
class ProcessCoreMetadata extends ImportSubTask
{
    protected $requireHarvestedOrImportedRecords = true;
    protected $title = "PROCESSING CORE METADATA";

    public function run_task()
    {
        $this->processUpdatedRecords();
    }

    /**
     * Update importedRecords core metadata
     *
     */
    public function processUpdatedRecords()
    {
        $importedRecords = $this->parent()->getTaskData("importedRecords");

        if ($importedRecords === false || $importedRecords === null) {
            return;
        }

        $total = count($importedRecords);

        foreach ($importedRecords as $index => $roID) {

            $record = RegistryObject::find($roID);

            // ProcessCoreMetadata, class, group, type, ANDS\Group get set
            try {
                CoreMetadataProvider::process($record);
            } catch (\Exception $e) {
                $this->addError("Failed CoreMetadataProvider process on record $roID: ". get_exception_msg($e));
                continue;
            }

            // process Title
            try {
                TitleProvider::process($record);
            } catch (\Exception $e) {
                $this->addError("Failed Title processing on record $roID: ". get_exception_msg($e));
                continue;
            }

            // process dates
            try {
                DatesProvider::process($record);
            } catch (\Exception $e) {
                $this->addError("Failed Date processing on record $roID: ". get_exception_msg($e));
                continue;
            }

            //determine harvest_id
            $record->setRegistryObjectAttribute('harvest_id',
                $this->parent()->batchID);

            $record->status = $this->parent()->getTaskData("targetStatus");

            $record->save();

            // generate and save the slug
            try {
                SlugProvider::process($record);
            } catch (\Exception $e) {
                $this->addError("Failed to process slug on record $roID: " . get_exception_msg($e));
            }

            $this->updateProgress($index, $total, "Processed ($index/$total) $record->title($roID)");
            unset($ro);
        }
    }

}


text:
import themeGet from 'extensions/themeGet';
import { NAMESPACE } from 'theme';

describe('the theme getter tool', () => {
  const theme = {
    [NAMESPACE]: {
      colors: {
        primary: 'blue',
        secondary: 'red',
        tertiary: 'green',
      },
      fonts: {
        default: 'Comic Sans',
        fancy: 'Century Gothic',
      },
    },
  };

  test('gets a simple key', () => {
    expect(themeGet('colors.primary')({ theme })).toEqual('blue');
  });

  test('throws on unknown key', () => {
    expect(() => themeGet('foo.bar')({ theme })).toThrow();
  });

  test('can do conditional get', () => {
    const getter = themeGet
      .if(props => props.foo, 'fonts.default')
      .else('fonts.fancy');
    expect(getter({ theme, foo: true })).toEqual('Comic Sans');
    expect(getter({ theme, foo: false })).toEqual('Century Gothic');
  });

  test('can do multi-clause conditional get', () => {
    const getter = themeGet
      .if(props => props.foo === 1, 'colors.primary')
      .if(props => props.foo === 2, 'colors.secondary')
      .else('colors.tertiary');
    expect(getter({ theme, foo: 1 })).toEqual('blue');
    expect(getter({ theme, foo: 2 })).toEqual('red');
    expect(getter({ theme, foo: 3 })).toEqual('green');
  });

  test('can use raw values in else', () => {
    const getter = themeGet
      .if(props => props.foo, 'colors.primary')
      .else('black');

    expect(getter({ theme, foo: false })).toEqual('black');
  });

  test('throws if no else is used in conditional', () => {
    const getter = themeGet.if(props => props.foo, 'colors.primary');

    expect(() => getter({ theme, foo: true })).toThrow();
  });
});


text:
ITEM.Name = "Butterfly Knife" .. " | " .. "Gamma Doppler"
ITEM.Price = 20000
ITEM.Model = "models/weapons/w_csgo_butterfly.mdl"
ITEM.Skin = 18
ITEM.WeaponClass = "csgo_butterfly_gamma_doppler"

function ITEM:OnEquip(ply)
	ply:Give(self.WeaponClass)
end

function ITEM:OnBuy(ply)
	ply:Give(self.WeaponClass)
	ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnSell(ply)
	ply:StripWeapon(self.WeaponClass)
end

function ITEM:OnHolster(ply)
	ply:StripWeapon(self.WeaponClass)
end


text:
<?php

namespace Oro\Bundle\DataAuditBundle\Tests\Functional\EventListener;

use Doctrine\ORM\Proxy\Proxy;
use Oro\Bundle\DataAuditBundle\Tests\Functional\Environment\Entity\TestAuditDataChild;
use Oro\Bundle\DataAuditBundle\Tests\Functional\Environment\Entity\TestAuditDataOwner;
use Oro\Bundle\TestFrameworkBundle\Test\WebTestCase;

/**
 * @dbIsolationPerTest
 */
class SendUpdatedEntitiesToMessageQueueTest extends WebTestCase
{
    use SendChangedEntitiesToMessageQueueExtensionTrait;

    protected function setUp()
    {
        $this->initClient();
    }

    public function testShouldSendAllUpdatedEntities()
    {
        $fooOwner = $this->createOwner();
        $barOwner = $this->createOwner();
        $bazOwner = $this->createOwner();

        $em = $this->getEntityManager();

        $fooOwner->setStringProperty('aString');
        $barOwner->setStringProperty('aString');
        $bazOwner->setStringProperty('aString');

        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertEntitiesUpdatedInMessageCount(3, $message);
        $this->assertEntitiesInsertedInMessageCount(0, $message);
        $this->assertEntitiesDeletedInMessageCount(0, $message);
        $this->assertCollectionsUpdatedInMessageCount(0, $message);
    }

    public function testShouldSendWhenStringPropertyChanged()
    {
        $owner = $this->createOwner();
        $owner->setStringProperty('aString');

        $em = $this->getEntityManager();
        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertEntitiesUpdatedInMessageCount(1, $message);
        $this->assertEntitiesInsertedInMessageCount(0, $message);
        $this->assertEntitiesDeletedInMessageCount(0, $message);
        $this->assertCollectionsUpdatedInMessageCount(0, $message);

        $insertedEntity = $message->getBody()['entities_updated'][spl_object_hash($owner)];

        $this->assertEquals(TestAuditDataOwner::class, $insertedEntity['entity_class']);
        $this->assertEquals($owner->getId(), $insertedEntity['entity_id']);
        $this->assertEquals([
            'stringProperty' => [null, 'aString'],
        ], $insertedEntity['change_set']);
    }

    public function testShouldSendRealClassWhenProxyEntityChanged()
    {
        $owner = $this->createOwner();

        $em = $this->getEntityManager();
        $em->clear();

        $owner = $em->getReference(TestAuditDataOwner::class, $owner->getId());
        //guard
        $this->assertInstanceOf(Proxy::class, $owner);

        $owner->setStringProperty('aString');
        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertEntitiesUpdatedInMessageCount(1, $message);
        $this->assertEntitiesInsertedInMessageCount(0, $message);
        $this->assertEntitiesDeletedInMessageCount(0, $message);
        $this->assertCollectionsUpdatedInMessageCount(0, $message);

        $insertedEntity = $message->getBody()['entities_updated'][spl_object_hash($owner)];

        $this->assertEquals(TestAuditDataOwner::class, $insertedEntity['entity_class']);
        $this->assertEquals($owner->getId(), $insertedEntity['entity_id']);
        $this->assertEquals([
            'stringProperty' => [null, 'aString'],
        ], $insertedEntity['change_set']);
    }

    public function testShouldSendWhenIntegerPropertyChanged()
    {
        $owner = $this->createOwner();
        $owner->setIntegerProperty(1234);

        $em = $this->getEntityManager();
        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertEntitiesUpdatedInMessageCount(1, $message);
        $this->assertEntitiesInsertedInMessageCount(0, $message);
        $this->assertEntitiesDeletedInMessageCount(0, $message);

        $insertedEntity = $message->getBody()['entities_updated'][spl_object_hash($owner)];

        $this->assertEquals(TestAuditDataOwner::class, $insertedEntity['entity_class']);
        $this->assertEquals($owner->getId(), $insertedEntity['entity_id']);
        $this->assertEquals([
            'integerProperty' => [null, 1234],
        ], $insertedEntity['change_set']);
    }

    public function testShouldSendWhenObjectPropertyChanged()
    {
        $owner = $this->createOwner();
        $owner->setObjectProperty(['foo' => 'fooVal']);

        $em = $this->getEntityManager();
        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertEntitiesUpdatedInMessageCount(1, $message);
        $this->assertEntitiesInsertedInMessageCount(0, $message);
        $this->assertEntitiesDeletedInMessageCount(0, $message);
        $this->assertCollectionsUpdatedInMessageCount(0, $message);

        $insertedEntity = $message->getBody()['entities_updated'][spl_object_hash($owner)];

        $this->assertEquals(TestAuditDataOwner::class, $insertedEntity['entity_class']);
        $this->assertEquals($owner->getId(), $insertedEntity['entity_id']);
        $this->assertEquals([
            'objectProperty' => [null, ['foo' => 'fooVal']],
        ], $insertedEntity['change_set']);
    }

    public function testShouldSendWhenJsonArrayPropertyChanged()
    {
        $owner = $this->createOwner();
        $owner->setJsonArrayProperty(['foo' => 'fooVal']);

        $em = $this->getEntityManager();
        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertTrue(isset($message->getBody()['entities_updated'][spl_object_hash($owner)]));
        $insertedEntity = $message->getBody()['entities_updated'][spl_object_hash($owner)];

        $this->assertEquals(TestAuditDataOwner::class, $insertedEntity['entity_class']);
        $this->assertEquals($owner->getId(), $insertedEntity['entity_id']);
        $this->assertEquals([
            'jsonArrayProperty' => [null, ['foo' => 'fooVal']],
        ], $insertedEntity['change_set']);
    }

    public function testShouldSendWhenDateTimePropertyChanged()
    {
        $owner = $this->createOwner();
        $owner->setDateProperty(new \DateTime('2010-11-12 00:01:02+0000'));

        $em = $this->getEntityManager();
        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertEntitiesUpdatedInMessageCount(1, $message);
        $this->assertEntitiesInsertedInMessageCount(0, $message);
        $this->assertEntitiesDeletedInMessageCount(0, $message);
        $this->assertCollectionsUpdatedInMessageCount(0, $message);

        $insertedEntity = $message->getBody()['entities_updated'][spl_object_hash($owner)];

        $this->assertEquals(TestAuditDataOwner::class, $insertedEntity['entity_class']);
        $this->assertEquals($owner->getId(), $insertedEntity['entity_id']);
        $this->assertEquals([
            'dateProperty' => [null, '2010-11-12T00:01:02+0000'],
        ], $insertedEntity['change_set']);
    }

    public function testShouldNotSendWhenDateTimePropertyChangedToExactlySameDateTime()
    {
        $date = new \DateTime('2010-11-12 00:01:02+0000');
        $sameDate = clone $date;

        $owner = $this->createOwner();
        $owner->setDateProperty($date);

        $em = $this->getEntityManager();
        $em->flush();

        self::getMessageCollector()->clear();

        $owner->setDateProperty($sameDate);
        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertEntitiesUpdatedInMessageCount(1, $message);
        $this->assertEntitiesInsertedInMessageCount(0, $message);
        $this->assertEntitiesDeletedInMessageCount(0, $message);
        $this->assertCollectionsUpdatedInMessageCount(0, $message);

        $insertedEntity = $message->getBody()['entities_updated'][spl_object_hash($owner)];

        $this->assertEquals(TestAuditDataOwner::class, $insertedEntity['entity_class']);
        $this->assertEquals($owner->getId(), $insertedEntity['entity_id']);
    }

    public function testShouldSendWhenOneToOnePropertyChangedFromNullToChild()
    {
        $child = $this->createChild();

        $em = $this->getEntityManager();
        $em->flush();

        self::getMessageCollector()->clear();

        $owner = $this->createOwner();
        $owner->setChild($child);

        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertEntitiesUpdatedInMessageCount(1, $message);
        $this->assertEntitiesInsertedInMessageCount(0, $message);
        $this->assertEntitiesDeletedInMessageCount(0, $message);
        $this->assertCollectionsUpdatedInMessageCount(0, $message);

        $insertedEntity = $message->getBody()['entities_updated'][spl_object_hash($owner)];

        $this->assertEquals(TestAuditDataOwner::class, $insertedEntity['entity_class']);
        $this->assertEquals($owner->getId(), $insertedEntity['entity_id']);
        $this->assertEquals([
            'child' => [null, [
                'entity_class' => TestAuditDataChild::class,
                'entity_id' => $child->getId(),
            ]],
        ], $insertedEntity['change_set']);
    }

    public function testShouldSendWhenOneToOnePropertyChangedFromOneChildToAnother()
    {
        $firstChild = $this->createChild();
        $secondChild = $this->createChild();
        $owner = $this->createOwner();

        $em = $this->getEntityManager();

        $owner->setChild($firstChild);

        $em->flush();
        self::getMessageCollector()->clear();

        $owner->setChild($secondChild);
        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertEntitiesUpdatedInMessageCount(1, $message);
        $this->assertEntitiesInsertedInMessageCount(0, $message);
        $this->assertEntitiesDeletedInMessageCount(0, $message);
        $this->assertCollectionsUpdatedInMessageCount(0, $message);

        $insertedEntity = $message->getBody()['entities_updated'][spl_object_hash($owner)];

        $this->assertEquals(TestAuditDataOwner::class, $insertedEntity['entity_class']);
        $this->assertEquals($owner->getId(), $insertedEntity['entity_id']);
        $this->assertEquals([
            'child' => [
                [
                    'entity_class' => TestAuditDataChild::class,
                    'entity_id' => $firstChild->getId(),
                ],
                [
                    'entity_class' => TestAuditDataChild::class,
                    'entity_id' => $secondChild->getId(),
                ]
            ],
        ], $insertedEntity['change_set']);
    }

    public function testShouldSendWhenOneToOnePropertyChangedWithProxyChild()
    {
        $child = $this->createChild();

        $em = $this->getEntityManager();
        $em->clear();

        $childProxy = $em->getReference(TestAuditDataChild::class, $child->getId());
        //guard
        $this->assertInstanceOf(Proxy::class, $childProxy);

        self::getMessageCollector()->clear();

        $owner = $this->createOwner();
        $owner->setChild($childProxy);

        $em->flush();

        $message = $this->getFirstEntitiesChangedMessage();
        $this->assertEntitiesUpdatedInMessageCount(1, $message);
        $this->assertEntitiesInsertedInMessageCount(0, $message);
        $this->assertEntitiesDeletedInMessageCount(0, $message);
        $this->assertCollectionsUpdatedInMessageCount(0, $message);

        $insertedEntity = $message->getBody()['entities_updated'][spl_object_hash($owner)];

        $this->assertEquals([
            'child' => [null, [
                'entity_class' => TestAuditDataChild::class,
                'entity_id' => $child->getId(),
            ]],
        ], $insertedEntity['change_set']);
    }
}