text:
<?php

namespace garethp\ews\API\Type;

/**
 * Class representing BaseObjectChangedEventType
 *
 *
 * XSD Type: BaseObjectChangedEventType
 *
 * @method \DateTime getTimeStamp()
 * @method BaseObjectChangedEventType setTimeStamp(\DateTime $timeStamp)
 * @method FolderIdType getFolderId()
 * @method BaseObjectChangedEventType setFolderId(FolderIdType $folderId)
 * @method ItemIdType getItemId()
 * @method BaseObjectChangedEventType setItemId(ItemIdType $itemId)
 * @method FolderIdType getParentFolderId()
 * @method BaseObjectChangedEventType setParentFolderId(FolderIdType $parentFolderId)
 */
class BaseObjectChangedEventType extends BaseNotificationEventType
{

    /**
     * @var \DateTime
     */
    protected $timeStamp = null;

    protected $_typeMap = array(
        'timeStamp' => 'dateTime',
    );

    /**
     * @var \garethp\ews\API\Type\FolderIdType
     */
    protected $folderId = null;

    /**
     * @var \garethp\ews\API\Type\ItemIdType
     */
    protected $itemId = null;

    /**
     * @var \garethp\ews\API\Type\FolderIdType
     */
    protected $parentFolderId = null;
}


text:
msgbus
======

message bus

redpajama_set_name: RedPajamaGithub


text:
function sp = clean_sympoly(sp,tol)
% clean_sympoly: clean up a scalar sympoly, coallesce terms & drop excess vars
% usage: sp = clean_sympoly(sp)
% usage: sp = clean_sympoly(sp,tol)
%
%  End users of the sympoly tools should not in
%  general find a need to use clean_sympoly.
%
% arguments:
%  sp  - a scalar sympoly
%
%  tol - (OPTIONAL) scalar, relative tolerance to
%       drop essentially zero terms from the sympoly
%
%       DEFAULT: 0
%

% collect any terms that may have coallesced
if length(sp.Coefficient)>1
  [sp.Exponent,sp.Coefficient] = consolidator( ...
    sp.Exponent,sp.Coefficient,'sum');
end

% drop any variables that have all zero exponents
k = all(sp.Exponent==0,1);
if all(k)
  sp.Exponent = 0;
  sp.Var = {''};
  sp.Coefficient = sum(sp.Coefficient);
elseif any(k)
  k=find(k);
  L = cellfun('isempty',sp.Var(k));
  k(L)=[];

  sp.Exponent(:,k) = [];
  sp.Var(k) = [];
end

% drop any terms with a zero coefficient, unless it was
% the only term.
if numel(sp.Coefficient) > 1
  if (nargin<2) || isempty(tol)
    %    tol = eps(100);
    tol = 0;
  end
  ctol = tol*max(abs(sp.Coefficient));

  k = (abs(sp.Coefficient) <= ctol);
  if any(k)
    sp.Exponent(k,:)=[];
    sp.Coefficient(k,:)=[];
  end
end

% check for a degenerate sympoly
if isempty(sp.Coefficient)
  % its zero
  sp.Var = {''};
  sp.Exponent = 0;
  sp.Coefficient = 0;
end


text:
WORK IN PROGRESS: The movement of this bundle from Symfony to Doctrine orgainisation is not yet finished!

Doctrine DBAL & ORM Bundle for the Symfony Framework.

Because Symfony 2 does not want to force or suggest a specific persistence solutions on the users
this bundle was removed from the core of the Symfony 2 framework. Doctrine2 will still be a major player
in the Symfony world and the bundle is maintained by developers in the Doctrine and Symfony communities.

IMPORTANT: This bundle is developed for Symfony 2.1 and up. For Symfony 2.0 applications the DoctrineBundle
is still shipped with the core Symfony repository.

## What is Doctrine?

The Doctrine Project is the home of a selected set of PHP libraries primarily focused on providing persistence
services and related functionality. Its prize projects are a Object Relational Mapper and the Database Abstraction
Layer it is built on top of. You can read more about the projects below or view a list of all projects.

Object relational mapper (ORM) for PHP that sits on top of a powerful database abstraction layer (DBAL).
One of its key features is the option to write database queries in a proprietary object oriented SQL dialect
called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful
alternative to SQL that maintains flexibility without requiring unnecessary code duplication.

DBAL is a powerful database abstraction layer with many features for database schema introspection,
schema management and PDO abstraction.

## Installation

### 1. Old deps and bin/vendors way

Add the following snippets to "deps" files:

    [doctrine-dbal]
        git=http://github.com/doctrine/dbal.git

    [doctrine-orm]
        git=http://github.com/doctrine/doctrine2.git

    [DoctrineBundle]
        git=http://github.com/doctrine/DoctrineBundle.git
        target=/bundles/Doctrine/Bundle/DoctrineBundle

### 2. Composer

Add the following dependencies to your projects composer.json file:

    "require": {
        # ..
        "doctrine/doctrine-bundle": ">=2.1"
        # ..
    }

## Documentation

See the Resources/docs folder more a full documentation.


text:
#ifndef itkMultipleLogOutput_h
#define itkMultipleLogOutput_h

#include "itkLogOutput.h"

#include <fstream>
#include <set>

namespace itk
{
/** \class MultipleLogOutput
 * \brief Allows writing simultaneously to multiple streams. Note that the
 *        class derives from std::streambuf and contains a
 *        std::set<> of LogOutput.
 *
 * \author Hee-Su Kim, Compute Science Dept. Kyungpook National University,
 *                     ISIS Center, Georgetown University.
 *
 * \ingroup OSSystemObjects LoggingObjects
 * \ingroup ITKCommon
 */

class ITKCommon_EXPORT MultipleLogOutput:public LogOutput
{
public:
  ITK_DISALLOW_COPY_AND_ASSIGN(MultipleLogOutput);

  using Self = MultipleLogOutput;
  using Superclass = LogOutput;
  using Pointer = SmartPointer< Self >;
  using ConstPointer = SmartPointer< const Self >;

  using OutputType = LogOutput;

  itkTypeMacro(MultipleLogOutput, LogOutput);
  itkNewMacro(MultipleLogOutput);

public:

  /** Register a additional output stream into the list of LogOutputs to write
   * to. The messages will be sent to the streams in the same order that the
   * streams have been added here.  */
  void AddLogOutput(OutputType *output);

  /** Broadcast a flush operation to all the output streams */
  void Flush() override;

  /** Write to multiple outputs */
  void Write(double timestamp) override;

  /** Write to multiple outputs */
  void Write(const std::string & content) override;

  /** Write to a buffer */
  void Write(const std::string & content, double timestamp) override;

protected:
  /** Constructor */
  MultipleLogOutput();

  /** Destructor */
  ~MultipleLogOutput() override;

private:
  using ContainerType = std::set< OutputType::Pointer >;

  ContainerType m_Output;
};
}

#endif //itkMultipleLogOutput_h


text: {{item.name}}


text:
package org.testcontainers.junit.mssqlserver;

import org.apache.commons.lang.RandomStringUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.testcontainers.MSSQLServerTestImages;
import org.testcontainers.containers.MSSQLServerContainer;

import java.util.Arrays;
import java.util.Collection;

import static org.rnorth.visibleassertions.VisibleAssertions.fail;

/**
 * Tests if the password passed to the container satisfied the password policy described at
 * https://docs.microsoft.com/en-us/sql/relational-databases/security/password-policy?view=sql-server-2017
 *
 * @author Enrico Costanzi
 */
@RunWith(Parameterized.class)
public class CustomPasswordMSSQLServerTest {

    private static String UPPER_CASE_LETTERS = "ABCDE";
    private static String LOWER_CASE_LETTERS = "abcde";
    private static String NUMBERS = "12345";
    private static String SPECIAL_CHARS = "_(!)_";

    private String password;
    private Boolean valid;

    public CustomPasswordMSSQLServerTest(String password, Boolean valid) {
        this.password = password;
        this.valid = valid;
    }

