text:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="Representante" table="representante">
    <indexes>
      <index name="idx_de2d5957310dad4" columns="paciente_id"/>
    </indexes>
    <id name="id" type="bigint" column="id">
      <generator strategy="SEQUENCE"/>
      <sequence-generator sequence-name="representante_id_seq" allocation-size="1" initial-value="1"/>
    </id>
    <field name="nacionalidad" type="string" column="nacionalidad" length="1" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="cedula" type="string" column="cedula" length="255" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="nombreApellido" type="string" column="nombre_apellido" length="255" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="parentesco" type="string" column="parentesco" length="255" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="telefono" type="string" column="telefono" length="255" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <many-to-one field="paciente" target-entity="Paciente" fetch="LAZY">
      <join-columns>
        <join-column name="paciente_id" referenced-column-name="id"/>
      </join-columns>
    </many-to-one>
  </entity>
</doctrine-mapping>


text:
H5.installWebAudioSprite = (function (Event) {
    'use strict';

    function installHtmlAudioSprite(events, audioSprite) {
        events.subscribe(Event.PAGE_VISIBILITY, function (hidden) {
            if (hidden) {
                audioSprite.pauseAll();
            } else {
                audioSprite.resumeAll();
            }
        });
    }

    return installHtmlAudioSprite;
})(H5.Event);

redpajama_set_name: RedPajamaGithub


text:
module ApplicationHelper
  FLASH_CLASSES = {
    notice: 'info',
    error: 'danger',
    alert: 'warning'
  }

  def flash_class(level)
    FLASH_CLASSES[level]
  end
end


text:
require 'spec_helper'
require 'cucumber/formatter/interceptor'

module Cucumber::Formatter
  describe Interceptor::Pipe do
    let(:pipe) { instance_spy(IO) }

    describe '#wrap!' do
      it 'raises an ArgumentError if its not passed :stderr/:stdout' do
        expect { Interceptor::Pipe.wrap(:nonsense) }.to raise_error(ArgumentError)
      end

      context 'when passed :stderr' do
        before :each do
          @stderr = $stderr
        end

        it 'wraps $stderr' do
          wrapped = Interceptor::Pipe.wrap(:stderr)

          expect($stderr).to be_instance_of Interceptor::Pipe
          expect($stderr).to be wrapped
        end

        after :each do
          $stderr = @stderr
        end
      end

      context 'when passed :stdout' do
        before :each do
          @stdout = $stdout
        end

        it 'wraps $stdout' do
          wrapped = Interceptor::Pipe.wrap(:stdout)

          expect($stdout).to be_instance_of Interceptor::Pipe
          expect($stdout).to be wrapped
        end

        after :each do
          $stdout = @stdout
        end
      end
    end

    describe '#unwrap!' do
      before :each do
        @stdout = $stdout
        $stdout = pipe
        @wrapped = Interceptor::Pipe.wrap(:stdout)
      end

      it 'raises an ArgumentError if it wasn\'t passed :stderr/:stdout' do
        expect { Interceptor::Pipe.unwrap!(:nonsense) }.to raise_error(ArgumentError)
      end

      it 'resets $stdout when #unwrap! is called' do
        interceptor = Interceptor::Pipe.unwrap! :stdout

        expect(interceptor).to be_instance_of Interceptor::Pipe
        expect($stdout).not_to be interceptor
      end

      it 'noops if $stdout or $stderr has been overwritten' do
        $stdout = StringIO.new
        pipe = Interceptor::Pipe.unwrap! :stdout
        expect(pipe).to eq $stdout

        $stderr = StringIO.new
        pipe = Interceptor::Pipe.unwrap! :stderr
        expect(pipe).to eq $stderr
      end

      it 'disables the pipe bypass' do
        buffer = '(::)'
        Interceptor::Pipe.unwrap! :stdout

        @wrapped.write(buffer)

        expect(@wrapped.buffer_string).not_to end_with(buffer)
      end

      after :each do
        $stdout = @stdout
      end
    end

    describe '#write' do
      let(:buffer) { 'Some stupid buffer' }
      let(:pi) { Interceptor::Pipe.new(pipe) }

      it 'writes arguments to the original pipe' do
        expect(pipe).to receive(:write).with(buffer) { buffer.size }
        expect(pi.write(buffer)).to eq buffer.size
      end

      it 'adds the buffer to its stored output' do
        expect(pipe).to receive(:write).with(buffer)

        pi.write(buffer)

        expect(pi.buffer_string).not_to be_empty
        expect(pi.buffer_string).to eq buffer
      end
    end

    describe '#method_missing' do
      let(:pi) { Interceptor::Pipe.new(pipe) }

      it 'passes #tty? to the original pipe' do
        expect(pipe).to receive(:tty?) { true }
        expect(pi.tty?).to be true
      end
    end

    describe '#respond_to' do
      let(:pi) { Interceptor::Pipe.wrap(:stderr) }

      it 'responds to all methods $stderr has' do
        $stderr.methods.each { |m| expect(pi.respond_to?(m)).to be true }
      end
    end

    describe 'when calling `methods` on the stream' do
      it 'does not raise errors' do
        allow($stderr).to receive(:puts)

        Interceptor::Pipe.wrap(:stderr)
        expect { $stderr.puts('Oh, hi here !') }.not_to raise_exception(NoMethodError)
      end

      it 'does not shadow errors when method do not exist on the stream' do
        Interceptor::Pipe.wrap(:stderr)
        expect { $stderr.not_really_puts('Oh, hi here !') }.to raise_exception(NoMethodError)
      end
    end
  end
end


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace IntegratedAuthoringToolWF.IEP
{
    public partial class QuickAddWizard : Form
    {
        ConnectToServerForm _server;
        OutputManager _manager;
        string result;

        public QuickAddWizard(ConnectToServerForm server, OutputManager manager)
        {
            InitializeComponent();
            _server = server;
            _manager = manager;
            processInput.Enabled = false;
            processInput.Text = "  Process Input";
            if (!_server.connected)
            {
                MessageBox.Show("Please connect to the Wizard Server");
              //  _server.currentForm = this;
                _server.ShowDialog(this);
            }

            if (_server.connected)
            {
                processInput.Enabled = true;
               // if(this.Control;
            }

        }

        private void processInput_Click(object sender, EventArgs e)
        {
            processInput.Text = "Computing...";
           _server.ProcessDescription(this.descriptionText.Text, ReceivedInput);

        }

        public void ReceivedInput()
        {

            result = _server.descriptionResult;

           _manager.ComputeStory(result);

            _manager.AcceptOutput();
            processInput.Text = "Completed...";
            Close();
        }

        private void QuickAddBeliefs_Load(object sender, EventArgs e)
        {
            if (_server.connected)
            {
                processInput.Enabled = true;
            }
        }
    }
}


text:
<!doctype html>

    <title>Space Design</title>
    <meta charset="UTF-8" />
    <link rel="stylesheet" type="text/css"href="whitespace-reset.css">
    <link rel="stylesheet" type="text/css" href="company_splash_page.css">

        SpaceDesign

            Home

            Projects

            Team

 Projects

Project Name

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Project Name

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Project Name

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

        "Lorem ipsum dolor sit amet, consectetu"

        "Incididunt" ut laboe et dolore magna aliqua. Ut enim ad


text:
#ifndef _USART_Configuration_H
#define _USART_Configuration_H

extern const u32 baudrate_table[8];

void USART1_Configuration(void);
void USART1_SendData(uint16_t Data);
U8 UART1_CAL(void);
U8 InU1FrameBuf(void);
U8 OutU1FrameBuf(void);
U8 InU1SendBuf(void);
void U1Printf(void);

void inBaseBuf( U8 byte );
U8 outBaseBuf( U8* byte );
void calBaseBuf(void);
void SendEncoders( U16 left, U16 right);
void SendEncodersAndGyro( U16 left, U16 right, S16 gyro );
void SendBatteryState( U16 voltage_adc );
void SendBreakerStatus( U8 b0, U8 b1);
void SendParam( float value );
void ReceiveBaseCommand( U8 byte );
U8 calBaseCmd(void);
void simulateEncoder( U16* left, U16 * right );