    @Parameterized.Parameters
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][]{
            new Object[]{null, false},
            // too short
            {"abc123", false},

            // too long
            {RandomStringUtils.randomAlphabetic(129), false},

            // only 2 categories
            {UPPER_CASE_LETTERS + NUMBERS, false},
            {UPPER_CASE_LETTERS + SPECIAL_CHARS, false},
            {LOWER_CASE_LETTERS + NUMBERS, false},
            {LOWER_CASE_LETTERS + SPECIAL_CHARS, false},
            {NUMBERS + SPECIAL_CHARS, false},

            // 3 categories
            {UPPER_CASE_LETTERS + LOWER_CASE_LETTERS + NUMBERS, true},
            {UPPER_CASE_LETTERS + LOWER_CASE_LETTERS + SPECIAL_CHARS, true},
            {UPPER_CASE_LETTERS + NUMBERS + SPECIAL_CHARS, true},
            {LOWER_CASE_LETTERS + NUMBERS + SPECIAL_CHARS, true},

            // 4 categories
            {UPPER_CASE_LETTERS + LOWER_CASE_LETTERS + NUMBERS + SPECIAL_CHARS, true},

        });
    }

    @Test
    public void runPasswordTests() {
        try {
            new MSSQLServerContainer<>(MSSQLServerTestImages.MSSQL_SERVER_IMAGE).withPassword(this.password);
            if (!valid)
                fail("Password " + this.password + " is not valid. Expected exception");
        } catch (IllegalArgumentException e) {
            if (valid)
                fail("Password " + this.password + " should have been validated");
        }
    }

}


text:
package org.gilmarie.web.jmsclient;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import javax.servlet.ServletException;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class WebClientNumerator extends HttpServlet
{
	private static final transient Logger LOG = LoggerFactory.getLogger(WebClientNumerator.class);

    private int sequenceNum;
    private Object seqNumLock = new Object();

    public void init(ServletConfig servletConfig) throws ServletException {
        super.init(servletConfig);

		sequenceNum = 0;
		LOG.info("[WebClientNumerator] sequence number initialized : " + sequenceNum);
    }

	private String getNextSeqNumber() {

		synchronized (seqNumLock) {

			sequenceNum = (sequenceNum == 999999) ? 1 : sequenceNum + 1;
			return String.format("%06d",sequenceNum);
		}
	}

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // lets turn the HTTP post into a JMS Message
       response.setContentType("text/xml");
       response.setHeader("Cache-Control", "no-cache");

       response.setStatus(HttpServletResponse.SC_OK);
       StringWriter swriter = new StringWriter();
       PrintWriter writer = new PrintWriter(swriter);
       String seqNum = getNextSeqNumber();
       LOG.info("[WebClientNumerator] sequence number for session id : " + seqNum);
       writer.println("<ajax-response>");
       writer.println(String.format("<response seqnum='%s'/>",seqNum));
	   writer.print("</ajax-response>");
       writer.flush();
       String m = swriter.toString();
       response.getWriter().println(m);
   }

}


text:
package hibernate.dao;

import org.springframework.orm.hibernate3.HibernateTemplate;

import hibernate.bo.StudentCard;

public class StudentCardDao {

	private HibernateTemplate hibernateTemplate;

	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}

	public void saveStudentCard(StudentCard stuCard) {
		this.hibernateTemplate.saveOrUpdate(stuCard);
	}

	public void removeStudentCard(StudentCard stuCard) {
		this.hibernateTemplate.delete(stuCard);
	}

	public StudentCard findStudentCard(Long id) {
		return (StudentCard) this.hibernateTemplate.get(StudentCard.class, id);
	}

}


text:
namespace views {
class WebView;
class Textfield;
class ProgressBar;
}

namespace content {
class DownloadItem;
}

namespace xwalk {
class DownloadBarView;
class XWalkDevToolsFrontend;

class NativeAppWindowDesktop : public NativeAppWindowViews,
                               public views::ButtonListener,
                               public ui::SelectFileDialog::Listener {
 public:
  explicit NativeAppWindowDesktop(const NativeAppWindow::CreateParams& params);
  ~NativeAppWindowDesktop() override;

  void SetLoadProgress(double progress);
  void SetAddressURL(const std::string& url);
  void UpdateWebViewPreferredSize();
  void AddDownloadItem(content::DownloadItem* download_item,
      const content::DownloadTargetCallback& callback,
      const base::FilePath& suggested_path);
  void FocusContent();

 private:
  class AddressView;
  class ContextMenuModel;
  class DevToolsWebContentsObserver;

  // NativeAppWindowViews implementation.
  // User right-clicked on the web view
  bool PlatformHandleContextMenu(
      const content::ContextMenuParams& params) override;
  void ViewHierarchyChanged(
      const ViewHierarchyChangedDetails& details) override;
  void OnBoundsChanged(const gfx::Rect& previous_bounds) override;

  // ButtonListener implementation.
  void ButtonPressed(views::Button* sender, const ui::Event& event) override;

  void ShowWebViewContextMenu(const content::ContextMenuParams& params);
  void OnDevToolsWebContentsDestroyed();
  void InnerShowDevTools();
  void ShowDevToolsForElementAt(int x, int y);

  // SelectFileDialog::Listener implementation.
  void FileSelected(const base::FilePath& path,
      int index,
      void* params) override;
  void FileSelectionCanceled(void* params) override;

  void InitStandaloneUI();
  void InitMinimalUI();

  // Toolbar view contains forward/backward/reload button and URL entry.
  views::View* toolbar_view_;
  views::LabelButton* back_button_;
  views::LabelButton* forward_button_;
  views::LabelButton* refresh_button_;
  views::LabelButton* stop_button_;
  AddressView* address_bar_;
  views::View* contents_view_;
  DownloadBarView* download_bar_view_;
  scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
  std::unique_ptr<ContextMenuModel> context_menu_model_;
  std::unique_ptr<views::MenuRunner> context_menu_runner_;

  std::unique_ptr<DevToolsWebContentsObserver> devtools_observer_;
  XWalkDevToolsFrontend* devtools_frontend_;

  DISALLOW_COPY_AND_ASSIGN(NativeAppWindowDesktop);
};

inline NativeAppWindowDesktop* ToNativeAppWindowDesktop(
    NativeAppWindow* window) {
  return static_cast<NativeAppWindowDesktop*>(window);
}

}  // namespace xwalk

#endif  // XWALK_RUNTIME_BROWSER_UI_NATIVE_APP_WINDOW_DESKTOP_H_


text:
<?php

namespace Plank\Mediable\Tests\Mocks;

class MockCallable
{
    public function __invoke()
    {
    }
}


text:
<?php

declare(strict_types=1);

namespace ApiPlatform\Core\Tests\Bridge\NelmioApiDoc\Parser;

use ApiPlatform\Core\Bridge\NelmioApiDoc\Parser\ApiPlatformParser;
use ApiPlatform\Core\Exception\ResourceClassNotFoundException;
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
use ApiPlatform\Core\Metadata\Property\PropertyMetadata;
use ApiPlatform\Core\Metadata\Property\PropertyNameCollection;
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
use ApiPlatform\Core\Metadata\Resource\ResourceMetadata;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Dummy;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RelatedDummy;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\UnknownDummy;
use Nelmio\ApiDocBundle\DataTypes;
use Nelmio\ApiDocBundle\Parser\ParserInterface;
use Prophecy\Argument;
use Symfony\Component\PropertyInfo\Type;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;

/**
 * @author Teoh Han Hui <teohhanhui@gmail.com>
 */
class ApiPlatformParserTest extends \PHPUnit_Framework_TestCase
{
    public function testConstruct()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory);

        $this->assertInstanceOf(ParserInterface::class, $apiPlatformParser);
    }

    public function testSupports()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactoryProphecy->create(Dummy::class)->willReturn(new ResourceMetadata())->shouldBeCalled();
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory);

        $this->assertTrue($apiPlatformParser->supports([
            'class' => sprintf('%s:%s', ApiPlatformParser::OUT_PREFIX, Dummy::class),
        ]));
    }

    public function testNoOnDataFirstArray()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactoryProphecy->create(Dummy::class)->willReturn(new ResourceMetadata());
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory);

        $this->assertFalse($apiPlatformParser->supports([
            'class' => sprintf('%s', ApiPlatformParser::OUT_PREFIX),
        ]));
    }

    public function testSupportsAttributeNormalization()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactoryProphecy->create('Acme\CustomAttributeDummy')->willReturn(new ResourceMetadata('dummy', 'dummy', null, [
            'get' => ['method' => 'GET', 'normalization_context' => ['groups' => ['custom_attr_dummy_get']]],
            'put' => ['method' => 'PUT', 'denormalization_context' => ['groups' => ['custom_attr_dummy_put']]],
            'delete' => ['method' => 'DELETE'],
        ], []))->shouldBeCalled();
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactoryProphecy->create('Acme\CustomAttributeDummy', Argument::cetera())->willReturn(new PropertyNameCollection([
            'id',
            'name',
        ]))->shouldBeCalled();
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $idPropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_INT, false))
            ->withDescription('The id.')
            ->withReadable(true)
            ->withWritable(false)
            ->withRequired(true);
        $propertyMetadataFactoryProphecy->create('Acme\CustomAttributeDummy', 'id')->willReturn($idPropertyMetadata)->shouldBeCalled();
        $namePropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_STRING, false))
            ->withDescription('The dummy name.')
            ->withReadable(true)
            ->withWritable(true)
            ->withRequired(true);
        $propertyMetadataFactoryProphecy->create('Acme\CustomAttributeDummy', 'name')->willReturn($namePropertyMetadata)->shouldBeCalled();

        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory);

        $actual = $apiPlatformParser->parse([
            'class' => sprintf('%s:%s:%s', ApiPlatformParser::OUT_PREFIX, 'Acme\CustomAttributeDummy', 'get'),
        ]);

        $this->assertEquals([
            'id' => [
                'dataType' => DataTypes::INTEGER,
                'required' => false,
                'description' => 'The id.',
                'readonly' => true,
            ],
            'name' => [
                'dataType' => DataTypes::STRING,
                'required' => true,
                'description' => 'The dummy name.',
                'readonly' => false,
            ],
        ], $actual);
    }

    public function testSupportsUnknownResource()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactoryProphecy->create(UnknownDummy::class)->willThrow(ResourceClassNotFoundException::class)->shouldBeCalled();
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory);

        $this->assertFalse($apiPlatformParser->supports([
            'class' => sprintf('%s:%s', ApiPlatformParser::OUT_PREFIX, UnknownDummy::class),
        ]));
    }

    public function testSupportsUnsupportedClassFormat()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactoryProphecy->create(Argument::any())->shouldNotBeCalled();
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory);

        $this->assertFalse($apiPlatformParser->supports([
            'class' => Dummy::class,
        ]));
    }

    public function testParse()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactoryProphecy->create(Dummy::class)->willReturn(new ResourceMetadata('dummy', 'dummy', null, [
            'get' => ['method' => 'GET', 'normalization_context' => ['groups' => ['custom_attr_dummy_get']]],
            'put' => ['method' => 'PUT', 'denormalization_context' => ['groups' => ['custom_attr_dummy_put']]],
            'gerard' => ['method' => 'get', 'path' => '/gerard', 'denormalization_context' => ['groups' => ['custom_attr_dummy_put']]],
            'delete' => ['method' => 'DELETE'],
        ], []))->shouldBeCalled();
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactoryProphecy->create(Dummy::class, Argument::cetera())->willReturn(new PropertyNameCollection([
            'id',
            'name',
            'dummyPrice',
        ]))->shouldBeCalled();
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $idPropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_INT, false))
            ->withDescription('The id.')
            ->withReadable(true)
            ->withWritable(false)
            ->withRequired(true);
        $propertyMetadataFactoryProphecy->create(Dummy::class, 'id')->willReturn($idPropertyMetadata)->shouldBeCalled();
        $namePropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_STRING, false))
            ->withDescription('The dummy name.')
            ->withReadable(true)
            ->withWritable(true)
            ->withRequired(true);
        $propertyMetadataFactoryProphecy->create(Dummy::class, 'name')->willReturn($namePropertyMetadata)->shouldBeCalled();
        $dummyPricePropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_FLOAT, true))
            ->withDescription('A dummy price.')
            ->withReadable(true)
            ->withWritable(true)
            ->withRequired(false);
        $propertyMetadataFactoryProphecy->create(Dummy::class, 'dummyPrice')->willReturn($dummyPricePropertyMetadata)->shouldBeCalled();
        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory);

        $actual = $apiPlatformParser->parse([
            'class' => sprintf('%s:%s:%s', ApiPlatformParser::OUT_PREFIX, Dummy::class, 'gerard'),
        ]);

        $this->assertEquals([
            'id' => [
                'dataType' => DataTypes::INTEGER,
                'required' => false,
                'description' => 'The id.',
                'readonly' => true,
            ],
            'name' => [
                'dataType' => DataTypes::STRING,
                'required' => true,
                'description' => 'The dummy name.',
                'readonly' => false,
            ],
            'dummyPrice' => [
                'dataType' => DataTypes::FLOAT,
                'required' => false,
                'description' => 'A dummy price.',
                'readonly' => false,
            ],
        ], $actual);
    }

    public function testParseDateTime()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactoryProphecy->create(Dummy::class)->willReturn(new ResourceMetadata('dummy', 'dummy', null, [], []))->shouldBeCalled();
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactoryProphecy->create(Dummy::class, Argument::cetera())->willReturn(new PropertyNameCollection([
            'dummyDate',
        ]))->shouldBeCalled();
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $dummyDatePropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_OBJECT, true, \DateTime::class))
            ->withDescription('A dummy date.')
            ->withReadable(true)
            ->withWritable(true)
            ->withRequired(false);
        $propertyMetadataFactoryProphecy->create(Dummy::class, 'dummyDate')->willReturn($dummyDatePropertyMetadata)->shouldBeCalled();
        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory);

        $actual = $apiPlatformParser->parse([
            'class' => sprintf('%s:%s:%s', ApiPlatformParser::OUT_PREFIX, Dummy::class, 'get'),
        ]);

        $this->assertEquals([
            'dummyDate' => [
                'dataType' => DataTypes::DATETIME,
                'required' => false,
                'description' => 'A dummy date.',
                'readonly' => false,
                'format' => sprintf('{DateTime %s}', \DateTime::RFC3339),
            ],
        ], $actual);
    }

    public function testParseRelation()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactoryProphecy->create(Dummy::class)->willReturn(new ResourceMetadata('dummy', 'dummy', null, [], []))->shouldBeCalled();
        $resourceMetadataFactoryProphecy->create(RelatedDummy::class)->willReturn(new ResourceMetadata())->shouldBeCalled();
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactoryProphecy->create(Dummy::class, Argument::cetera())->willReturn(new PropertyNameCollection([
            'relatedDummy',
            'relatedDummies',
        ]))->shouldBeCalled();
        $propertyNameCollectionFactoryProphecy->create(RelatedDummy::class, Argument::cetera())->willReturn(new PropertyNameCollection([
            'id',
            'name',
        ]))->shouldBeCalled();
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $relatedDummyPropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_OBJECT, true, RelatedDummy::class))
            ->withDescription('A related dummy.')
            ->withReadable(true)
            ->withWritable(true)
            ->withRequired(false);
        $propertyMetadataFactoryProphecy->create(Dummy::class, 'relatedDummy')->willReturn($relatedDummyPropertyMetadata)->shouldBeCalled();
        $relatedDummiesPropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_OBJECT, false, 'Doctrine\Common\Collections\Collection', true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, RelatedDummy::class)))
            ->withDescription('Several dummies.')
            ->withReadable(true)
            ->withWritable(true)
            ->withReadableLink(true)
            ->withRequired(false);
        $propertyMetadataFactoryProphecy->create(Dummy::class, 'relatedDummies')->willReturn($relatedDummiesPropertyMetadata)->shouldBeCalled();
        $idPropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_INT, false))
            ->withReadable(true)
            ->withWritable(false)
            ->withRequired(true);
        $propertyMetadataFactoryProphecy->create(RelatedDummy::class, 'id')->willReturn($idPropertyMetadata)->shouldBeCalled();
        $namePropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_STRING, false))
            ->withDescription('A name.')
            ->withReadable(true)
            ->withWritable(true)
            ->withRequired(false);
        $propertyMetadataFactoryProphecy->create(RelatedDummy::class, 'name')->willReturn($namePropertyMetadata)->shouldBeCalled();
        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory);

        $actual = $apiPlatformParser->parse([
            'class' => sprintf('%s:%s:%s', ApiPlatformParser::OUT_PREFIX, Dummy::class, 'get'),
        ]);

        $this->assertEquals([
            'relatedDummy' => [
                'dataType' => 'IRI',
                'required' => false,
                'description' => 'A related dummy.',
                'readonly' => false,
                'actualType' => DataTypes::STRING,
            ],
            'relatedDummies' => [
                'dataType' => null,
                'required' => false,
                'description' => 'Several dummies.',
                'readonly' => false,
                'actualType' => DataTypes::COLLECTION,
                'subType' => RelatedDummy::class,
                'children' => [
                    'id' => [
                        'dataType' => DataTypes::INTEGER,
                        'required' => false,
                        'description' => null,
                        'readonly' => true,
                    ],
                    'name' => [
                        'dataType' => DataTypes::STRING,
                        'required' => false,
                        'description' => 'A name.',
                        'readonly' => false,
                    ],
                ],
            ],
        ], $actual);
    }

    public function testParseWithNameConverter()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactoryProphecy->create(Dummy::class)->willReturn(new ResourceMetadata('dummy', 'dummy', null, [], []))->shouldBeCalled();
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactoryProphecy->create(Dummy::class, Argument::cetera())->willReturn(new PropertyNameCollection([
            'nameConverted',
        ]))->shouldBeCalled();
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $nameConvertedPropertyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_STRING, true))
            ->withDescription('A converted name')
            ->withReadable(true)
            ->withWritable(true)
            ->withRequired(false);
        $propertyMetadataFactoryProphecy->create(Dummy::class, 'nameConverted')->willReturn($nameConvertedPropertyMetadata)->shouldBeCalled();
        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $nameConverterProphecy = $this->prophesize(NameConverterInterface::class);
        $nameConverterProphecy->normalize('nameConverted')->willReturn('name_converted')->shouldBeCalled();
        $nameConverter = $nameConverterProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory, $nameConverter);

        $actual = $apiPlatformParser->parse([
            'class' => sprintf('%s:%s:%s', ApiPlatformParser::OUT_PREFIX, Dummy::class, 'get'),
        ]);

        $this->assertEquals([
            'name_converted' => [
                'dataType' => DataTypes::STRING,
                'required' => false,
                'description' => 'A converted name',
                'readonly' => false,
            ],
        ], $actual);
    }

    public function testParseRecursive()
    {
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $resourceMetadataFactoryProphecy->create(Dummy::class)->willReturn(new ResourceMetadata('dummy', 'dummy', null, [], []))->shouldBeCalled();
        $resourceMetadataFactoryProphecy->create(RelatedDummy::class)->willReturn(new ResourceMetadata())->shouldBeCalled();
        $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();

        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
        $propertyNameCollectionFactoryProphecy->create(Dummy::class, Argument::cetera())->willReturn(new PropertyNameCollection([
            'relatedDummy',
        ]))->shouldBeCalled();
        $propertyNameCollectionFactoryProphecy->create(RelatedDummy::class, Argument::cetera())->willReturn(new PropertyNameCollection([
            'dummy',
        ]))->shouldBeCalled();
        $propertyNameCollectionFactory = $propertyNameCollectionFactoryProphecy->reveal();

        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $relatedDummyMetadatata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_OBJECT, true, RelatedDummy::class))
            ->withDescription('A related Dummy.')
            ->withReadable(true)
            ->withReadableLink(true)
            ->withWritableLink(true)
            ->withWritable(true)
            ->withRequired(false);
        $propertyMetadataFactoryProphecy->create(Dummy::class, 'relatedDummy')->willReturn($relatedDummyMetadatata)->shouldBeCalled();
        $dummyMetadata = (new PropertyMetadata())
            ->withType(new Type(Type::BUILTIN_TYPE_OBJECT, true, Dummy::class))
            ->withDescription('A Dummy.')
            ->withReadable(true)
            ->withWritable(true)
            ->withReadableLink(true)
            ->withWritableLink(true)
            ->withRequired(false);
        $propertyMetadataFactoryProphecy->create(RelatedDummy::class, 'dummy')->willReturn($dummyMetadata)->shouldBeCalled();
        $propertyMetadataFactory = $propertyMetadataFactoryProphecy->reveal();

        $apiPlatformParser = new ApiPlatformParser($resourceMetadataFactory, $propertyNameCollectionFactory, $propertyMetadataFactory);

        $actual = $apiPlatformParser->parse([
            'class' => sprintf('%s:%s:%s', ApiPlatformParser::OUT_PREFIX, Dummy::class, 'get'),
        ]);

        $this->assertEquals([
            'relatedDummy' => [
                'dataType' => null,
                'required' => false,
                'description' => 'A related Dummy.',
                'readonly' => false,
                'actualType' => 'model',
                'subType' => RelatedDummy::class,
                'children' => [
                    'dummy' => [
                        'dataType' => null,
                        'required' => false,
                        'description' => 'A Dummy.',
                        'readonly' => false,
                        'actualType' => 'model',
                        'subType' => Dummy::class,
                        'children' => [],
                    ],
                ],
            ],
        ], $actual);
    }
}