void USART2_Configuration(void);
void USART2_SendData(uint16_t Data);
U8 UART2_CAL(void);
U8 InU2FrameBuf(void);
U8 OutU2FrameBuf(void);
U8 InU2SendBuf(void);
void U2Printf(void);
void U2PrintfDMA(void);

void USART3_Configuration(void);
void USART3_SendData(uint16_t Data);
U8 UART3_CAL(void);

#endif /* __USART_Configuration_H */


text:
// Copyright 2007-2008 The Apache Software Foundation.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.SystemView
{
	using System;
	using System.Windows.Forms;

	internal static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		private static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			Application.Run(new MainForm());
		}
	}
}


text:
from dnsagent.resolver.base import *
from dnsagent.resolver.cache import *
from dnsagent.resolver.chain import *
from dnsagent.resolver.cn import *
from dnsagent.resolver.dual import *
from dnsagent.resolver.extended import *
from dnsagent.resolver.hosts import *
from dnsagent.resolver.https import *
from dnsagent.resolver.parallel import *


text:
package org.apereo.cas.oidc.dynareg;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.extern.slf4j.Slf4j;
import org.apereo.cas.util.CollectionUtils;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import lombok.ToString;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * This is {@link OidcClientRegistrationRequest}.
 *
 * @author Misagh Moayyed
 * @since 5.1.0
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@Slf4j
@ToString
@Getter
@NoArgsConstructor
public class OidcClientRegistrationRequest implements Serializable {

    private static final long serialVersionUID = 1832102135613155844L;

    @JsonProperty("redirect_uris")
    private List<String> redirectUris;

    @JsonProperty("client_name")
    private String clientName;

    @JsonProperty("subject_type")
    private String subjectType;

    @JsonProperty("token_endpoint_auth_method")
    private String tokenEndpointAuthMethod;

    @JsonProperty("scope")
    private String scope;

    @JsonProperty("grant_types")
    private List<String> grantTypes;

    @JsonProperty("response_types")
    private List<String> responseTypes;

    @JsonProperty("jwks_uri")
    private String jwksUri;

    @JsonProperty("sector_identifier_uri")
    private String sectorIdentifierUri;

    @JsonProperty("request_object_signing_alg")
    private String requestObjectSigningAlg;

    @JsonIgnore
    public Collection<String> getScopes() {
        return CollectionUtils.wrapList(getScope().split(" "));
    }
}


text:
package com.coremedia.iso.boxes;

import com.coremedia.iso.IsoTypeReader;
import com.coremedia.iso.IsoTypeWriter;
import com.googlecode.mp4parser.AbstractFullBox;
import com.googlecode.mp4parser.util.DateHelper;
import com.googlecode.mp4parser.util.Matrix;

import java.nio.ByteBuffer;
import java.util.Date;

/**
 *
4cc = "{@value #TYPE}"

 *
 * Box Type: 'mvhd'

 * Container: {@link MovieBox} ('moov')

 * Mandatory: Yes

 * Quantity: Exactly one

 *
 * This box defines overall information which is media-independent, and relevant to the entire presentation
 * considered as a whole.
 */
public class MovieHeaderBox extends AbstractFullBox {
    private Date creationTime;
    private Date modificationTime;
    private long timescale;
    private long duration;
    private double rate = 1.0;
    private float volume = 1.0f;
    private Matrix matrix = Matrix.ROTATE_0;
    private long nextTrackId;

    private int previewTime;
    private int previewDuration;
    private int posterTime;
    private int selectionTime;
    private int selectionDuration;
    private int currentTime;

    public static final String TYPE = "mvhd";

    public MovieHeaderBox() {
        super(TYPE);
    }

    public Date getCreationTime() {
        return creationTime;
    }

    public Date getModificationTime() {
        return modificationTime;
    }

    public long getTimescale() {
        return timescale;
    }

    public long getDuration() {
        return duration;
    }

    public double getRate() {
        return rate;
    }

    public float getVolume() {
        return volume;
    }

    public Matrix getMatrix() {
        return matrix;
    }

    public long getNextTrackId() {
        return nextTrackId;
    }

    protected long getContentSize() {
        long contentSize = 4;
        if (getVersion() == 1) {
            contentSize += 28;
        } else {
            contentSize += 16;
        }
        contentSize += 80;
        return contentSize;
    }

    @Override
    public void _parseDetails(ByteBuffer content) {
        parseVersionAndFlags(content);
        if (getVersion() == 1) {
            creationTime = DateHelper.convert(IsoTypeReader.readUInt64(content));
            modificationTime = DateHelper.convert(IsoTypeReader.readUInt64(content));
            timescale = IsoTypeReader.readUInt32(content);
            duration = IsoTypeReader.readUInt64(content);
        } else {
            creationTime = DateHelper.convert(IsoTypeReader.readUInt32(content));
            modificationTime = DateHelper.convert(IsoTypeReader.readUInt32(content));
            timescale = IsoTypeReader.readUInt32(content);
            duration = IsoTypeReader.readUInt32(content);
        }
        rate = IsoTypeReader.readFixedPoint1616(content);
        volume = IsoTypeReader.readFixedPoint88(content);
        IsoTypeReader.readUInt16(content);
        IsoTypeReader.readUInt32(content);
        IsoTypeReader.readUInt32(content);

        matrix = Matrix.fromByteBuffer(content);

        previewTime = content.getInt();
        previewDuration = content.getInt();
        posterTime = content.getInt();
        selectionTime = content.getInt();
        selectionDuration = content.getInt();
        currentTime = content.getInt();

        nextTrackId = IsoTypeReader.readUInt32(content);

    }

    public String toString() {
        StringBuilder result = new StringBuilder();
        result.append("MovieHeaderBox[");
        result.append("creationTime=").append(getCreationTime());
        result.append(";");
        result.append("modificationTime=").append(getModificationTime());
        result.append(";");
        result.append("timescale=").append(getTimescale());
        result.append(";");
        result.append("duration=").append(getDuration());
        result.append(";");
        result.append("rate=").append(getRate());
        result.append(";");
        result.append("volume=").append(getVolume());
        result.append(";");
        result.append("matrix=").append(matrix);
        result.append(";");
        result.append("nextTrackId=").append(getNextTrackId());
        result.append("]");
        return result.toString();
    }

    @Override
    protected void getContent(ByteBuffer byteBuffer) {
        writeVersionAndFlags(byteBuffer);
        if (getVersion() == 1) {
            IsoTypeWriter.writeUInt64(byteBuffer, DateHelper.convert(creationTime));
            IsoTypeWriter.writeUInt64(byteBuffer, DateHelper.convert(modificationTime));
            IsoTypeWriter.writeUInt32(byteBuffer, timescale);
            IsoTypeWriter.writeUInt64(byteBuffer, duration);
        } else {
            IsoTypeWriter.writeUInt32(byteBuffer, DateHelper.convert(creationTime));
            IsoTypeWriter.writeUInt32(byteBuffer, DateHelper.convert(modificationTime));
            IsoTypeWriter.writeUInt32(byteBuffer, timescale);
            IsoTypeWriter.writeUInt32(byteBuffer, duration);
        }
        IsoTypeWriter.writeFixedPoint1616(byteBuffer, rate);
        IsoTypeWriter.writeFixedPoint88(byteBuffer, volume);
        IsoTypeWriter.writeUInt16(byteBuffer, 0);
        IsoTypeWriter.writeUInt32(byteBuffer, 0);
        IsoTypeWriter.writeUInt32(byteBuffer, 0);

        matrix.getContent(byteBuffer);

        byteBuffer.putInt(previewTime);
        byteBuffer.putInt(previewDuration);
        byteBuffer.putInt(posterTime);
        byteBuffer.putInt(selectionTime);
        byteBuffer.putInt(selectionDuration);
        byteBuffer.putInt(currentTime);

        IsoTypeWriter.writeUInt32(byteBuffer, nextTrackId);
    }