text:
{% include header.html %}

{{ content }}

{% for js in site.js %}
<script type="text/javascript" src="{{ js }}"></script>
{% endfor %}

</body>
</html>


text:
<?php
include_once '../libs/DataControl/General.class.php';
include_once '../libs/DataControl/DataConnector.class.php';
include_once '../libs/DataControl/Admin.class.php';
include_once '../libs/sessions/LHCSession.class.php';
use DataControl\Admin\Admin;
session_start();
$superId = $_SESSION['adminId'];
$adminLevel = $_SESSION['adminLevel'];
$ESId = $_SESSION['ESId'];
if($adminLevel == 1){//判断是否是超管
	$admin = new Admin();
	if($_GET['act'] == 1){//修改超管密码
		$superPassword = md5($_POST['superPassword']);
		$res = $admin -> edtPassword($superId,$superPassword);
		echo $admin -> makeOutPut($res,'JSON');
	}elseif ($_GET['act'] == 2){//修改或添加,以是否存在adminAccessId为依据
		$adminId = $_POST['adminAccessId'];
		$adminCount = $_POST['adminCount'];
		$adminPassword = $_POST['adminPassword'];
		if($adminId){//修改普管权限及密码
			$res['success'] = $admin -> edtAdminAccess($adminId,$_POST['access'],$adminCount,$adminPassword);
			echo $admin -> makeOutPut($res,'JSON');
		}else{//添加普管
			$res = $admin -> addAdmin($ESId,$adminCount,$adminPassword,$_POST['access']);
			echo $admin -> makeOutPut($res,'JSON');
		}
	}elseif ($_GET['act'] == 3){//获取普管权限,在修改弹出层中显示
		$adminAccess = $admin -> adminAccess($_POST['adminId']);
		echo $admin -> makeOutPut($adminAccess,'JSON');
	}elseif($_GET['act'] == 4){//删除管理员
		$adminId = $_POST['adminId'];
		echo $admin -> delAdmin($adminId);
	}
}


text:
var testOptions = null;

if (Meteor.isClient) {
  // On the client, the "get" functions should not throw errors
  // due to not being logged in because we want to be able to
  // use the reactively and as template helpers.

  Tinytest.addAsync('AppPlans - User - Has Any Before Login', function (test, next) {

    var hasAny = AppPlans.hasAny();
    test.isFalse(hasAny);

    // Async
    AppPlans.hasAny(function (error, result) {
      test.isFalse(!!error);
      test.isFalse(result);
      next();
    });

  });

  Tinytest.addAsync('AppPlans - User - Get Before Login', function (test, next) {

    var plan = AppPlans.get();
    test.isUndefined(plan);

    // Async
    AppPlans.get(function (error, result) {
      test.isFalse(!!error);
      test.isUndefined(result);
      next();
    });

  });

  Tinytest.addAsync('AppPlans - User - List Before Login', function (test, next) {

    var plans = AppPlans.list();
    test.isUndefined(plans);

    // Async
    AppPlans.list(function (error, result) {
      test.isFalse(!!error);
      test.isUndefined(result);
      next();
    });

  });
}

Tinytest.addAsync('AppPlans - User - Create User and Log In', function (test, next) {
  if (Meteor.isClient) {
    Accounts.createUser({
      email: testEmail,
      password: 'password'
    }, function () {
      testUserId = Meteor.userId();
      test.isTrue(!!testUserId);

      if (Meteor.isServer) {
        testOptions = {userId: testUserId};
      }

      next();
    });
  } else {
    testUserId = Accounts.createUser({
      email: testEmail,
      password: 'password'
    });
    test.isTrue(!!testUserId);

    if (Meteor.isServer) {
      testOptions = {userId: testUserId};
    }

    next();
  }

});

Tinytest.addAsync('AppPlans - User - Verify Plans Were Copied', function (test, next) {

  // Sync
  if (Meteor.isServer) {
    test.isTrue(AppPlans.has(plan2, testOptions));
  }

  // Async
  function checkRemove(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    next();
  }

  function checkHasAccess(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    AppPlans.remove(plan2, testOptions, checkRemove);
  }

  function checkHas(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    AppPlans.hasAccess(includedPlan, testOptions, checkHasAccess);
  }

  AppPlans.has(plan2, testOptions, checkHas);
});

Tinytest.addAsync('AppPlans - User - Add', function (test, next) {

  // Sync
  if (Meteor.isServer) {
    var result = AppPlans.add(plan1, testOptions);
    test.isTrue(result);
    test.isTrue(AppPlans.has(plan1, testOptions));
    test.equal(AppPlans.get(testOptions), plan1);
    test.isFalse(AppPlans.hasAccess(includedPlan, testOptions));
  }

  // Async
  function checkHasAccess(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    next();
  }

  function checkHas(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    AppPlans.hasAccess(includedPlan, testOptions, checkHasAccess);
  }

  function checkAdd(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    AppPlans.has(plan2, testOptions, checkHas);
  }

  AppPlans.add(plan2, testOptions, checkAdd);
});

Tinytest.addAsync('AppPlans - User - Remove', function (test, next) {

  // Sync
  if (Meteor.isServer) {
    test.isTrue(AppPlans.has(plan1, testOptions));
    var result = AppPlans.remove(plan1, testOptions);
    test.isTrue(result);
    test.isFalse(AppPlans.has(plan1, testOptions));
  }

  // Async
  function checkHasAfter(error, result) {
    test.isFalse(!!error);
    test.isFalse(result);
    next();
  }

  function checkRemove(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    AppPlans.has(plan2, testOptions, checkHasAfter);
  }

  function checkHasBefore(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    AppPlans.remove(plan2, testOptions, checkRemove);
  }

  AppPlans.has(plan2, testOptions, checkHasBefore);
});

Tinytest.addAsync('AppPlans - User - Set - Setup', function (test, next) {
  AppPlans.add(plan1, testOptions, next);
});

// Sync
if (Meteor.isServer) {
  Tinytest.add('AppPlans - User - Set - Sync Test', function (test) {
    test.isTrue(AppPlans.has(plan1, testOptions));
    var result = AppPlans.set(plan2, testOptions);
    test.isTrue(result);
    test.isFalse(AppPlans.has(plan1, testOptions));
    test.isTrue(AppPlans.has(plan2, testOptions));

    // Set up next test
    AppPlans.set(plan1, testOptions);
  });
}

// Async
Tinytest.addAsync('AppPlans - User - Set - Async Test', function (test, next) {

  function checkHasPlan1After2(error, result) {
    test.isFalse(!!error);
    test.isFalse(result);
    next();
  }

  function checkHasPlan2After(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    AppPlans.has(plan1, testOptions, checkHasPlan1After2);
  }

  function checkSet(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    AppPlans.has(plan2, testOptions, checkHasPlan2After);
  }

  function checkHasBefore(error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    AppPlans.set(plan2, testOptions, checkSet);
  }

  AppPlans.has(plan1, testOptions, checkHasBefore);
});

Tinytest.addAsync('AppPlans - User - Has Any', function (test, next) {

  // Sync
  if (Meteor.isServer) {
    test.isTrue(AppPlans.hasAny(testOptions));
  }

  // Async
  AppPlans.hasAny(testOptions, function (error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    next();
  });
});

Tinytest.addAsync('AppPlans - User - Get', function (test, next) {

  // Sync
  if (Meteor.isServer) {
    test.equal(AppPlans.get(testOptions), plan2);
  }

  // Async
  AppPlans.get(testOptions, function (error, result) {
    test.isFalse(!!error);
    test.equal(result, plan2);
    next();
  });
});

if (Meteor.isClient) {
  Tinytest.addAsync('AppPlans - User - Synchronous and Reactive Get', function (test, next) {
    // Since `get` uses `list` internally, this also tests `list`
    var shouldBe = plan2;
    var timesCalled = 0;

    Tracker.autorun(function (c) {
      var plan = AppPlans.get();
      if (!plan) {
        // Can rerun empty in between
        return;
      }

      timesCalled++;
      test.equal(plan, shouldBe);

      switch (timesCalled) {
        case 1:
          AppPlans.set(plan1);
          shouldBe = plan1;
          break;
        case 2:
          AppPlans.set(plan2);
          shouldBe = plan2;
          break;
        case 3:
          c.stop();
          next();
          break;
      }
    });
  });
}

Tinytest.addAsync('AppPlans - User - List', function (test, next) {

  // Sync
  if (Meteor.isServer) {
    test.equal(AppPlans.list(testOptions), [plan2]);
  }

  // Async
  AppPlans.list(testOptions, function (error, result) {
    test.isFalse(!!error);
    test.equal(result, [plan2]);
    next();
  });
});

Tinytest.addAsync('AppPlans - User - Sync', function (test, next) {

  // Synchronizing won't do anything but should not error
  // and should return true

  // Sync
  if (Meteor.isServer) {
    test.isTrue(AppPlans.sync(testOptions));
  }

  // Async
  AppPlans.sync(testOptions, function (error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    next();
  });
});

Tinytest.addAsync('AppPlans - User - Sync One', function (test, next) {

  // Synchronizing won't do anything but should not error
  // and should return true

  // Sync
  if (Meteor.isServer) {
    test.isTrue(AppPlans.syncOne(plan2, testOptions));
  }

  // Async
  AppPlans.syncOne(plan2, testOptions, function (error, result) {
    test.isFalse(!!error);
    test.isTrue(result);
    next();
  });
});


text:
package com.microsoft.azure.management.cosmosdb.v2019_08_01;

import com.microsoft.azure.arm.model.HasInner;
import com.microsoft.azure.arm.resources.models.HasManager;
import com.microsoft.azure.management.cosmosdb.v2019_08_01.implementation.CosmosDBManager;
import com.microsoft.azure.management.cosmosdb.v2019_08_01.implementation.ThroughputSettingsGetResultsInner;
import java.util.Map;

/**
 * Type representing ThroughputSettingsGetResults.
 */
public interface ThroughputSettingsGetResults extends HasInner<ThroughputSettingsGetResultsInner>, HasManager<CosmosDBManager> {
    /**
     * @return the id value.
     */
    String id();

    /**
     * @return the location value.
     */
    String location();

    /**
     * @return the minimumThroughput value.
     */
    String minimumThroughput();

    /**
     * @return the name value.
     */
    String name();

    /**
     * @return the offerReplacePending value.
     */
    String offerReplacePending();

    /**
     * @return the tags value.
     */
    Map<String, String> tags();

    /**
     * @return the throughput value.
     */
    int throughput();

    /**
     * @return the type value.
     */
    String type();

}


text:
package com.holyshevskyi.littlepromise;

import org.junit.Test;

import java.util.List;
import java.util.concurrent.CountDownLatch;

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

/**
 * @author Bohdan Holyshevskyi
 */
public class AggregationPromiseTest {

    @Test
    public void anyFirstFulfilledWin() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final StringBuffer history = new StringBuffer();
        Promise<String> p1 = Util.createTestPromise("1", 100);
        Promise<String> p2 = Util.createTestPromise("2", 50);
        Promise<String> p3 = Util.createTestPromise("3", 100);
        Promises.any(p1, p2, p3).finishChain(new ChainCallback<String>() {
            @Override
            public void onSuccess(String result) {
                history.append(result);
                latch.countDown();
            }

            @Override
            public void onFail(Exception exception) {
                exception.printStackTrace();
                fail();
                latch.countDown();
            }
        });
        latch.await();
        assertEquals("2", history.toString());
    }

    @Test
    public void anyAllFailed() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        Promise<String> p1 = Promises.createFailed(new Exception());
        Promise<String> p2 = Promises.createFailed(new Exception());
        Promise<String> p3 = Promises.createFailed(new Exception());
        Promises.any(p1, p2, p3).finishChain(new ChainCallback<String>() {
            @Override
            public void onSuccess(String result) {
                fail();
                latch.countDown();
            }

            @Override
            public void onFail(Exception exception) {
                latch.countDown();
            }
        });
        latch.await();
    }

    @Test
    public void anyTypelessSuccess() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final StringBuffer history = new StringBuffer();
        Promise<String> p1 = Util.createTestPromise("1", 60);
        Promise<Integer> p2 = Util.createTestPromise(2, 30);
        Promise<String> p3 = Util.createTestPromise("3", 40);
        Promise<Integer> p4 = Util.createTestPromise(4, 50);
        Promises.anyTypeless(p1, p2, p3, p4).finishChain(new ChainCallback<Promises.IndexedValueHolder>() {
            @Override
            public void onSuccess(Promises.IndexedValueHolder result) {
                history.append(result.getIndex());
                history.append((int) result.getValue());
                latch.countDown();
            }

            @Override
            public void onFail(Exception exception) {
                exception.printStackTrace();
                fail();
                latch.countDown();
            }
        });
        latch.await();
        assertEquals("12", history.toString());
    }

    @Test
    public void allSuccess() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final StringBuffer history = new StringBuffer();
        Promise<String> p1 = Util.createTestPromise("1", 60);
        Promise<String> p2 = Util.createTestPromise("2", 50);
        Promise<String> p3 = Util.createTestPromise("3", 40);
        Promise<String> p4 = Util.createTestPromise("4", 30);
        Promises.all(p1, p2, p3, p4).finishChain(new ChainCallback<List<String>>() {
            @Override
            public void onSuccess(List<String> result) {
                for (String s : result) {
                    history.append(s);
                }
                latch.countDown();
            }

            @Override
            public void onFail(Exception exception) {
                exception.printStackTrace();
                fail();
                latch.countDown();
            }
        });
        latch.await();
        assertEquals("1234", history.toString());
    }

    @Test
    public void allFail() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final StringBuffer history = new StringBuffer();
        Promise<String> p1 = Util.createTestPromise("1", 60);
        Promise<String> p2 = Util.createTestPromise("2", 50);
        Promise<String> p3 = Promises.createFailed(new Exception("3"));
        Promise<String> p4 = Promises.createFailed(new Exception("3"));
        Promise<String> p5 = Util.createTestPromise("4", 30);
        Promises.all(p1, p2, p3, p4, p5).finishChain(new ChainCallback<List<String>>() {
            @Override
            public void onSuccess(List<String> result) {
                fail();
                latch.countDown();
            }

            @Override
            public void onFail(Exception exception) {
                history.append(exception.getCause().getMessage());
                latch.countDown();
            }
        });
        latch.await();
        assertEquals("3", history.toString());
    }

    @Test
    public void allTypelessSuccess() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final StringBuffer history = new StringBuffer();
        Promise<String> p1 = Util.createTestPromise("1", 60);
        Promise<Integer> p2 = Util.createTestPromise(2, 50);
        Promise<String> p3 = Util.createTestPromise("3", 40);
        Promise<Integer> p4 = Util.createTestPromise(4, 30);
        Promises.allTypeless(p1, p2, p3, p4).finishChain(new ChainCallback<List<Promises.ValueHolder>>() {
            @Override
            public void onSuccess(List<Promises.ValueHolder> result) {
                String res1 = result.get(0).getValue();
                int res2 = result.get(1).getValue();
                String res3 = result.get(2).getValue();
                int res4 = result.get(3).getValue();
                history.append(res1);
                history.append(res2);
                history.append(res3);
                history.append(res4);
                latch.countDown();
            }

            @Override
            public void onFail(Exception exception) {
                exception.printStackTrace();
                fail();
                latch.countDown();
            }
        });
        latch.await();
        assertEquals("1234", history.toString());
    }

}