    public void setCreationTime(Date creationTime) {
        this.creationTime = creationTime;
        if (DateHelper.convert(creationTime) >= (1l << 32)) {
            setVersion(1);
        }

    }

    public void setModificationTime(Date modificationTime) {
        this.modificationTime = modificationTime;
        if (DateHelper.convert(modificationTime) >= (1l << 32)) {
            setVersion(1);
        }

    }

    public void setTimescale(long timescale) {
        this.timescale = timescale;
    }

    public void setDuration(long duration) {
        this.duration = duration;
        if (duration >= (1l << 32)) {
            setVersion(1);
        }
    }

    public void setRate(double rate) {
        this.rate = rate;
    }

    public void setVolume(float volume) {
        this.volume = volume;
    }

    public void setMatrix(Matrix matrix) {
        this.matrix = matrix;
    }

    public void setNextTrackId(long nextTrackId) {
        this.nextTrackId = nextTrackId;
    }

    public int getPreviewTime() {
        return previewTime;
    }

    public void setPreviewTime(int previewTime) {
        this.previewTime = previewTime;
    }

    public int getPreviewDuration() {
        return previewDuration;
    }

    public void setPreviewDuration(int previewDuration) {
        this.previewDuration = previewDuration;
    }

    public int getPosterTime() {
        return posterTime;
    }

    public void setPosterTime(int posterTime) {
        this.posterTime = posterTime;
    }

    public int getSelectionTime() {
        return selectionTime;
    }

    public void setSelectionTime(int selectionTime) {
        this.selectionTime = selectionTime;
    }

    public int getSelectionDuration() {
        return selectionDuration;
    }

    public void setSelectionDuration(int selectionDuration) {
        this.selectionDuration = selectionDuration;
    }

    public int getCurrentTime() {
        return currentTime;
    }

    public void setCurrentTime(int currentTime) {
        this.currentTime = currentTime;
    }
}


text:
<?php
declare(strict_types=1);

namespace App\Handler;

use Articus\PathHandler\Annotation as PHA;
use Articus\PathHandler\Consumer as PHConsumer;
use Articus\PathHandler\Producer as PHProducer;
use Articus\PathHandler\Attribute as PHAttribute;
use Articus\PathHandler\Exception as PHException;
use Psr\Http\Message\ServerRequestInterface;

/**
 * @PHA\Route(pattern="/job/{name}/lastBuild/stop")
 */
class JobNameLastBuildStop
{
    /**
     * @PHA\Post()
     * @param ServerRequestInterface $request
     *
     * @throws PHException\HttpCode 501 if the method is not implemented
     */
    public function postJobLastBuildStop(ServerRequestInterface $request)
    {
        //TODO implement method
        throw new PHException\HttpCode(501, "Not implemented");
    }
}


text:
# Import numpy package
import numpy as np

# Create np_baseball (3 cols)
np_baseball = np.array(baseball)

# Print out addition of np_baseball and update
print(np_baseball + update)

# Create Numpy array: conversion
conversion = [0.0254, 0.453592, 1]

# Print out product of np_baseball and conversion
print(np_baseball * conversion)


text:
package com.canoo.webtest.plugins.emailtest;

import java.io.ByteArrayInputStream;
import java.io.IOException;

import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Part;

import com.canoo.webtest.steps.Step;

/**
 * Test for {@link EmailMessageContentFilter}.
 *
 * @author Paul King, ASERT
 */
public class EmailMessageContentFilterTest extends BaseEmailTestCase
{
    private static final String MESSAGE_ID = "123";
    private static final boolean DELETE_ON_EXIT = false;
    private static final String PLAIN_CONTENT_TYPE = "text/plain";
    private static final String SIMPLE_BODY = "Dummy Email Message";
    private static final String LS = System.getProperty("line.separator");
    private static final String MESSAGE_BODY = "Simple Message with one attachment" + LS +
        "begin 644 dummy.txt" + LS +
        "51'5M;7D@5&5X=\"!!='1A8VAM96YT " + LS +
        "end" + LS;
    private static final String DONT_CARE_DISPOSITION = Part.INLINE;
    private static final String DUMMY_CONTENT = "Dummy Content";

    protected Step createStep() {
        return new EmailMessageContentFilter();
    }

    public void testInvalidMessageId() {
        final EmailMessageContentFilter step = (EmailMessageContentFilter) getStep();
        step.getContext().put("EmailConfigInfo", null);
        assertErrorOnExecute(step, "invalid messageId", "Can't parse messageId parameter with value 'null' as an integer.");
        step.setMessageId("non-integer");
        assertErrorOnExecute(step, "invalid messageId", "Can't parse messageId parameter with value 'non-integer' as an integer.");
    }

    public void testInvalidPartIndex() {
        final EmailMessageContentFilter step = (EmailMessageContentFilter) getStep();
        step.getContext().put("EmailConfigInfo", null);
        step.setMessageId(MESSAGE_ID);
        step.setPartIndex("non-integer");
        assertErrorOnExecute(step, "invalid partIndex", "Can't parse partIndex parameter with value 'non-integer' as an integer.");
    }

    public void testNoPartIndex() throws Exception {
        final EmailMessageContentFilter step = (EmailMessageContentFilter) getStep();
        final EmailHelper helper = prepareHelper(step, -1);
        final Message mockMessage = setUpGetMessageExpectations(step, helper, DELETE_ON_EXIT);
        mockMessage.getInputStream();
        modify().returnValue(new ByteArrayInputStream(SIMPLE_BODY.getBytes()));
        mockMessage.getContentType();
        modify().returnValue(PLAIN_CONTENT_TYPE);
        setUpMessageOperationFinaliseExpectations(helper, DELETE_ON_EXIT);
        startVerification();
        executeStep(step);
        assertEquals(SIMPLE_BODY, step.getContext().getCurrentResponse().getWebResponse().getContentAsString());
        assertEquals(PLAIN_CONTENT_TYPE, step.getContext().getCurrentResponse().getWebResponse().getContentType());
    }

    public void testNoPartIndexIoException() throws Exception {
        final EmailMessageContentFilter step = (EmailMessageContentFilter) getStep();
        final EmailHelper helper = prepareHelper(step, -1);
        final Message mockMessage = setUpGetMessageExpectations(step, helper, DELETE_ON_EXIT);
        mockMessage.getInputStream();
        modify().throwException(new IOException("dummyIoException"));
        setUpMessageOperationFinaliseExpectations(helper, DELETE_ON_EXIT);
        startVerification();
        assertFailOnExecute(step, "expected to fail",
                "Error performing operation: Error extracting message: dummyIoException");
    }

    public void testPartIndexIoException() throws Exception {
        final EmailMessageContentFilter step = (EmailMessageContentFilter) getStep();
        final EmailHelper helper = prepareHelper(step, 0);
        final Message mockMessage = setUpGetMessageExpectations(step, helper, DELETE_ON_EXIT);
        mockMessage.getContent();
        modify().throwException(new IOException("dummyIoException"));
        setUpMessageOperationFinaliseExpectations(helper, DELETE_ON_EXIT);
        startVerification();
        assertFailOnExecute(step, "expected to fail",
                "Error performing operation: Error processing email message: dummyIoException");
    }

    public void testSimpleNoAttachments() throws Exception {
        checkSimpleAttachments(0, null,
                "Simple Message with no attachments " + LS,
                "Unable to find part with index 0.");
    }

    public void testSimpleBadUudecode() throws Exception {
        checkSimpleAttachments(0, null,
                "Simple Message with bad attachment" + LS +
                "begin 123 but no end" + LS,
                "Error performing operation: Error Uudecoding attachment: UUDecoder: Short Buffer.");
    }

    public void testSimpleWithAttachmentNoContentType() throws Exception {
        checkSimpleAttachments(0, null, MESSAGE_BODY,
                "Attribute 'contentType' must be supplied for simple messages.");
    }