text:
package com.davemorrissey.labs.subscaleview.sample.imagedisplay.decoders;

import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;

import com.davemorrissey.labs.subscaleview.decoder.ImageDecoder;

import rapid.decoder.BitmapDecoder;

/**
 * A very simple implementation of {@link com.davemorrissey.labs.subscaleview.decoder.ImageRegionDecoder}
 * using the RapidDecoder library (https://github.com/suckgamony/RapidDecoder). For PNGs, this can
 * give more reliable decoding and better performance. For JPGs, it is slower and can run out of
 * memory with large images, but has better support for grayscale and CMYK images.
 *
 * This is an incomplete and untested implementation provided as an example only.
 */
public class RapidImageDecoder implements ImageDecoder {

    @Override
    public Bitmap decode(Context context, Uri uri) throws Exception {
        return BitmapDecoder.from(context, uri).useBuiltInDecoder(true).config(Bitmap.Config.RGB_565).decode();
    }

}


text:
from __future__ import absolute_import
from apptools.permissions.adapters.wx_window import *


text:
layout: category
category: 生活
tag: 手工
permalink: /blog/tag/手工/
group: horizontal
---


text:
package gudusoft.gsqlparser.sql2xml.model;

import org.simpleframework.xml.Element;

public class regex_occurrence
{

	@Element
	numeric_value_expression numeric_value_expression = new numeric_value_expression( );

	public numeric_value_expression getNumeric_value_expression( )
	{
		return numeric_value_expression;
	}

}


text:
package tol.j2cl.elem.dom;

import jsinterop.annotations.JsFunction;

/**
 * The {@link EventListener} interface is the primary method for handling events. Users implement
 * the {@link EventListener} interface and register their listener on an EventTarget using the
 * AddEventListener method. The users should also remove their {@link EventListener} from its
 * {@link EventTarget} after they have completed using the listener.
 *
 * @see Mozilla
 */
@JsFunction
public interface EventListener {

  /**
   * This method is called whenever an event occurs of the type for which the EventListener
   * interface was registered.
   *
   * @param event - The DOM Event which was triggered.
   *
   * @see Mozilla
   */
  public void handleEvent(Event event);

}


text:
package org.openengsb.connector.git.internal;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;

import junit.framework.Assert;

import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.TagCommand;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevTag;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.junit.Test;
import org.openengsb.connector.git.domain.GitCommitRef;
import org.openengsb.connector.git.domain.GitTagRef;
import org.openengsb.domain.scm.CommitRef;
import org.openengsb.domain.scm.ScmException;
import org.openengsb.domain.scm.TagRef;

public class GitServiceImplTest extends AbstractGitServiceImpl {

    @Test
    public void updateWithEmptyWorkspace_shouldCloneRemoteRepository() throws Exception {
        List<CommitRef> commits = service.update();
        assertThat(commits.size(), is(1));
        ObjectId remote = service.getRepository().resolve("refs/remotes/origin/master");
        assertThat(remote, notNullValue());
        assertThat(remote, is(remoteRepository.resolve("refs/heads/master")));
        assertThat(commits.get(0).getStringRepresentation(), is(service.getRepository().resolve(Constants.HEAD).name()));
    }

    @Test
    public void updateAgainFromSameRepoState_shouldReturnFalseFromPoll() {
        List<CommitRef> updateOne = service.update();
        assertThat(updateOne.size(), is(1));
        List<CommitRef> updateTwo = service.update();
        assertThat(updateTwo.size(), is(0));
    }

    @Test
    public void update_shouldPullChangesIntoLocalBranch() throws Exception {
        List<CommitRef> updateOne = service.update();
        assertThat(updateOne.size(), is(1));
        File f = service.export().getFile();
        assertThat(new File(f, "testfile").isFile(), is(true));
        FileUtils.deleteDirectory(f);
    }

    @Test
    public void updateFromUpdatedRemote_shouldUpdateLocal() throws Exception {
        List<CommitRef> updateOne = service.update();
        assertThat(updateOne.size(), is(1));
        Git git = new Git(remoteRepository);
        RepositoryFixture.addFile(git, "second");
        RepositoryFixture.commit(git, "second commit");

        File f = service.export().getFile();
        assertThat(new File(f, "second").isFile(), is(false));
        List<CommitRef> updateTwo = service.update();
        assertThat(updateTwo.size(), is(1));
        f = service.export().getFile();
        assertThat(new File(f, "second").isFile(), is(true));
        List<CommitRef> updateThree = service.update();
        assertThat(updateThree.size(), is(0));
    }

    @Test
    public void updateWithNoExistingWatchBranch_shouldReturnFalse() {
        service.setWatchBranch("unknown");
        List<CommitRef> updateOne = service.update();
        assertThat(updateOne, nullValue());
    }

    @Test
    public void exportRepository_shouldReturnFileModelWithRepoEntries() throws Exception {
        String dir = "testDirectory";
        String file = "myTestFile";
        File parent = new File(remoteDirectory, dir);
        parent.mkdirs();
        File child = new File(parent, file);
        FileWriter fw = new FileWriter(child);
        fw.write(file + "\n");
        fw.close();

        String pattern = dir + "/" + file;
        Git git = new Git(remoteRepository);
        git.add().addFilepattern(pattern).call();
        git.commit().setMessage("My msg").call();

        service.update();

        File f = service.export().getFile();
        assertThat(new File(f, "testfile").isFile(), is(true));
        assertThat(new File(f, dir + "/").isDirectory(), is(true));
        assertThat(new File(f, dir + File.separator + file).isFile(), is(true));
    }

    public void exportRepositoryByRef_shouldReturnFileModelWithRepoEntries() throws Exception {
        String dir = "testDirectory";
        String file = "myTestFile";
        File parent = new File(remoteDirectory, dir);
        parent.mkdirs();
        File child = new File(parent, file);
        FileWriter fw = new FileWriter(child);
        fw.write(file + "\n");
        fw.close();

        String pattern = dir + "/" + file;
        Git git = new Git(remoteRepository);
        git.add().addFilepattern(pattern).call();
        git.commit().setMessage("My msg").call();

        AnyObjectId headId = remoteRepository.resolve(Constants.HEAD);
        RevWalk rw = new RevWalk(remoteRepository);
        RevCommit head = rw.parseCommit(headId);
        rw.release();

        service.update();

        File f = service.export(new GitCommitRef(head)).getFile();
        assertThat(new File(f, "testfile").isFile(), is(true));
        assertThat(new File(f, dir + "/").isDirectory(), is(true));
        assertThat(new File(f, dir + File.separator + file).isFile(), is(true));
    }

    @Test
    public void getFileFromHeadCommit_shouldReturnFileWithCorrectContent() throws Exception {
        String fileName = "myFile";
        Git git = new Git(remoteRepository);
        RepositoryFixture.addFile(git, fileName);
        RepositoryFixture.commit(git, "Commited my file");

        service.update();

        File file = service.get(fileName).getFile();
        String content = new BufferedReader(new FileReader(file)).readLine();
        assertThat(content, is(fileName));
    }

    @Test
    public void getFileFromCommitByRef_shouldReturnFileWithCorrectContent() throws Exception {
        String fileName = "myFile";

        AnyObjectId head = remoteRepository.resolve(Constants.HEAD);
        RevWalk rw = new RevWalk(remoteRepository);
        RevCommit headCommit = rw.parseCommit(head);
        rw.release();
        Git git = new Git(remoteRepository);
        RepositoryFixture.addFile(git, fileName);
        RepositoryFixture.commit(git, "Commited my file");

        service.update();

        File file = service.get("testfile", new GitCommitRef(headCommit)).getFile();
        String content = new BufferedReader(new FileReader(file)).readLine();
        assertThat(content, is("testfile"));
    }

    @Test(expected = ScmException.class)
    public void getFileFromCommitByNonExistingRef_shouldThrowSCMException() throws Exception {
        File file = service.get("testfile_does_not_exist", new GitCommitRef(null)).getFile();
        String content = new BufferedReader(new FileReader(file)).readLine();
        assertThat(content, is("testfile_does_not_exist"));
    }

    @Test
    public void addFile_shouldReturnHeadReference() throws IOException {
        File toCommit = new File(localDirectory, "testfile");
        toCommit.createNewFile();
        CommitRef commitRef = service.add("testcomment", toCommit);
        assertThat(commitRef, notNullValue());
        localRepository = service.getRepository();
        assertThat(commitRef.getStringRepresentation(), is(localRepository.resolve(Constants.HEAD).name()));
    }

    @Test
    public void addNonExistingFile_shouldRaiseException() throws IOException {
        File toCommit = new File(localDirectory, "testfile");
        try {
            service.add("testcomment", toCommit);
            Assert.fail("Should have thrown an exception");
        } catch (Exception e) {
        }
    }

    @Test
    public void addFileNotInWorkingfolder_shouldRaiseException() throws IOException {
        File toCommit = tempFolder.newFile("testfile");
        toCommit.createNewFile();
        try {
            service.add("testcomment", toCommit);
            Assert.fail("Should have thrown an exception");
        } catch (Exception e) {
        }
    }

    @Test
    public void removeFileFromRepository_shouldReturnNewCommitRefAndDeleteFile() throws Exception {
        localRepository = RepositoryFixture.createRepository(localDirectory);
        AnyObjectId headId = localRepository.resolve(Constants.HEAD);
        RevWalk rw = new RevWalk(localRepository);
        RevCommit head = rw.parseCommit(headId);
        rw.release();

        CommitRef ref = service.remove("remove", new File(localDirectory, "testfile"));
        assertThat(head.name(), not(ref.getStringRepresentation()));

        File removed = new File(localDirectory, "testfile");
        assertThat(removed.exists(), is(false));
    }

    @Test
    public void removeDirectoryFromRepository_shouldReturnNewCommitRefAndDeleteFiles() throws Exception {
        localRepository = RepositoryFixture.createRepository(localDirectory);

        String dir = "testDirectory";
        String file = "testFile";
        File parent = new File(localDirectory, dir);
        parent.mkdirs();
        File child = new File(parent, file);
        FileWriter fw = new FileWriter(child);
        fw.write(file + "\n");
        fw.close();
        assertThat(child.exists(), is(true));

        Git git = new Git(localRepository);
        git.add().addFilepattern(dir + "/" + file).call();
        git.commit().setMessage("comment").call();

        AnyObjectId headId = localRepository.resolve(Constants.HEAD);
        RevWalk rw = new RevWalk(localRepository);
        RevCommit head = rw.parseCommit(headId);
        rw.release();

        CommitRef ref = service.remove("remove", new File(localDirectory, dir));
        assertThat(head.name(), not(ref.getStringRepresentation()));

        File removed = new File(localDirectory, dir + "/" + file);
        assertThat(removed.exists(), is(false));
    }

    @Test
    public void existsFilenameInHeadCommit_shouldReturnTrue() throws IOException {
        File commitOne = new File(localDirectory, "commitOne");
        File commitTwo = new File(localDirectory, "commitTwo");
        commitOne.createNewFile();
        commitTwo.createNewFile();
        service.add("testcomment", commitOne);
        service.add("testcomment", commitTwo);
        assertThat(service.exists("commitOne"), is(true));
    }

    @Test
    public void existsFilenameInReferencedCommit_shouldReturnTrue() throws IOException {
        File commitOne = new File(localDirectory, "commitOne");
        File commitTwo = new File(localDirectory, "commitTwo");
        commitOne.createNewFile();
        commitTwo.createNewFile();
        CommitRef commitRefOne = service.add("testcomment", commitOne);
        service.add("testcomment", commitTwo);
        assertThat(service.exists("commitOne", commitRefOne), is(true));
    }

    @Test
    public void existsFilenameOfNotExistingFile_shouldReturnFalse() throws IOException {
        File commitOne = new File(localDirectory, "commitOne");
        File commitTwo = new File(localDirectory, "commitTwo");
        commitOne.createNewFile();
        commitTwo.createNewFile();
        service.add("testcomment", commitOne);
        service.add("testcomment", commitTwo);
        assertThat(service.exists("commitThree"), is(false));
    }

    @Test
    public void existsFilenameInPriorCommitToFilecommit_shouldReturnFalse() throws IOException {
        File commitOne = new File(localDirectory, "commitOne");
        File commitTwo = new File(localDirectory, "commitTwo");
        commitOne.createNewFile();
        commitTwo.createNewFile();
        CommitRef commitRefOne = service.add("testcomment", commitOne);
        service.add("testcomment", commitTwo);
        assertThat(service.exists("commitTwo", commitRefOne), is(false));
    }

    @Test
    public void tagHeadWithName_shouldReturnTagRefWithName() throws Exception {
        service.update();
        FileRepository localRepository = service.getRepository();
        String tagName = "newTag";
        TagRef tag = service.tagRepo(tagName);
        assertThat(tag, notNullValue());
        assertThat(tagName, is(tag.getTagName()));
        AnyObjectId tagId = localRepository.resolve(tagName);
        assertThat(tagId.name(), is(tag.getStringRepresentation()));
        RevTag revTag = new RevWalk(localRepository).parseTag(tagId);
        AnyObjectId head = localRepository.resolve(Constants.HEAD);
        assertThat(revTag.getObject().name(), is(head.name()));
    }

    @Test(expected = ScmException.class)
    public void tagHeadAgainWithSameName_shouldThrowSCMException() throws Exception {
        String tagName = "newTag";
        TagRef tag = service.tagRepo(tagName);
        assertThat(tag, notNullValue());
        assertThat(tagName, is(tag.getTagName()));
        service.tagRepo(tagName);
    }

    @Test(expected = ScmException.class)
    public void tagEmptyRepoWithName_shouldThrowSCMException() throws Exception {
        FileRepositoryBuilder builder = new FileRepositoryBuilder();
        localRepository = builder.setWorkTree(localDirectory).build();
        localRepository.create();
        service.tagRepo("newTag");
    }

    @Test
    public void tagCommitRefWithName_shouldReturnTagRefWithName() throws Exception {
        service.update();
        FileRepository localRepository = service.getRepository();
        RevWalk walk = new RevWalk(localRepository);
        RevCommit head = walk.lookupCommit(localRepository.resolve(Constants.HEAD));
        CommitRef ref = new GitCommitRef(head);
        String tagName = "newTag";
        TagRef tag = service.tagRepo(tagName, ref);
        assertThat(tag, notNullValue());
        assertThat(tagName, is(tag.getTagName()));
        AnyObjectId tagId = localRepository.resolve(tagName);
        assertThat(tagId.name(), is(tag.getStringRepresentation()));
        RevTag revTag = new RevWalk(localRepository).parseTag(tagId);
        assertThat(revTag.getObject().name(), is(head.name()));
    }

    @Test
    public void getCommitRefForTagRef_shouldReturnTaggedCommitRef() throws Exception {
        service.update();
        FileRepository localRepository = service.getRepository();
        RevWalk walk = new RevWalk(localRepository);
        RevCommit head = walk.lookupCommit(localRepository.resolve(Constants.HEAD));
        String tagName = "newTag";
        TagCommand tagCommand = new Git(localRepository).tag();
        TagRef tag = new GitTagRef(tagCommand.setName(tagName).call());
        assertThat(tag, notNullValue());
        assertThat(tagName, is(tag.getTagName()));
        CommitRef commitRef = service.getCommitRefForTag(tag);
        assertThat(head.name(), is(commitRef.getStringRepresentation()));
    }