    public void testSimpleWithPartIndexTooLarge() throws Exception {
        checkSimpleAttachments(1, PLAIN_CONTENT_TYPE, MESSAGE_BODY,
                "Unable to find part with index 1.");
    }

    public void testSimpleWithAttachment() throws Exception {
        final Step step = checkSimpleAttachments(0, PLAIN_CONTENT_TYPE, MESSAGE_BODY, null);
        assertEquals("Dummy Text Attachment", step.getContext().getCurrentResponse().getWebResponse().getContentAsString());
        assertEquals(PLAIN_CONTENT_TYPE, step.getContext().getCurrentResponse().getWebResponse().getContentType());
    }

    private EmailMessageContentFilter checkSimpleAttachments(final int partIndex, final String contentType, final String messageBody,
                                                             final String failMessage) throws Exception {
        final EmailMessageContentFilter step = (EmailMessageContentFilter) getStep();
        step.setContentType(contentType);
        final EmailHelper helper = prepareHelper(step, partIndex);
        final Message mockMessage = setUpGetMessageExpectations(step, helper, DELETE_ON_EXIT);
        mockMessage.getContent();
        modify().returnValue(messageBody);
        setUpMessageOperationFinaliseExpectations(helper, DELETE_ON_EXIT);
        startVerification();
        if (failMessage != null) {
            assertFailOnExecute(step, "expected to fail", failMessage);
        } else {
            executeStep(step);
        }
        return step;
    }

    public void testMultipart1() throws Exception {
        checkMultipart(0, 0, "PartIndex too large.", null, null, null);
    }

    public void testMultipart2() throws Exception {
        checkMultipart(1, 0,
            "Error performing operation: Actual contentType of 'text/plain' did not match expected contentType of 'text/html'",
            DONT_CARE_DISPOSITION, "text/html", PLAIN_CONTENT_TYPE);
    }

    public void testMultipart3() throws Exception {
        final Step step = checkMultipart(1, 0, null, Part.ATTACHMENT, null, PLAIN_CONTENT_TYPE);
        assertEquals(DUMMY_CONTENT, step.getContext().getCurrentResponse().getWebResponse().getContentAsString());
        assertEquals(PLAIN_CONTENT_TYPE, step.getContext().getCurrentResponse().getWebResponse().getContentType());
    }

    public void testMultipart4() throws Exception {
        final Step step = checkMultipart(1, 0, null, Part.INLINE, null, PLAIN_CONTENT_TYPE);
        assertEquals(DUMMY_CONTENT, step.getContext().getCurrentResponse().getWebResponse().getContentAsString());
        assertEquals(PLAIN_CONTENT_TYPE, step.getContext().getCurrentResponse().getWebResponse().getContentType());
    }

    private EmailMessageContentFilter checkMultipart(final int partCount, final int partIndex, final String failureMessage,
                                final String disposition, final String expectedContentType,
                                final String actualContentType) throws Exception {
        final EmailMessageContentFilter step = (EmailMessageContentFilter) getStep();
        step.setContentType(expectedContentType);
        final EmailHelper helper = prepareHelper(step, partIndex);
        final Message mockMessage = setUpGetMessageExpectations(step, helper, DELETE_ON_EXIT);
        final Multipart mockMultipart = setUpMultipart(partCount, partIndex, disposition, expectedContentType, actualContentType);
        mockMessage.getContent();
        modify().returnValue(mockMultipart);
        setUpMessageOperationFinaliseExpectations(helper, DELETE_ON_EXIT);
        startVerification();
        if (failureMessage != null) {
            assertFailOnExecute(step, "expected to fail", failureMessage);
        } else {
            executeStep(step);
        }
        return step;
    }

    public void testMultipartWithIoException() throws Exception {
        final EmailMessageContentFilter step = (EmailMessageContentFilter) getStep();
        final EmailHelper helper = prepareHelper(step, 0);
        final Message mockMessage = setUpGetMessageExpectations(step, helper, DELETE_ON_EXIT);
        final Multipart mockMultipart = (Multipart) intercept(Multipart.class, "mockMultipart");
        mockMultipart.getCount();
        modify().throwException(new IOException("Dummy Messaging Exception"));
        mockMessage.getContent();
        modify().returnValue(mockMultipart);
        setUpMessageOperationFinaliseExpectations(helper, DELETE_ON_EXIT);
        startVerification();
        assertFailOnExecute(step, "expected to fail",
                "Error performing operation: Error extracting part: Dummy Messaging Exception");
    }

    private BodyPart setUpBodyPart(final String disposition, final String expectedContentType,
                                   final String actualContentType) throws Exception {
        final BodyPart mockBodyPart = (BodyPart) mock(BodyPart.class, "mockBodyPart");
        mockBodyPart.getContentType();
        modify().returnValue(actualContentType);
        if (expectedContentType == null || expectedContentType.equals(actualContentType)) {
            mockBodyPart.getDisposition();
            modify().returnValue(disposition);
            mockBodyPart.getFileName();
            mockBodyPart.getInputStream();
            modify().returnValue(new ByteArrayInputStream(DUMMY_CONTENT.getBytes()));
        }
        return mockBodyPart;
    }

    private Multipart setUpMultipart(final int partCount, final int partIndex,
                                     final String disposition, final String expectedContentType,
                                     final String actualContentType) throws Exception {
        final Multipart mockMultipart = (Multipart) intercept(Multipart.class, "mockMultipart");
        mockMultipart.getCount();
        modify().returnValue(partCount);
        if (partCount > partIndex) {
            final BodyPart mockBodyPart = setUpBodyPart(disposition, expectedContentType, actualContentType);
            mockMultipart.getBodyPart(partIndex);
            modify().returnValue(mockBodyPart);
        }
        return mockMultipart;
    }

    private EmailHelper prepareHelper(final EmailMessageContentFilter step, final int partIndex) {
        if (partIndex != -1) {
            step.setPartIndex(String.valueOf(partIndex));
        }
        final EmailHelper helper = (EmailHelper) mock(EmailHelper.class, "helper");
        step.setHelper(helper);
        return helper;
    }

}


text:
import React from "react"
import { shallow } from "enzyme"
import { assert } from "chai"
import sinon from "sinon"

import SpinnerButton from "./SpinnerButton"

describe("SpinnerButton", () => {
  let sandbox
  beforeEach(() => {
    sandbox = sinon.createSandbox()
  })

  afterEach(() => {
    sandbox.restore()
  })

  for (const promiseState of ["not_clicked", "rejected", "resolved"]) {
    it(`passes through all props when promise state is ${promiseState}`, () => {
      return new Promise((resolve, reject) => {
        const onClickPromise = () =>
          promiseState === "rejected" ? reject() : resolve()
        const props = {
          "data-x":       "y",
          onClickPromise: onClickPromise,
          className:      "class1 class2"
        }
        const wrapper = shallow(
          // $FlowFixMe
          <SpinnerButton {...props}>childText</SpinnerButton>
        )
        const button = wrapper.find("button")
        const buttonProps = button.props()

        if (promiseState !== "not_clicked") {
          buttonProps.onClick()
        }

        for (const key of Object.keys(props)) {
          if (key !== "onClickPromise") {
            assert.deepEqual(buttonProps[key].trim(), props[key])
          }
        }
        assert.equal(button.children().text(), "childText")
        assert.isFalse(buttonProps.disabled)

        if (promiseState === "not_clicked") {
          resolve()
        }
      }).catch(err => {
        assert.isNotOk(err)
      })
    })
  }

  it("renders a button which is disabled while promise is not yet resolved or rejected", () => {
    const onClickPromise = () => new Promise(() => {})
    const props = {
      "data-x": "y"
    }
    const wrapper = shallow(
      <SpinnerButton
        onClickPromise={onClickPromise}
        className="class1 class2"
        {...props}
      >
        text
      </SpinnerButton>
    )
    let button = wrapper.find("button")
    let buttonProps = button.props()
    for (const key of Object.keys(props)) {
      assert.deepEqual(buttonProps[key], props[key])
    }
    buttonProps.onClick()

    // refresh after state update
    button = wrapper.find("button")
    wrapper.update()
    buttonProps = wrapper.find("button").props()

    assert.equal(buttonProps.className, "class1 class2 disabled-with-spinner")
    assert.equal(buttonProps["data-x"], "y")
    assert.isTrue(buttonProps.disabled)
    assert(
      button.children().find(".sk-fading-circle"),
      "Unable to find spinner"
    )
  })
})


text:
Ext.onReady(function() {

    hrforce.companystructure = new Ext.tree.TreePanel({
        height: 300,
		useArrows: false,
        autoScroll: true,
        animate: true,
        enableDD: false,
        containerScroll: false,
        border: false,
        dataUrl: 'hrforcedummy.php',
        root: {
            nodeType: 'async',
            text: 'Structure',
            id: 'task'
        }

    });

    hrforce.companystructure.getRootNode().expand();

	// example piechart
	var store = new Ext.data.JsonStore({
        fields: ['season', 'total'],
        data: [{
            season: 'Summer',
            total: 150
        },{
            season: 'Fall',
            total: 245
        },{
            season: 'Winter',
            total: 117
        },{
            season: 'Spring',
            total: 184
        }]
    });

	 hrforce.piechart = new Ext.Panel({
        width: 300,
        height: 200,
        items: [{
            store: store,
            xtype: 'piechart',
            dataField: 'total',
            categoryField: 'season',
            //extra styles get applied to the chart defaults
            extraStyle:
            {
                legend:
                {
                    display: 'bottom',
                    padding: 5,
                    font:
                    {
                        family: 'Tahoma',
                        size: 13
                    }
                }
            }
        }]
    });

	hrforce.maintabs.add({
		title: 'Dashboard',
		autoScroll: true,
		xtype:'portal',
		region:'center',
		margins:'35 5 5 0',
		items:[{
			columnWidth:.33,
			style:'padding:10px',
			items:[{
				title: 'Company structure',
				layout:'fit',
				tools: hrforce.widgettools,
				items: hrforce.companystructure
			}]
		},{
			columnWidth:.33,
			style:'padding:10px',
			items: [{
				title: 'Example Piechart',
				layout:'fit',
				tools: hrforce.widgettools,
				items: hrforce.piechart
			}]
		},{
			columnWidth:.33,
			style:'padding:10px'
		}]
	}).show();

});