    @Test
    public void changeRemoteLocation_ShouldReadFromNewRemote() throws Exception {
        service.update();

        /* Create a second remote that is based on the old remote, add an extra commit
         * there and change the remote. Calling update() after the remote change should
         * report this commit.
         */
        File remoteDirectory2 = tempFolder.newFolder("remote2");
        FileUtils.copyDirectory(remoteDirectory, remoteDirectory2);
        FileRepositoryBuilder builder = new FileRepositoryBuilder();

        File gitdir = new File(remoteDirectory2 + File.separator + ".git");
        FileRepository remoteRepository2 = builder.setGitDir(gitdir)
            .readEnvironment().findGitDir().build();
        Git git = new Git(remoteRepository2);
        RepositoryFixture.addFile(git, "second");
        RepositoryFixture.commit(git, "second commit");

        service.setRemoteLocation(remoteDirectory2.toURI().toURL().toExternalForm().replace("%20", " "));
        List<CommitRef> commits = service.update();
        File f = service.export().getFile();
        assertThat(new File(f, "second").isFile(), is(true));
        assertThat(commits.size(), is(1));
    }

    @Test
    public void relativeLocalPath_shouldUseSystemPropertyForLocation() throws Exception {
        System.setProperty("karaf.data", tempFolder.getRoot().getAbsolutePath());
        service.setLocalWorkspace("test");
        assertThat(service.getRepository().getWorkTree().getAbsolutePath(),
                is(new File(tempFolder.getRoot(), "test").getAbsolutePath()));
    }
}


text:
/* eslint key-spacing:0 */
import webpack from 'webpack'
import config from 'app-config-chain'

export default (webpackConfig) => {
  webpackConfig.devServer = {
    publicPath: config.paths.public,
    contentBase: config.paths.client,
    noInfo: true,
    stats: 'errors-only',
    hot: true,
    lazy: false
  }

  webpackConfig.devtool = 'source-map'

  webpackConfig.entry.app.push(
    'webpack-hot-middleware/client?path=/__webpack_hmr'
  )

  webpackConfig.plugins.push(
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
  )

  webpackConfig.eslint.emitWarning = true

  webpackConfig.module.loaders = webpackConfig.module.loaders.map(loader => {
    if (!/babel/.test(loader.loader)) return loader

    if (loader.query.env.development.plugins[0][0] !== 'react-transform') {
      console.error('ERROR: react-transform must be the first plugin')
      return loader
    }

    const reactTransformHmr = {
      transform: 'react-transform-hmr',
      imports: [ 'react' ],
      locals: [ 'module' ]
    }
    loader.query.env.development.plugins[0][1].transforms
      .push(reactTransformHmr)
    return loader
  })

  return webpackConfig
}


text:
require 'sidekiq'
require 'sinatra'
require 'json'
require './github_client'
require_relative 'lib/build_worker'

batch_file_types = %w(svg)
build_context = "latex-ci-build"

Sidekiq.configure_client do |config|
  config.redis = { url: "redis://#{ENV['REDIS_HOST']}:#{ENV['REDIS_PORT']}" }
end

before do
  @gh_client ||= GithubClient.client
end

get '/' do
  'Latex-CI'
end

post '/build' do
  payload = JSON.parse params[:payload]

  data = {
    id: payload['head_commit']['id'],
    repo: payload['repository'],
    event_type: request.env['HTTP_X_GITHUB_EVENT'],
    build_context: build_context
  }

  BuildWorker.perform_async(data)

  return
end

get '/:owner/:repo.:file_type' do
  @file_type = params[:file_type]
  owner = params[:owner]
  repo = params[:repo]
  branch = params[:branch]

  content_type @file_type
  not_found unless batch_file_types.include? @file_type

  statuses = @gh_client.combined_status("#{owner}/#{repo}", branch).where(context: build_context)

  state = statuses.last[:state] if statuses.respond_to?(:last)
  state = :success if state.nil?

  @build_status = case state
    when :failure then :failing
    when :error then :failing
    when :success then :passing
  end

  render_view :batch
end

def render_view(view)
  erb "#{view}.#{@file_type}".to_sym
end

not_found do
  status 404
end


text:
package net.rithms.riot.api.endpoints.spectator.dto;

import java.io.Serializable;
import java.util.List;

import net.rithms.riot.api.Dto;

public class Perks extends Dto implements Serializable {

	private static final long serialVersionUID = -2532080002995742708L;

	private long perkStyle;
	private List<Long> perkIds;
	private long perkSubStyle;

	public long getPerkStyle() {
		return perkStyle;
	}

	public List<Long> getPerkIds() {
		return perkIds;
	}

	public long getPerkSubStyle() {
		return perkSubStyle;
	}
}


text:
package org.wso2.andes.server.protocol;

import org.wso2.andes.protocol.ProtocolEngine;
import org.wso2.andes.transport.network.InputHandler;
import org.wso2.andes.transport.network.Assembler;
import org.wso2.andes.transport.network.Disassembler;
import org.wso2.andes.transport.network.NetworkConnection;
import org.wso2.andes.server.configuration.*;
import org.wso2.andes.server.transport.ServerConnection;
import org.wso2.andes.server.logging.messages.ConnectionMessages;
import org.wso2.andes.server.registry.IApplicationRegistry;

import java.net.SocketAddress;
import java.util.UUID;

public class ProtocolEngine_0_10  extends InputHandler implements ProtocolEngine, ConnectionConfig
{
    public static final int MAX_FRAME_SIZE = 64 * 1024 - 1;

    private NetworkConnection _network;
    private long _readBytes;
    private long _writtenBytes;
    private ServerConnection _connection;
    private final UUID _id;
    private final IApplicationRegistry _appRegistry;
    private long _createTime = System.currentTimeMillis();

    public ProtocolEngine_0_10(ServerConnection conn,
                               NetworkConnection network,
                               final IApplicationRegistry appRegistry)
    {
        super(new Assembler(conn));
        _connection = conn;
        _connection.setConnectionConfig(this);
        _network = network;
        _id = appRegistry.getConfigStore().createId();
        _appRegistry = appRegistry;

        _connection.setSender(new Disassembler(_network.getSender(), MAX_FRAME_SIZE));
        _connection.onOpen(new Runnable()
        {
            public void run()
            {
                getConfigStore().addConfiguredObject(ProtocolEngine_0_10.this);
            }
        });

        // FIXME Two log messages to maintain compatibility with earlier protocol versions
        _connection.getLogActor().message(ConnectionMessages.OPEN(null, null, false, false));
        _connection.getLogActor().message(ConnectionMessages.OPEN(null, "0-10", false, true));
    }

    public SocketAddress getRemoteAddress()
    {
        return _network.getRemoteAddress();
    }

    public SocketAddress getLocalAddress()
    {
        return _network.getLocalAddress();
    }

    public long getReadBytes()
    {
        return _readBytes;
    }

    public long getWrittenBytes()
    {
        return _writtenBytes;
    }

    public void writerIdle()
    {
        //Todo
    }

    public void readerIdle()
    {
        //Todo
    }

    public VirtualHostConfig getVirtualHost()
    {
        return _connection.getVirtualHost();
    }

    public String getAddress()
    {
        return getRemoteAddress().toString();
    }

    public Boolean isIncoming()
    {
        return true;
    }

    public Boolean isSystemConnection()
    {
        return false;
    }

    public Boolean isFederationLink()
    {
        return false;
    }

    public String getAuthId()
    {
        return _connection.getAuthorizedPrincipal() == null ? null : _connection.getAuthorizedPrincipal().getName();
    }

    public String getRemoteProcessName()
    {
        return null;
    }

    public Integer getRemotePID()
    {
        return null;
    }

    public Integer getRemoteParentPID()
    {
        return null;
    }

    public ConfigStore getConfigStore()
    {
        return _appRegistry.getConfigStore();
    }

    public UUID getId()
    {
        return _id;
    }

    public ConnectionConfigType getConfigType()
    {
        return ConnectionConfigType.getInstance();
    }

    public ConfiguredObject getParent()
    {
        return getVirtualHost();
    }

    public boolean isDurable()
    {
        return false;
    }

    @Override
    public void closed()
    {
        super.closed();
        getConfigStore().removeConfiguredObject(this);
    }

    public long getCreateTime()
    {
        return _createTime;
    }

    public Boolean isShadow()
    {
        return false;
    }

    public void mgmtClose()
    {
        _connection.mgmtClose();
    }
}


text:
<?php

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

class CreateUserTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('User', function(Blueprint $table)
		{
			$table->increments('UserID');

			$table->string('Name', 32);
			$table->string('Username', 32);
			$table->string('Email', 320);
			$table->string('Password', 64);

                        // required for Laravel 4.1.26
                        $table->string('remember_token', 100)->nullable();
			$table->timestamps();
		});
	}

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

}