text:
# grunt-codekit
> Grunt plugin for compiling [Kit](http://incident57.com/codekit/help.html#kit) files
> Can be used to embed files or concatenate files

[![NPM version](https://badge.fury.io/js/grunt-codekit.svg)](http://badge.fury.io/js/grunt-codekit)
[![Build Status](https://travis-ci.org/fatso83/grunt-codekit.svg?branch=master)](https://travis-ci.org/fatso83/grunt-codekit)

## Getting Started

### Install the plugin

```shell
npm install grunt-codekit --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-codekit');
```

### Choose files to compile

The plugin supports compiling templates written using the Kit language of CodeKit™. You can use both short form
and long form when specifying input and output destination.

Using short form (see below), the output files will be placed in the `dest` directory
and have the same names as the input files, only using a `.html` extension. When using
the long form you can explicitly specify the full name and path of each output file.

There is nothing in the way of mixing and matching the two styles.

#### Configuration options
As with all Grunt plugins, you can specify an `options` object, either for all tasks
or for each task. There is currently just one option:

- `compilePrefixed` - Files starting with an underscore (such as `_header.kit`),
so called partials, are normally not considered for compilation. By setting this option
 to true you can override this setting and still compile these files (default `false`).

Do remember that Grunt has a [lot of fancy ways of doing file system manipulation]
(http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically) for you

#### Example configuration

```js
grunt.initConfig({
  codekit: {

    globbed_example_config : {
        src : 'templates/**/*.kit',
        dest : 'build/html/'
    },

    explicit_output_names: {
      files : {
        'build/index.html' : '/templates/my_special_index.kit'
      }
    },

    build_with_underscored_files : {
        options : { compilePrefixed : true },
        files : {
            'build/about.html' : '_about.kit',
            'build/index.html' : '_index.kit'
        }
    },

    // see http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
    dynamic_file_object: {
        files: [{
            expand: true,
            cwd: 'sources',
            src: ['**/*.kit'],
            dest: 'build',
            ext: '.html'
    }
});
```

### Example usage: embedding critical path CSS
Using [Penthouse](https://github.com/fatso83/grunt-penthouse) one can generate a file containing the
critical path css, which can *dramatically* impact your site's [perceived speed](http://addyosmani.com/blog/tag/critical-path-css/) and your page ranking in Google.

You still need a way of embedding that CSS, though, and one way of doing that is using the Kit language. An
example on how this kit file might look is as follows

```
<html>
<head>
<title><!-- @title --></title>

<!-- embed critical path css generated by penthouse -->
<style>
<!--@include critical.css -->
</style>

</head>
<body>
    <!-- @include _header.kit -->
    <!-- @include _navbar.kit -->
    The main text of the page
    <!-- @include _footer.kit -->
</body>
</html>
```

## About the Kit language
The Kit language is a [simple html templating language](https://incident57.com/codekit/help.html#kit) used
in the commercial program CodeKit. It imports files into other html files and does simple variable substitution.
Since Bryan Jones made it open source it has seen support from several other programs, among those PrePros and
implementations in Python and Javascript. This plugin makes it possible to compile these files using Grunt.

## Release History
- 0.1.0 First release. Compilation of Kit files using an embedded python module.
- 0.2.0 Removed dependency on Python.
- 0.3.0 Partials are now being excluded.
- 0.4.0 Added support for CodeKit/PrePros javascript concatenation directives.
- 1.0.0 Added globbing support and removed support for javascript compilation.


text:
package org.carrot2.antlib.tasks;

import java.util.ArrayList;

import org.apache.tools.ant.*;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;

/**
 * A task-container which sets the context class loader to a given classloader identifier
 * and resets it upon exit.
 */
public class SwitchClassLoader extends Task implements TaskContainer
{
    /** Optional Vector holding the nested tasks */
    private ArrayList<Task> nestedTasks = new ArrayList<Task>();

    /** Class loader reference. */
    private Reference reference;

    /**
     * Use the reference to locate the loader. If the loader is not found, the specified
     * classpath will be used and registered with the specified name.
     */
    public void setLoaderRef(Reference r)
    {
        this.reference = r;
    }

    /**
     * Add a nested task.
     */
    public void addTask(Task nestedTask)
    {
        nestedTasks.add(nestedTask);
    }

    /**
     * Execute all nestedTasks.
     *
     * @throws BuildException if one of the nested tasks fails.
     */
    public void execute() throws BuildException
    {
        final Object referenced = reference.getReferencedObject();
        final ClassLoader cl;
        if (referenced instanceof ClassLoader)
        {
            cl = (ClassLoader) referenced;
        }
        else if (referenced instanceof Path)
        {
            cl = getProject().createClassLoader((Path) referenced);
        }
        else
        {
            throw new BuildException("Reference to a path or a classloader expected.");
        }

        final Thread self = Thread.currentThread();
        final ClassLoader previous = self.getContextClassLoader();
        try
        {
            self.setContextClassLoader(cl);
            for (Task task : nestedTasks)
            {
                task.perform();
            }
        }
        finally
        {
            self.setContextClassLoader(previous);
        }
    }
}


text:
package com.scalyr.logback.test;

import ch.qos.logback.classic.LoggerContext;
import com.scalyr.api.internal.ScalyrUtil;
import com.scalyr.api.logs.Events;
import com.scalyr.logback.ScalyrAppender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A simple test of Scalyr / logback integration.
 */
public class Test {
  private static Logger logger = LoggerFactory.getLogger("com.scalyr.logback.test.Test");

  /**
   * Insert a Scalyr "Write Logs" key here (see https://www.scalyr.com/keys).
   */
  private static final String API_KEY = "...";

  public static void main(String[] args) throws InterruptedException {
    // Create a ScalyrAppender, and attach it to our Logger. Note that in a real application, you would
    // generally do this in your logback configuration file, not in Java code.
    ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) logger;
    ScalyrAppender scalyrAppender = new ScalyrAppender();
    scalyrAppender.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
    scalyrAppender.setApiKey(API_KEY);
    scalyrAppender.setMaxBufferRam("4m");
    scalyrAppender.setServerHost(ScalyrUtil.getHostname());
    scalyrAppender.start();
    logbackLogger.addAppender(scalyrAppender);

    // Write some log messages from three parallel threads, to test threaded logging.
    TestThread[] threads = new TestThread[3];
    for (int i = 0; i < threads.length; i++) {
      threads[i] = new TestThread(i + 1);
      threads[i].start();
    }

    for (TestThread thread : threads) {
      thread.join();
    }

    Events.flush();
  }

  /**
   * Writes some messages to the log, spaced over 1.5 seconds, and then terminates.
   */
  private static class TestThread extends Thread {
    private final int threadIndex;

    private TestThread(int threadIndex) {
      this.threadIndex = threadIndex;
    }

    @Override public void run() {
      for (int i = 1; i <= 5; i++) {
        logger.warn("Thread " + threadIndex + ", message " + i + " (warn)");
        logger.info("Thread " + threadIndex + ", message " + i + " (info)");
        logger.debug("Thread " + threadIndex + ", message " + i + " (debug)");

        try {
          Thread.sleep(300);
        } catch (InterruptedException ex) {
          ex.printStackTrace();
        }
      }
    }
  }
}


text:
package org.ehcache.exceptions;

import org.ehcache.spi.loaderwriter.CacheLoaderWriter;

/**
 * Exception thrown by a {@link org.ehcache.Cache} when the {@link CacheLoaderWriter} it uses threw an
 * {@link java.lang.Exception} while loading a value for a given key.
 *
 * @author Alex Snaps
 */
public class CacheLoadingException extends RuntimeException {

  private static final long serialVersionUID = 4794738044299044587L;

  CacheLoadingException() {
    super();
  }

  CacheLoadingException(final String message) {
    super(message);
  }

  CacheLoadingException(final String message, final Throwable cause) {
    super(message, cause);
  }

  CacheLoadingException(final Throwable cause) {
    super(cause);
  }

}


text:
package com.thinkbiganalytics.schema;

import com.thinkbiganalytics.discovery.model.DefaultField;
import com.thinkbiganalytics.discovery.model.DefaultTableSchema;
import com.thinkbiganalytics.discovery.schema.Field;
import com.thinkbiganalytics.discovery.schema.TableSchema;
import com.thinkbiganalytics.discovery.util.ParserHelper;
import com.thinkbiganalytics.jdbc.util.DatabaseType;
import com.thinkbiganalytics.kerberos.KerberosTicketConfiguration;
import com.thinkbiganalytics.kerberos.KerberosUtil;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.support.MetaDataAccessException;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.sql.DataSource;

/**
 * Provides database metadata and schema information from JDBC.
 */
public class DBSchemaParser {

    private static final Logger log = LoggerFactory.getLogger(DBSchemaParser.class);

    /**
     * Column name containing the catalog name
     */
    private static final String CATALOG_COLUMN = "TABLE_CAT";

    /**
     * Column name containing the schema name
     */
    private static final String SCHEMA_COLUMN = "TABLE_SCHEM";

    private final DataSource ds;
    private final KerberosTicketConfiguration kerberosTicketConfiguration;

    public DBSchemaParser(@Nonnull final DataSource ds, @Nonnull final KerberosTicketConfiguration kerberosTicketConfiguration) {
        this.ds = ds;
        this.kerberosTicketConfiguration = kerberosTicketConfiguration;
    }

    /**
     * This will list schemas for a connection.
     * NOTE it will not close the connection
     *
     * @return a list of schema names
     */
    @Nonnull
    private List<String> listSchemas(@Nonnull final Connection conn) throws SQLException {
        List<String> schemas = new ArrayList<>();
        String schemaQuery = "show databases";
        try (ResultSet rs = conn.createStatement().executeQuery(schemaQuery)) {
            while (rs.next()) {
                String schema = rs.getString(1);
                schemas.add(schema);
            }
            return schemas;
        }
    }

    /**
     * List the catalogs for a given connection.
     * NOTE it will not close the connection
     *
     * @return a list of catalog names
     */
    @Nonnull
    private List<String> listCatalogs(@Nonnull final Connection conn) throws SQLException {
        List<String> catalogs = new ArrayList<>();
        try (ResultSet rs = conn.getMetaData().getCatalogs()) {
            while (rs.next()) {
                String cat = rs.getString(CATALOG_COLUMN);
                catalogs.add(cat);
            }
            return catalogs;
        }
    }

    @Nonnull
    public List<String> listSchemas() {
        try (final Connection conn = KerberosUtil.getConnectionWithOrWithoutKerberos(ds, kerberosTicketConfiguration)) {
            return listSchemas(conn);
        } catch (SQLException e) {
            throw new SchemaParserException("Unable to list schemas", e);
        }
    }

    @Nonnull
    public List<String> listCatalogs() {
        try (final Connection conn = KerberosUtil.getConnectionWithOrWithoutKerberos(ds, kerberosTicketConfiguration)) {
            return listCatalogs(conn);
        } catch (SQLException e) {
            throw new SchemaParserException("Unable to list catalogs", e);
        }
    }

    @Nonnull
    public List<String> listSchemasOrCatalogs() {
        try (final Connection conn = KerberosUtil.getConnectionWithOrWithoutKerberos(ds, kerberosTicketConfiguration)) {
            if (conn.getMetaData().supportsCatalogsInIndexDefinitions()) {
                return listCatalogs(conn);
            } else {
//conn.getMetadata.supportsSchemasInIndexDefinitions
                return listSchemas(conn);
            }
        } catch (SQLException e) {
            throw new SchemaParserException("Unable to list schemas/catalogs", e);
        }
    }

    /**
     * Lists the tables in the specified schema that match the specified table pattern.d
     *
     * @param conn      the JDBC connection
     * @param catalog   the catalog name pattern, or {@code null}
     * @param schema    the schema name pattern, or {@code null}
     * @param tableName the table name pattern   @return a result set containing the matching table metadata
     * @return the list of tables or {@code null} if there was a problem
     */
    @Nullable
    private ResultSet getTables(@Nonnull final Connection conn, @Nullable String catalog, @Nullable final String schema, @Nonnull final String tableName) {
        try {
            DatabaseType databaseType = null;
            try {
                databaseType = DatabaseType.fromMetaData(conn);
            } catch (MetaDataAccessException e) {
                //if can't get the db type, then treat it as normal looking for TABLE and VIEW
            }

            if (DatabaseType.TERADATA.equals(databaseType)) {
                return conn.getMetaData().getTables(catalog, schema, tableName, null);  //Teradata-specific
            } else {
                return conn.getMetaData().getTables(catalog, schema, tableName, new String[]{"TABLE", "VIEW"});
            }
        } catch (final SQLException e) {
            log.debug("Failed to list tables for catalog:{} schema:{} tableName:{}", catalog, schema, tableName, e);
            return null;
        }
    }

    private void addTableToList(@Nonnull final ResultSet result, @Nonnull final List<String> tables) throws SQLException {
        final String tableName = result.getString("TABLE_NAME");
        final String tableSchem = result.getString(SCHEMA_COLUMN);
        final String tableCat = result.getString(CATALOG_COLUMN);
        tables.add((tableSchem != null ? tableSchem : tableCat) + "." + tableName);
    }

    /**
     * Lists the tables in the specified schema.
     * Some databases use the catalog (i.e. MySQL), some don't (i.e. Teradata)
     * This should work for all cases.
     *
     * @param schema the schema name, or {@code null}
     * @return the list of table names prepended with the schema name, like: {@code <schema>.<table>}
     * @throws RuntimeException if a database access error occurs
     */
    @Nonnull
    public List<String> listTables(@Nullable final String schema, @Nullable final String tableName) {
        final String schemaPattern = (schema != null) ? schema : "%";

        final String tableNamePattern = (tableName != null) ? tableName : "%";

        final List<String> tables = new ArrayList<>();

        List<String> catalogs = null;
        try {
            catalogs = listCatalogs();
        } catch (Exception e) {
            //ok to catch exception here
        }
        boolean hasCatalogs = catalogs != null && !catalogs.isEmpty();

        if (StringUtils.isNotBlank(schema) || StringUtils.isNotBlank(tableName)) {

            //try using the catalog
            try (final Connection conn = KerberosUtil.getConnectionWithOrWithoutKerberos(ds, kerberosTicketConfiguration)) {
                if (hasCatalogs) {
                    for (final String catalog : catalogs) {
                        try (final ResultSet result = getTables(conn, catalog, schemaPattern, tableNamePattern)) {
                            while (result != null && result.next()) {
                                addTableToList(result, tables);
                            }
                        }
                    }
                } else {
                    try (final ResultSet result = getTables(conn, null, schemaPattern, tableNamePattern)) {
                        while (result != null && result.next()) {
                            addTableToList(result, tables);
                        }
                    }
                }

            } catch (final SQLException e) {
                throw new SchemaParserException("Unable to obtain table list", e);
            }

        } else {

            try {
                if (hasCatalogs) {
                    try (final Connection conn = KerberosUtil.getConnectionWithOrWithoutKerberos(ds, kerberosTicketConfiguration)) {
                        for (final String catalog : catalogs) {
                            try (final ResultSet result = getTables(conn, catalog, "%", tableNamePattern)) {
                                while (result != null && result.next()) {
                                    addTableToList(result, tables);
                                }
                            }
                        }
                    }
                } else {
                    List<String> schemas = listSchemas();
                    try (final Connection conn = KerberosUtil.getConnectionWithOrWithoutKerberos(ds, kerberosTicketConfiguration)) {
                        for (final String dbSchema : schemas) {
                            try (final ResultSet result = getTables(conn, null, dbSchema, tableNamePattern)) {
                                while (result != null && result.next()) {
                                    addTableToList(result, tables);
                                }
                            }
                        }
                    }
                }
            } catch (final SQLException e) {
                throw new SchemaParserException("Unable to obtain table list", e);
            }
        }

        return tables;
    }

    /**
     * Lists the tables in the specified catalog or schema
     * Some databases use the catalog (i.e. MySQL), some don't (i.e. Teradata)
     * This should work for all cases.
     *
     * @param catalog the catalog name
     * @return the list of table names prepended with the schema or catalog name, like: {@code <schema>.<table>}
     * @throws RuntimeException if a database access error occurs
     */
    @Nonnull
    public List<String> listTables(@Nullable final String catalog) {
        final List<String> tables = new ArrayList<>();

        try {
            try (final Connection conn = KerberosUtil.getConnectionWithOrWithoutKerberos(ds, kerberosTicketConfiguration)) {
                if (conn.getMetaData().supportsCatalogsInIndexDefinitions()) {
                    try (final ResultSet result = getTables(conn, catalog, "%", "%")) {
                        while (result != null && result.next()) {
                            addTableToList(result, tables);
                        }
                    }
                } else {
                    try (final ResultSet result = getTables(conn, null, catalog, "%")) {
                        while (result != null && result.next()) {
                            addTableToList(result, tables);
                        }
                    }
                }
            }
        } catch (final SQLException e) {
            throw new SchemaParserException("Unable to obtain table list", e);
        }

        return tables;
    }

    /**
     * Gets the schema for the specified table.
     *
     * @param schema the schema name
     * @param table  the table name
     * @return the table schema
     * @throws IllegalArgumentException if the table name is empty
     * @throws RuntimeException         if a database access error occurs
     */
    @Nullable
    public TableSchema describeTable(@Nullable final String schema, @Nonnull final String table) {
        Validate.isTrue(!StringUtils.isEmpty(table), "Table expected");

        try (final Connection conn = KerberosUtil.getConnectionWithOrWithoutKerberos(ds, kerberosTicketConfiguration)) {
            String queryCatalog = schema;
            String querySchema = schema;
            if (conn.getMetaData().supportsCatalogsInIndexDefinitions()) {
                querySchema = "%";
            } else if (conn.getMetaData().supportsSchemasInIndexDefinitions()) {
                queryCatalog = null;
            }

            try (final ResultSet result = getTables(conn, queryCatalog, querySchema, table)) {
                while (result != null && result.next()) {
                    final String cat = result.getString(1);
                    final String schem = result.getString(2);
                    final String tableName = result.getString(3);
                    if (table.equalsIgnoreCase(tableName) && (queryCatalog != null || schema == null || schem == null || schema.equalsIgnoreCase(schem))) {
                        final DefaultTableSchema tableSchema = new DefaultTableSchema();
                        tableSchema.setFields(listColumns(conn, cat, schem, tableName, true));
                        tableSchema.setName(tableName);
                        tableSchema.setSchemaName(StringUtils.isBlank(schem) ? cat : schem);
                        return tableSchema;
                    }
                }
            }
            try (final ResultSet result = getTables(conn, (queryCatalog == null) ? schema : null, "%".equals(querySchema) ? schema : "%", table)) {
                while (result != null && result.next()) {
                    final String cat = result.getString(1);
                    final String schem = result.getString(2);
                    final String tableName = result.getString(3);
                    if (table.equalsIgnoreCase(tableName) && (queryCatalog != null || schema == null || schem == null || schema.equalsIgnoreCase(schem))) {
                        final DefaultTableSchema tableSchema = new DefaultTableSchema();
                        tableSchema.setFields(listColumns(conn, cat, schem, tableName, false));
                        tableSchema.setName(tableName);
                        tableSchema.setSchemaName(StringUtils.isBlank(schem) ? cat : schem);
                        return tableSchema;
                    }
                }
            }
        } catch (final SQLException e) {
            throw new SchemaParserException("Unable to describe schema [" + schema + "] table [" + table + "]", e);
        }

        return null;
    }

    @Nonnull
    private Set<String> listPrimaryKeys(@Nonnull Connection conn, @Nullable String schema, @Nonnull String tableName) throws SQLException {
        HashSet<String> primaryKeys = new HashSet<>();
        try (ResultSet rs = conn.getMetaData().getPrimaryKeys(null, schema, tableName)) {
            while (rs.next()) {
                String columnName = rs.getString("COLUMN_NAME");
                String cat = rs.getString(CATALOG_COLUMN);
                if (StringUtils.isNotBlank(cat) && StringUtils.isNotBlank(schema)) {
                    //this db supports Catalogs.  Ensure the cat matches the supplied schema
                    if (schema.equalsIgnoreCase(cat)) {
                        primaryKeys.add(columnName);
                    }
                } else {
                    primaryKeys.add(columnName);
                }
            }
        } catch (SQLException e) {
            //attempt to use the catalog instead of the schema
            try (ResultSet rs = conn.getMetaData().getPrimaryKeys(schema, null, tableName)) {
                while (rs.next()) {
                    String columnName = rs.getString("COLUMN_NAME");
                    primaryKeys.add(columnName);
                }
            } catch (SQLException e2) {
                log.info("Failed to list primary keys of {}.{}", schema, tableName);
            }
        }
        return primaryKeys;
    }

    @Nonnull
    private List<Field> listColumns(@Nonnull Connection conn, @Nullable String catalog, @Nullable String schema, @Nonnull String tableName, boolean schemaIsCat) throws SQLException {
        List<Field> fields;
        Set<String> pkSet = listPrimaryKeys(conn, (schema != null) ? schema : catalog, tableName);
        try (ResultSet columns = conn.getMetaData().getColumns(catalog, schema, tableName, null)) {
            fields = columnsResultSetToField(columns, pkSet, schema, schemaIsCat);
        }
        if (fields.isEmpty()) {
            //if empty try the schema as the catalog (for MySQL db)
            try (ResultSet columns = conn.getMetaData().getColumns(schema, null, tableName, null)) {
                fields = columnsResultSetToField(columns, pkSet, schema, schemaIsCat);
            }
        }
        return fields;
    }

    @Nonnull
    private List<Field> columnsResultSetToField(@Nullable ResultSet columns, @Nonnull Set<String> pkSet, @Nullable String schema, boolean schemaIsCat) throws SQLException {
        List<Field> fields = new ArrayList<>();
        if (columns != null) {
            while (columns.next()) {
                String cat = columns.getString(CATALOG_COLUMN);
                if (StringUtils.isNotBlank(cat) && StringUtils.isNotBlank(schema)) {
                    //this db supports Catalogs.  Ensure the cat matches the supplied schema
                    if (schemaIsCat && !schema.equalsIgnoreCase(cat)) {
                        continue;
                    }
                }

                DefaultField field = new DefaultField();
                field.setName(columns.getString("COLUMN_NAME"));
                Integer dataType = columns.getInt("DATA_TYPE");
                field.setNativeDataType(ParserHelper.toNativeType(dataType));
                field.setDerivedDataType(ParserHelper.sqlTypeToHiveType(dataType));
                field.setDescription(columns.getString("REMARKS"));
                String isNullableString = columns.getString("IS_NULLABLE");
                if ("NO".equals(isNullableString)) {
                    field.setNullable(false);
                }
                if (pkSet.contains(field.getName())) {
                    field.setPrimaryKey(true);
                }
                fields.add(field);
            }
        }
        return fields;

    }
}


text:
;(function() {
  'use strict';

  // Communicates with the 'on_the_mind_statements' server API.
  function OnYourMindStatements($resource) {
    var OnYourMindResource = $resource(
        '/social_networking/on_the_mind_statements/:id',
        { id: '@id' }
      );

    function OnYourMind() {}

    // Create a new 'On the Mind Statement' on the server.
    //
    // returns {Promise} A promise of the request.
    OnYourMind.create = function(attributes) {
      var onYourMind = new OnYourMindResource({
        description: attributes.description
      });

      return onYourMind.$save();
    };

    return OnYourMind;
  }

  angular.module('socialNetworking.services')
    .service('OnYourMindResource', ['$resource', OnYourMindStatements]);
})();


text:
<?php

use Centreon\Test\Behat\CentreonContext;
use Centreon\Test\Behat\Configuration\HostConfigurationPage;
use Centreon\Test\Behat\Configuration\ServiceConfigurationPage;
use Centreon\Test\Behat\Monitoring\MonitoringServicesPage;
use Centreon\Test\Behat\Monitoring\ServiceMonitoringDetailsPage;

class ServiceSubmitResultContext extends CentreonContext
{
    protected $page;
    protected $hostname = 'passiveHost';
    protected $hostservice = 'PassiveService';
    protected $checkoutput = 'Centreon test result';

    /**
     * @Given one passive service has been configured using arguments status and output exists
     */
    public function onePassiveServiceHasBeenConfiguredUsingArgumentsStatusAndOutputExists()
    {
        // Create host.
        $hostConfig = new HostConfigurationPage($this);
        $hostProperties = array(
            'name' => $this->hostname,
            'alias' => $this->hostname,
            'address' => 'localhost',
            'max_check_attempts' => 1,
            'normal_check_interval' => 1,
            'retry_check_interval' => 1,
            'active_checks_enabled' => 0,
            'passive_checks_enabled' => 1
        );
        $hostConfig->setProperties($hostProperties);
        $hostConfig->save();

        // Create service.
        $serviceConfig = new ServiceConfigurationPage($this);
        $serviceProperties = array(
            'description' => $this->hostservice,
            'hosts' => $this->hostname,
            'templates' => 'generic-service',
            'check_command' => 'check_centreon_dummy',
            'check_period' => '24x7',
            'max_check_attempts' => 1,
            'normal_check_interval' => 1,
            'retry_check_interval' => 1,
            'active_checks_enabled' => 0,
            'is_volatile' => 0,
            'passive_checks_enabled' => 1
        );
        $serviceConfig->setProperties($serviceProperties);
        $serviceConfig->save();

        // Ensure service is monitored.
        $this->restartAllPollers();
    }

    /**
     * @When I submit some result to this service
     */
    public function iSubmitSomeResultToThisService()
    {

        $this->submitServiceResult($this->hostname, $this->hostservice, 2, $this->checkoutput);
    }

    /**
     * @Then the values are set as wanted in Monitoring > Status details page
     */
    public function theValuesAreSetAsWantedInMonitoringStatusDetailsPage()
    {
        try {
            $this->spin(
                function ($context) {
                    $this->page = new MonitoringServicesPage($this);
                    $result = $this->page->getPropertyFromAHostAndService(
                        $this->hostname,
                        $this->hostservice,
                        'status_information'
                    );
                    return ($result == $this->checkoutput);
                },
                "The result submitted is not set as wanted",
                15
            );
        } catch (\Exception $e) {
            throw new Exception('The result submitted is not set as wanted');
        }
    }
}


text:
<?php

namespace XysterTest\Container\Injector;
use Xyster\Container\Injector\Standard;
use Xyster\Container\Definition;
use Xyster\Container\Container;
require_once dirname(dirname(__FILE__)) . '/_files/Sdi.php';

/**
 * Only for testing the setter injection
 */
class StandardSdiTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var    Standard
     */
    protected $object;

    /**
     * Sets up the fixture
     */
    protected function setUp()
    {
        $def = new Definition('\XysterTest\Container\RocketShip');
        $def->dependsOn('pilot', 'XysterTest\Container\RocketPilot')
            ->dependsOn('fuel', 'XysterTest\Container\RocketFuel');
        $this->object = new Standard($def);
    }

    public function testGet()
    {
        $container = new Container();
        $container->add(Container::definition('\XysterTest\Container\RocketPilot')
            ->dependsOn('suit', 'XysterTest\Container\SpaceSuit'))
            ->add(new Definition('XysterTest\Container\RocketFuel'))
            ->add(new Definition('XysterTest\Container\SpaceSuit'));
        $object = $this->object->get($container);
        self::assertType('\XysterTest\Container\RocketShip', $object);
        self::assertAttributeEquals(new \XysterTest\Container\RocketFuel(), '_fuel', $object);
        self::assertType('\XysterTest\Container\RocketPilot', $object->getPilot());
    }

    /**
     * @expectedException \Xyster\Container\Injector\Exception
     */
    public function testGetBad()
    {
        //$this->setExpectedException('Xyster_Container_Injector_Exception', 'Cannot inject property pilot into RocketShip: key not found in the container: RocketPilot');
        $this->object->get(new Container());
    }

    public function testGetName()
    {
        self::assertEquals('XysterTest\Container\RocketShip', $this->object->getName());
    }

    public function testGetType()
    {
        self::assertEquals(new \Xyster\Type\Type('\XysterTest\Container\RocketShip'), $this->object->getType());
    }

    public function testGetLabel()
    {
        self::assertEquals('Injector', $this->object->getLabel());
    }

    public function testToString()
    {
        self::assertEquals('Injector:XysterTest\Container\RocketShip', $this->object->__toString());
    }

    /**
     * @expectedException \Xyster\Container\Injector\Exception
     */
    public function testValidateError1()
    {
        $this->object->validate(new Container());
    }

    public function testValidate()
    {
        $def = new Definition('\XysterTest\Container\RocketPilot');
        $def->dependsOn('suit', 'XysterTest\Container\SpaceSuit');
        $container = new Container();
        $container->add($def)
            ->add(new Definition('\XysterTest\Container\RocketFuel'))
            ->add(new Definition('\XysterTest\Container\SpaceSuit'));
        $this->object->validate($container);
    }
}