text:
#ifndef SQUID_ESICONTEXT_H
#define SQUID_ESICONTEXT_H

#include "esi/Parser.h"
#include "esi/Element.h"
#include "clientStream.h"
#include "err_type.h"
#include "HttpStatusCode.h"

class ESIVarState;
class ClientHttpRequest;

/* ESIContext */

class ESIContext : public esiTreeParent, public ESIParserClient
{

public:
    typedef RefCount<ESIContext> Pointer;
    void *operator new (size_t byteCount);
    void operator delete (void *address);
    ESIContext() :
            thisNode(NULL),
            http(NULL),
            errorpage(ERR_NONE),
            errorstatus(HTTP_STATUS_NONE),
            errormessage(NULL),
            rep(NULL),
            outbound_offset(0),
            readpos(0),
            pos(0),
            varState(NULL),
            cachedASTInUse(false),
            reading_(true),
            processing(false) {
        memset(&flags, 0, sizeof(flags));
    }

    ~ESIContext();

    enum esiKick_t {
        ESI_KICK_FAILED,
        ESI_KICK_PENDING,
        ESI_KICK_SENT,
        ESI_KICK_INPROGRESS
    };

    /* when esi processing completes */
    void provideData(ESISegment::Pointer, ESIElement *source);
    void fail (ESIElement *source, char const*anError = NULL);
    void startRead();
    void finishRead();
    bool reading() const;
    void setError();
    void setErrorMessage(char const *);

    void addStackElement (ESIElement::Pointer element);
    void addLiteral (const char *s, int len);

    void finishChildren ();

    clientStreamNode *thisNode; /* our stream node */
    /* the request we are processing. HMM: cbdataReferencing this will result
     * in a circular reference, so we don't. Note: we are automatically freed
     * when it is, so thats ok. */
    ClientHttpRequest *http;

    struct {
        int passthrough:1;
        int oktosend:1;
        int finished:1;

        /* an error has occured, send full body replies
         * regardless. Note that we don't fail midstream
         * because we buffer until we can not fail
         */
        int error:1;

        int finishedtemplate:1; /* we've read the entire template */
        int clientwantsdata:1; /* we need to satisfy a read request */
        int kicked:1; /* note on reentering the kick routine */
        int detached:1; /* our downstream has detached */
    } flags;

    err_type errorpage; /* if we error what page to use */
    http_status errorstatus; /* if we error, what code to return */
    char *errormessage; /* error to pass to error page */
    HttpReply *rep; /* buffered until we pass data downstream */
    ESISegment::Pointer buffered; /* unprocessed data - for whatever reason */
    ESISegment::Pointer incoming;
    /* processed data we are waiting to send, or for
     * potential errors to be resolved
     */
    ESISegment::Pointer outbound;
    ESISegment::Pointer outboundtail; /* our write segment */
    /* the offset to the next character to send -
     * non zero if we haven't sent the entire segment
     * for some reason
     */
    size_t outbound_offset;
    int64_t readpos; /* the logical position we are reading from */
    int64_t pos; /* the logical position of outbound_offset in the data stream */

    class ParserState
    {

    public:
        ESIElement::Pointer stack[10]; /* a stack of esi elements that are open */
        int stackdepth; /* self explanatory */
        ESIParser::Pointer theParser;
        ESIElement::Pointer top();
        void init (ESIParserClient *);
        bool inited() const;
        ParserState();
        void freeResources();
        void popAll();
        int parsing:1; /* libexpat is not reentrant on the same context */

    private:
        bool inited_;
    }

    parserState; /* todo factor this off somewhere else; */
    ESIVarState *varState;
    ESIElement::Pointer tree;

    esiKick_t kick ();
    RefCount<ESIContext> cbdataLocker;
    bool failed() const {return flags.error != 0;}

    bool cachedASTInUse;

private:
    void fail ();
    void freeResources();
    void fixupOutboundTail();
    void trimBlanks();
    size_t send ();
    bool reading_;
    void appendOutboundData(ESISegment::Pointer theData);
    esiProcessResult_t process ();
    void parse();
    void parseOneBuffer();
    void updateCachedAST();
    bool hasCachedAST() const;
    void getCachedAST();
    virtual void start(const char *el, const char **attr, size_t attrCount);
    virtual void end(const char *el);
    virtual void parserDefault (const char *s, int len);
    virtual void parserComment (const char *s);
    bool processing;

    CBDATA_CLASS(ESIContext);
};

#endif /* SQUID_ESICONTEXT_H */


text:
<?php

namespace Kunstmaan\SeoBundle\Controller\Admin;

use Kunstmaan\AdminBundle\Controller\BaseSettingsController;
use Kunstmaan\AdminBundle\FlashMessages\FlashTypes;
use Kunstmaan\SeoBundle\Entity\Robots;
use Kunstmaan\SeoBundle\Form\RobotsType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
 * @final since 5.9
 */
class SettingsController extends BaseSettingsController
{
    /**
     * Generates the robots administration form and fills it with a default value if needed.
     *
     * @Route(path="/", name="KunstmaanSeoBundle_settings_robots")
     * @Template(template="@KunstmaanSeo/Admin/Settings/robotsSettings.html.twig")
     *
     * @return array|RedirectResponse
     */
    public function robotsSettingsAction(Request $request)
    {
        $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');

        $em = $this->getDoctrine()->getManager();
        $repo = $this->getDoctrine()->getRepository(Robots::class);
        $robot = $repo->findOneBy([]);
        $default = $this->container->getParameter('robots_default');
        $isSaved = true;

        if (!$robot) {
            $robot = new Robots();
        }

        if ($robot->getRobotsTxt() == null) {
            $robot->setRobotsTxt($default);
            $isSaved = false;
        }

        $form = $this->createForm(RobotsType::class, $robot, [
            'action' => $this->generateUrl('KunstmaanSeoBundle_settings_robots'),
        ]);
        if ($request->isMethod('POST')) {
            $form->handleRequest($request);
            if ($form->isSubmitted() && $form->isValid()) {
                $em->persist($robot);
                $em->flush();

                return new RedirectResponse($this->generateUrl('KunstmaanSeoBundle_settings_robots'));
            }
        }

        if (!$isSaved) {
            $this->addFlash(
                FlashTypes::WARNING,
                $this->container->get('translator')->trans('seo.robots.warning')
            );
        }

        return [
            'form' => $form->createView(),
        ];
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php namespace App\Events\Stats;

use App\Events\Event;

class NewsSubscribed extends Event
{
}


text:
package com.github.jsdossier.testing;

import static com.google.common.truth.Truth.assertWithMessage;

import com.google.common.truth.FailureMetadata;
import com.google.common.truth.Subject;
import com.google.javascript.rhino.jstype.JSType;
import java.util.function.Predicate;
import javax.annotation.Nullable;

public final class JSTypeSubject extends Subject<JSTypeSubject, JSType> {

  JSTypeSubject(FailureMetadata md, @Nullable JSType actual) {
    super(md, actual);
  }

  private void check(Predicate<JSType> check) {
    assertWithMessage("%s is a %s", actual(), actual().getClass().getName())
        .that(check.test(actual()))
        .isTrue();
  }

  public void isConstructor() {
    check(JSType::isConstructor);
  }

  public void isInterface() {
    check(JSType::isInterface);
  }

  public void isEnumType() {
    check(JSType::isEnumType);
  }

  public void isFunction() {
    check(JSType::isFunctionType);
  }

  public void isNumber() {
    check(JSType::isNumber);
  }

  public void isString() {
    check(JSType::isString);
  }

  public void isBoolean() {
    check(JSType::isBooleanValueType);
  }

  public void isObject() {
    check(JSType::isObjectType);
  }
}


text:
<!doctype html>

	<title>tt - edit</title>

	<link rel="stylesheet" href="https://unpkg.com/purecss@0.6.0/build/pure-min.css">
	<link rel="stylesheet" href="over.css">
	<link rel="stylesheet" href="checkbox.css">
	<link rel="stylesheet" href="tableScroll.css">

		<button ng-click="toggleViewTable()" class="pure-button button-success">switch</button>
		selected semester is: {{conf.semCh}}
			<select ng-change="changeLoc()" ng-model="conf.semCh">

				<option ng-repeat="sem in numberToArray(8)">{{sem}}</option>
			</select> & branch is: {{conf.brCh}}
			<select ng-change="changeLoc()" ng-model="conf.brCh">

				<option ng-repeat="br in ['CS','ME','EE','CE']">{{br}}</option>
			</select>

		<button ng-if="!viewTable" ng-click="toggleNoFilters()" class="pure-button">

			filters
			<s>filters</s>
		</button>{{noFilters?'showing All':'filtered'}}

						<button class="pure-button pure-button-primary">SAVE</button>

					{{classADay.label}}

				{{dayRows}}

					{{dayItems[$parent.$parent.$index].label}}
					sdk

					Day
					Period
					Duration
					Batch
					Subject<button class="pure-button button-success">+</button>
					Room<button class="pure-button button-success">+</button>
					Teacher<button class="pure-button button-success">+</button>
					Actions

					 {{row.d}}
					 {{row.p}}
					 {{row.dur}}
					 {{showBtc(row.b,row.br,row.sem)}}
					 {{row.s}}
					 {{row.r}}
					 {{row.t}}

						<button ng-disabled="noFilters" class="pure-button button-success" ng-click="copyRow(row)" >Copy</button>
						<button ng-disabled="noFilters" class="pure-button button-success" ng-click="editRow(row,$index)" >Edit</button>
						<button class="pure-button button-danger" ng-click="deleteRow($index)" >Delete</button>

						<select ng-model="rowInput.d">
							<option value="">----</option>
							<option ng-repeat="day in dayItems">{{day.label}}</option>
						</select>

						<select ng-model="rowInput.p" class="pure-input">
							<option value="">----</option>
							<option ng-repeat="period in classesEachDay" value="{{period.value}}">{{period.label}}</option>
						</select>

						<select ng-model="rowInput.dur" class="pure-input">
							<option value="">----</option>
							<option ng-repeat="d in numberToArray(3)">{{d}}</option>
						</select>

							<input style="display:none;" type="checkbox" id="{{'chBtc'+$index}}" ng-model="rowInput.b[$index]" />
							{{conf.brCh + bt}}

						<select ng-model="rowInput.s" class="pure-input">
							<option value="">----</option>
							<option ng-repeat="sub in userConfigs.subjects">{{sub.key}}</option>
						</select>

						<select ng-model="rowInput.r" class="pure-input">
							<option value="">----</option>
							<option ng-repeat="room in userConfigs.rooms">{{room.key}}</option>
						</select>

						<select ng-model="rowInput.t" class="pure-input">
							<option value="">----</option>
							<option ng-repeat="teacher in userConfigs.teachers">{{teacher.key}}</option>
						</select>

						<button ng-show="!isEmptyObj(rowInput)" ng-click="resetRow()" class="pure-button button-danger">reset</button>

							<button ng-click="addRow(rowInput,conf.semCh,conf.brCh)" class="pure-button button-success">+ ADD ROW</button>

							<button ng-hide="savingPost" ng-click="savePost(userConfigs)" class="pure-button pure-button-primary">SAVE</button>

	<button type="button" name="button" onclick="openNav()">open</button>

			<sidelist></sidelist>

adasda


text:
package cs201.gui.roles.restaurant.Matt;

import java.awt.Color;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import cs201.gui.ArtManager;
import cs201.gui.Gui;
import cs201.gui.structures.restaurant.RestaurantAnimationPanelMatt;
import cs201.helper.Constants;
import cs201.roles.restaurantRoles.Matt.RestaurantCookRoleMatt;

public class CookGuiMatt implements Gui {

	private RestaurantCookRoleMatt role;
	private boolean isPresent;

	private List<String> cooking;
	private List<String> plating;

	private final int COOKSIZE = (RestaurantAnimationPanelMatt.WINDOWX < RestaurantAnimationPanelMatt.WINDOWY) ? (int)(RestaurantAnimationPanelMatt.WINDOWX * .04f) : (int)(RestaurantAnimationPanelMatt.WINDOWY * .04f);
	private final int COOKX = (int)(RestaurantAnimationPanelMatt.WINDOWX * .47f);
	private final int COOKY = (int)(RestaurantAnimationPanelMatt.WINDOWY * .95f);
	private final int cookingAreaX = (int)(RestaurantAnimationPanelMatt.WINDOWX * .684f);
	private final int cookingAreaY = (int)(RestaurantAnimationPanelMatt.WINDOWY * .85f);
	private final int platingAreaX = (int)(RestaurantAnimationPanelMatt.WINDOWX * .2f);
	private final int platingAreaY = (int)(RestaurantAnimationPanelMatt.WINDOWY * .85f);

	private int xPos, yPos;
	private int xDestination, yDestination;
	private boolean animating = false;
	private boolean goingToIdle = false;

	private String moveDir = "Cook_Down";

	public CookGuiMatt(RestaurantCookRoleMatt c) {
		cooking = Collections.synchronizedList(new ArrayList<String>());
		plating = Collections.synchronizedList(new ArrayList<String>());
		role = c;
		xPos = RestaurantAnimationPanelMatt.RESTAURANT_ENTRANCE_X;
		xDestination = xPos;
		yPos = RestaurantAnimationPanelMatt.RESTAURANT_ENTRANCE_Y;
		yDestination = yPos;
		isPresent = false;
	}

	public void updatePosition() {
    	if (animating) {
			if (xPos < xDestination)
				xPos++;
			else if (xPos > xDestination)
				xPos--;

			if (yPos < yDestination)
				yPos++;
			else if (yPos > yDestination)
				yPos--;

			if (xPos == xDestination && yPos == yDestination) {
				animating = false;
				if (!goingToIdle) {
					role.DoneAnimating();
				}
			}
		} else {
			return;
		}
	}

	public void draw(Graphics2D g) {
		g.setColor(Color.BLACK);

		int x = cookingAreaX;
		int y = cookingAreaY;
		synchronized(cooking) {
			for (String food : cooking) {
				g.drawString(food, x, y);
				y += 13;
			}
		}

		x = platingAreaX;
		y = platingAreaY;
		synchronized(plating) {
			for (String food : plating) {
				g.drawString(food, x, y);
				y += 13;
			}
		}

		if (Constants.DEBUG_MODE) {
			g.setColor(Color.black);
			g.drawString("Cook", COOKX, COOKY);

			g.setColor(Color.WHITE);
			g.fillRect(xPos, yPos, COOKSIZE, COOKSIZE);
		} else {
			if (animating) {
				double theta = Math.atan2(yPos - yDestination, xDestination - xPos);

				if (theta >= -Math.PI/4 && theta <= Math.PI/4) {
					moveDir = "Cook_Right";
				} else if (theta >= Math.PI/4 && theta <= 3*Math.PI/4) {
					moveDir = "Cook_Up";
				} else if (theta <= -Math.PI/4 && theta >= -3*Math.PI/4) {
					moveDir = "Cook_Down";
				} else {
					moveDir = "Cook_Left";
				}
			} else {
				moveDir = "Cook_Down";
			}

			g.drawImage(ArtManager.getImage(moveDir), xPos, yPos, COOKSIZE, COOKSIZE, null);
		}
	}

	public void addCookingItem(String food) {
		cooking.add(food);
	}

	public void removeCookingItem(String food) {
		cooking.remove(food);
	}

	public void addPlatingItem(String food) {
		plating.add(food);
	}

	public void removePlatingItem(String food) {
		plating.remove(food);
	}

	public void goToLocation(int x, int y) {
		xDestination = x;
		yDestination = y;
		animating = true;
		goingToIdle = false;
	}

	public void goToKitchen() {
		if (xPos == COOKX && yPos == COOKY) {
			return;
		}
		xDestination = COOKX;
		yDestination = COOKY;
		animating = true;
		goingToIdle = true;
	}

	public boolean isPresent() {
		return isPresent;
	}

	public void setPresent(boolean p) {
		isPresent = p;
	}
}


text:
package com.braintreepayments.api;

import android.net.Uri;

import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.robolectric.RobolectricTestRunner;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isNull;
import static org.mockito.Matchers.same;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(RobolectricTestRunner.class)
public class UnionPayClientUnitTest {

    private UnionPayTokenizeCallback unionPayTokenizeCallback;

    private BraintreeClient braintreeClient;
    private ApiClient apiClient;

    private UnionPayCard unionPayCard;
    private UnionPayEnrollCallback unionPayEnrollCallback;
    private UnionPayFetchCapabilitiesCallback unionPayFetchCapabilitiesCallback;

    private Configuration unionPayEnabledConfiguration;
    private Configuration unionPayDisabledConfiguration;

    @Before
    public void beforeEach() throws JSONException {
        unionPayTokenizeCallback = mock(UnionPayTokenizeCallback.class);

        braintreeClient = mock(BraintreeClient.class);
        apiClient = mock(ApiClient.class);

        unionPayEnabledConfiguration = Configuration.fromJson(Fixtures.CONFIGURATION_WITH_UNIONPAY);
        unionPayDisabledConfiguration = Configuration.fromJson(Fixtures.CONFIGURATION_WITHOUT_ACCESS_TOKEN);

        unionPayCard = mock(UnionPayCard.class);
        unionPayEnrollCallback = mock(UnionPayEnrollCallback.class);
        unionPayFetchCapabilitiesCallback = mock(UnionPayFetchCapabilitiesCallback.class);
    }

    @Test
    public void tokenize_sendsAnalyticsEventOnTokenizeResult() throws JSONException {
        UnionPayCard unionPayCard = new UnionPayCard();
        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.tokenize(unionPayCard, unionPayTokenizeCallback);

        ArgumentCaptor<TokenizeCallback> captor = ArgumentCaptor.forClass(TokenizeCallback.class);
        verify(apiClient).tokenizeREST(same(unionPayCard), captor.capture());

        TokenizeCallback callback = captor.getValue();
        callback.onResult(new JSONObject(Fixtures.GRAPHQL_RESPONSE_CREDIT_CARD), null);

        verify(braintreeClient).sendAnalyticsEvent("union-pay.nonce-received");
    }

    @Test
    public void tokenize_callsListenerWithErrorOnFailure() {
        UnionPayCard unionPayCard = new UnionPayCard();
        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.tokenize(unionPayCard, unionPayTokenizeCallback);

        ArgumentCaptor<TokenizeCallback> captor = ArgumentCaptor.forClass(TokenizeCallback.class);
        verify(apiClient).tokenizeREST(same(unionPayCard), captor.capture());

        TokenizeCallback callback = captor.getValue();
        Exception error = new ErrorWithResponse(422, "");
        callback.onResult(null, error);

        verify(unionPayTokenizeCallback).onResult(null, error);
    }

    @Test
    public void tokenize_sendsAnalyticsEventOnFailure() {
        UnionPayCard unionPayCard = new UnionPayCard();
        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.tokenize(unionPayCard, unionPayTokenizeCallback);

        ArgumentCaptor<TokenizeCallback> captor = ArgumentCaptor.forClass(TokenizeCallback.class);
        verify(apiClient).tokenizeREST(same(unionPayCard), captor.capture());

        TokenizeCallback callback = captor.getValue();
        Exception error = new ErrorWithResponse(422, "");
        callback.onResult(null, error);

        verify(braintreeClient).sendAnalyticsEvent("union-pay.nonce-failed");
    }

    @Test
    public void enroll_sendsPOSTRequestForEnrollment() throws JSONException {
        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayEnabledConfiguration)
                .build();

        String unionPayCardJson = "{\"sample\":\"json\"}";
        when(unionPayCard.buildEnrollment()).thenReturn(new JSONObject(unionPayCardJson));

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.enroll(unionPayCard, unionPayEnrollCallback);

        String expectedPath = "/v1/union_pay_enrollments";
        verify(braintreeClient).sendPOST(eq(expectedPath), eq(unionPayCardJson), any(HttpResponseCallback.class));
    }

    @Test
    public void enroll_callsListenerWithUnionPayEnrollmentIdAdded() throws JSONException {
        String response = new JSONObject()
                .put("unionPayEnrollmentId", "some-enrollment-id")
                .put("smsCodeRequired", true)
                .toString();

        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayEnabledConfiguration)
                .sendPOSTSuccessfulResponse(response)
                .build();

        when(unionPayCard.buildEnrollment()).thenReturn(new JSONObject("{}"));

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.enroll(unionPayCard, unionPayEnrollCallback);

        ArgumentCaptor<UnionPayEnrollment> resultCaptor = ArgumentCaptor.forClass(UnionPayEnrollment.class);
        verify(unionPayEnrollCallback).onResult(resultCaptor.capture(), (Exception) isNull());

        UnionPayEnrollment result = resultCaptor.getValue();
        assertEquals("some-enrollment-id", result.getId());
        assertTrue(result.isSmsCodeRequired());
    }

    @Test
    public void enroll_failsIfUnionPayIsDisabled() {
        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayDisabledConfiguration)
                .build();

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.enroll(unionPayCard, unionPayEnrollCallback);

        ArgumentCaptor<Exception> exceptionCaptor = ArgumentCaptor.forClass(Exception.class);
        verify(unionPayEnrollCallback).onResult((UnionPayEnrollment) isNull(), exceptionCaptor.capture());

        Exception exception = exceptionCaptor.getValue();
        assertTrue(exception instanceof ConfigurationException);
        assertEquals("UnionPay is not enabled", exception.getMessage());
    }

    @Test
    public void enroll_sendsAnalyticsEventOnFailure() throws JSONException {
        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayEnabledConfiguration)
                .sendPOSTErrorResponse(new BraintreeException())
                .build();

        when(unionPayCard.buildEnrollment()).thenReturn(new JSONObject("{}"));

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.enroll(unionPayCard, unionPayEnrollCallback);

        verify(braintreeClient).sendAnalyticsEvent("union-pay.enrollment-failed");
    }

    @Test
    public void enroll_sendsAnalyticsEventOnSuccess() throws JSONException {
        String response = new JSONObject()
                .put("unionPayEnrollmentId", "some-enrollment-id")
                .put("smsCodeRequired", true)
                .toString();

        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayEnabledConfiguration)
                .sendPOSTSuccessfulResponse(response)
                .build();

        when(unionPayCard.buildEnrollment()).thenReturn(new JSONObject("{}"));

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.enroll(unionPayCard, unionPayEnrollCallback);

        verify(braintreeClient).sendAnalyticsEvent("union-pay.enrollment-succeeded");
    }

    @Test
    public void fetchCapabilities_sendsPayloadToEndpoint() {
        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayEnabledConfiguration)
                .build();

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.fetchCapabilities(CardNumber.UNIONPAY_CREDIT, unionPayFetchCapabilitiesCallback);

        String expectedUrl = Uri.parse("/v1/payment_methods/credit_cards/capabilities")
                .buildUpon()
                .appendQueryParameter("creditCard[number]", CardNumber.UNIONPAY_CREDIT)
                .build()
                .toString();

        verify(braintreeClient).sendGET(eq(expectedUrl), any(HttpResponseCallback.class));
    }

    @Test
    public void fetchCapabilities_callsListenerWithErrorOnFailure() {
        Exception error = new Exception("error");
        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayEnabledConfiguration)
                .sendGETErrorResponse(error)
                .build();

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.fetchCapabilities(CardNumber.UNIONPAY_CREDIT, unionPayFetchCapabilitiesCallback);

        verify(unionPayFetchCapabilitiesCallback).onResult((UnionPayCapabilities) isNull(), same(error));
    }

    @Test
    public void fetchCapabilities_sendsAnalyticsEventOnFailure() {
        Exception error = new Exception("error");
        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayEnabledConfiguration)
                .sendGETErrorResponse(error)
                .build();

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.fetchCapabilities(CardNumber.UNIONPAY_CREDIT, unionPayFetchCapabilitiesCallback);

        verify(braintreeClient).sendAnalyticsEvent("union-pay.capabilities-failed");
    }

    @Test
    public void fetchCapabilities_callsListenerWithCapabilitiesOnSuccess() {
        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayEnabledConfiguration)
                .sendGETSuccessfulResponse(Fixtures.UNIONPAY_CAPABILITIES_SUCCESS_RESPONSE)
                .build();

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.fetchCapabilities(CardNumber.UNIONPAY_CREDIT, unionPayFetchCapabilitiesCallback);

        ArgumentCaptor<UnionPayCapabilities> capabilitiesCaptor = ArgumentCaptor.forClass(UnionPayCapabilities.class);
        verify(unionPayFetchCapabilitiesCallback).onResult(capabilitiesCaptor.capture(), (Exception) isNull());

        UnionPayCapabilities capabilities = capabilitiesCaptor.getValue();
        assertNotNull(capabilities);
        assertTrue(capabilities.isUnionPay());
        assertFalse(capabilities.isDebit());
        assertTrue(capabilities.supportsTwoStepAuthAndCapture());
        assertTrue(capabilities.isSupported());
    }

    @Test
    public void fetchCapabilities_sendsAnalyticsEventOnSuccess() {
        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayEnabledConfiguration)
                .sendGETSuccessfulResponse(Fixtures.UNIONPAY_CAPABILITIES_SUCCESS_RESPONSE)
                .build();

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.fetchCapabilities(CardNumber.UNIONPAY_CREDIT, unionPayFetchCapabilitiesCallback);

        verify(braintreeClient).sendAnalyticsEvent("union-pay.capabilities-received");
    }

    @Test
    public void fetchCapabilities_failsIfUnionPayIsDisabled() {
        BraintreeClient braintreeClient = new MockBraintreeClientBuilder()
                .configuration(unionPayDisabledConfiguration)
                .build();

        UnionPayClient sut = new UnionPayClient(braintreeClient, apiClient);
        sut.fetchCapabilities(CardNumber.UNIONPAY_CREDIT, unionPayFetchCapabilitiesCallback);

        ArgumentCaptor<Exception> captor = ArgumentCaptor.forClass(Exception.class);
        verify(unionPayFetchCapabilitiesCallback).onResult((UnionPayCapabilities) isNull(), captor.capture());

        Exception exception = captor.getValue();
        assertTrue(exception instanceof ConfigurationException);
        assertEquals("UnionPay is not enabled", exception.getMessage());
    }
}


text:
package opennlp.tools.util.featuregen;

import java.util.List;
import java.util.regex.Pattern;

/**
 * Generates features for different for the class of the token.
 *
 * @deprecated Use {@link TokenClassFeatureGenerator} instead!
 */
@Deprecated
public class FastTokenClassFeatureGenerator extends FeatureGeneratorAdapter {

  private static final String TOKEN_CLASS_PREFIX = "wc";
  private static final String TOKEN_AND_CLASS_PREFIX = "w&c";

  private static Pattern capPeriod;

  static {
    capPeriod = Pattern.compile("^[A-Z]\\.$");
  }

  private boolean generateWordAndClassFeature;

  public FastTokenClassFeatureGenerator() {
    this(false);
  }

  public FastTokenClassFeatureGenerator(boolean genearteWordAndClassFeature) {
    this.generateWordAndClassFeature = genearteWordAndClassFeature;
  }

  public static String tokenFeature(String token) {

    StringPattern pattern = StringPattern.recognize(token);

    String feat;
    if (pattern.isAllLowerCaseLetter()) {
      feat = "lc";
    }
    else if (pattern.digits() == 2) {
      feat = "2d";
    }
    else if (pattern.digits() == 4) {
      feat = "4d";
    }
    else if (pattern.containsDigit()) {
      if (pattern.containsLetters()) {
        feat = "an";
      }
      else if (pattern.containsHyphen()) {
        feat = "dd";
      }
      else if (pattern.containsSlash()) {
        feat = "ds";
      }
      else if (pattern.containsComma()) {
        feat = "dc";
      }
      else if (pattern.containsPeriod()) {
        feat = "dp";
      }
      else {
        feat = "num";
      }
    }
    else if (pattern.isAllCapitalLetter() && token.length() == 1) {
      feat = "sc";
    }
    else if (pattern.isAllCapitalLetter()) {
      feat = "ac";
    }
    else if (capPeriod.matcher(token).find()) {
      feat = "cp";
    }
    else if (pattern.isInitialCapitalLetter()) {
      feat = "ic";
    }
    else {
      feat = "other";
    }

    return (feat);
  }

  public void createFeatures(List<String> features, String[] tokens, int index, String[] preds) {
    String wordClass = tokenFeature(tokens[index]);
    features.add(TOKEN_CLASS_PREFIX + "=" + wordClass);

    if (generateWordAndClassFeature) {
      features.add(TOKEN_AND_CLASS_PREFIX + "=" + tokens[index].toLowerCase()+","+wordClass);
    }
  }
}


text:
package org.sakaiproject.authz.impl;

import static org.junit.Assert.fail;

import org.junit.BeforeClass;
import org.junit.Test;
import org.sakaiproject.authz.api.SecurityAdvisor;
import org.sakaiproject.exception.IllegalSecurityAdvisorException;
import org.sakaiproject.authz.api.SecurityService;
import org.sakaiproject.test.SakaiKernelTestBase;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class AdvisorTest extends SakaiKernelTestBase {
	@BeforeClass
	public static void beforeClass() {
		try {
			log.debug("starting oneTimeSetup");
			oneTimeSetup();
			log.debug("finished oneTimeSetup");
		} catch (Exception e) {
			log.warn(e.getMessage(), e);
		}
	}

	@Test
	public void testAdvisorOrder() throws Exception {
		SecurityService securityService = (SecurityService) getService(SecurityService.class);

		SecurityAdvisor siteUpdAdvisor = new SecurityAdvisor() {
			public SecurityAdvice isAllowed(String userId, String function, String reference) {
				if (function.equals("site.upd") && reference.equals("/site/mercury")) {
					return SecurityAdvice.ALLOWED;
				}
				else {
					return SecurityAdvice.PASS;
				}
			}
		};

		SecurityAdvisor passAllAdvisor = new SecurityAdvisor() {
			public SecurityAdvice isAllowed(String userId, String function, String reference) {
				return SecurityAdvice.ALLOWED;
			}
		};

		// Push one advisor at a time
		securityService.pushAdvisor(passAllAdvisor);
		SecurityAdvisor sa2 = securityService.popAdvisor(passAllAdvisor);

		securityService.pushAdvisor(siteUpdAdvisor);
		SecurityAdvisor sa1 = securityService.popAdvisor(siteUpdAdvisor);

		if (!sa1.equals(siteUpdAdvisor)) {
			fail("The siteUpdAdvisor was not popped");
		}
		if (!sa2.equals(passAllAdvisor)) {
			fail("The siteUpdAdvisor was not popped");
		}

		// Push two advisors and then pop in correct LIFO order
		securityService.pushAdvisor(passAllAdvisor);
		securityService.pushAdvisor(siteUpdAdvisor);

		SecurityAdvisor sa3 = securityService.popAdvisor(siteUpdAdvisor);
		SecurityAdvisor sa4 = securityService.popAdvisor(passAllAdvisor);

		if (!sa3.equals(siteUpdAdvisor)) {
			fail("The siteUpdAdvisor was not popped");
		}
		if (!sa4.equals(passAllAdvisor)) {
			fail("The siteUpdAdvisor was not popped");
		}

		// Push two advisors and then try to pop in wrong order
		securityService.pushAdvisor(passAllAdvisor);
		securityService.pushAdvisor(siteUpdAdvisor);

		try {
			securityService.popAdvisor(passAllAdvisor);
			securityService.popAdvisor(siteUpdAdvisor);
		} catch (IllegalSecurityAdvisorException e) {
			// Out of order advisors should result in a destroyed stack and an exception
		}
		catch (Exception e) {
			fail("Wrong type of exception thrown");
		}
	}
}


text:
#ifndef __ACTIONS_CCACTION_H__
#define __ACTIONS_CCACTION_H__

#include "cocoa/CCObject.h"
#include "cocoa/CCGeometry.h"
#include "platform/CCPlatformMacros.h"

NS_CC_BEGIN

enum {
    //! Default tag
    kCCActionTagInvalid = -1,
};

/**
 * @addtogroup actions
 * @{
 */

/**
@brief Base class for CCAction objects.
 */
class CC_DLL CCAction : public CCObject
{
public:
    CCAction(void);
    virtual ~CCAction(void);

    const char* description();

    virtual CCObject* copyWithZone(CCZone *pZone);

    //! return true if the action has finished
    virtual bool isDone(void);

    //! called before the action start. It will also set the target.
    virtual void startWithTarget(CCNode *pTarget);

    /**
    called after the action has finished. It will set the 'target' to nil.
    IMPORTANT: You should never call "[action stop]" manually. Instead, use: "target->stopAction(action);"
    */
    virtual void stop(void);

    //! called every frame with it's delta time. DON'T override unless you know what you are doing.
    virtual void step(float dt);

    /**
    called once per frame. time a value between 0 and 1

    For example:
    - 0 means that the action just started
    - 0.5 means that the action is in the middle
    - 1 means that the action is over
    */
    virtual void update(float time);

    inline CCNode* getTarget(void) { return m_pTarget; }
    /** The action will modify the target properties. */
    inline void setTarget(CCNode *pTarget) { m_pTarget = pTarget; }

    inline CCNode* getOriginalTarget(void) { return m_pOriginalTarget; }
    /** Set the original target, since target can be nil.
    Is the target that were used to run the action. Unless you are doing something complex, like CCActionManager, you should NOT call this method.
    The target is 'assigned', it is not 'retained'.
    @since v0.8.2
    */
    inline void setOriginalTarget(CCNode *pOriginalTarget) { m_pOriginalTarget = pOriginalTarget; }

    inline int getTag(void) { return m_nTag; }
    inline void setTag(int nTag) { m_nTag = nTag; }

public:
    /** Create an action */
    static CCAction* create();
protected:
    CCNode    *m_pOriginalTarget;
    /** The "target".
    The target will be set with the 'startWithTarget' method.
    When the 'stop' method is called, target will be set to nil.
    The target is 'assigned', it is not 'retained'.
    */
    CCNode    *m_pTarget;
    /** The action tag. An identifier of the action */
    int     m_nTag;
};

/**
@brief
 Base class actions that do have a finite time duration.
 Possible actions:
   - An action with a duration of 0 seconds
   - An action with a duration of 35.5 seconds

 Infinite time actions are valid
 */
class CC_DLL CCFiniteTimeAction : public CCAction
{
public:
    CCFiniteTimeAction()
        : m_fDuration(0)
    {}
    virtual ~CCFiniteTimeAction(){}
    //! get duration in seconds of the action
    inline float getDuration(void) { return m_fDuration; }
    //! set duration in seconds of the action
    inline void setDuration(float duration) { m_fDuration = duration; }

    /** returns a reversed action */
    virtual CCFiniteTimeAction* reverse(void);
protected:
    //! duration in seconds
    float m_fDuration;
};

class CCActionInterval;
class CCRepeatForever;

/**
 @brief Changes the speed of an action, making it take longer (speed>1)
 or less (speed<1) time.
 Useful to simulate 'slow motion' or 'fast forward' effect.
 @warning This action can't be Sequenceable because it is not an CCIntervalAction
 */
class CC_DLL CCSpeed : public CCAction
{
public:
    CCSpeed()
        : m_fSpeed(0.0)
        , m_pInnerAction(NULL)
    {}
    virtual ~CCSpeed(void);

    inline float getSpeed(void) { return m_fSpeed; }
    /** alter the speed of the inner function in runtime */
    inline void setSpeed(float fSpeed) { m_fSpeed = fSpeed; }

    /** initializes the action */
    bool initWithAction(CCActionInterval *pAction, float fSpeed);

    virtual CCObject* copyWithZone(CCZone *pZone);
    virtual void startWithTarget(CCNode* pTarget);
    virtual void stop();
    virtual void step(float dt);
    virtual bool isDone(void);
    virtual CCActionInterval* reverse(void);

    void setInnerAction(CCActionInterval *pAction);

    inline CCActionInterval* getInnerAction()
    {
        return m_pInnerAction;
    }

public:
    /** create the action */
    static CCSpeed* create(CCActionInterval* pAction, float fSpeed);
protected:
    float m_fSpeed;
    CCActionInterval *m_pInnerAction;
};

/**
@brief CCFollow is an action that "follows" a node.

Eg:
layer->runAction(CCFollow::actionWithTarget(hero));

Instead of using CCCamera as a "follower", use this action instead.
@since v0.99.2
*/
class CC_DLL CCFollow : public CCAction
{
public:
    CCFollow()
        : m_pobFollowedNode(NULL)
        , m_bBoundarySet(false)
        , m_bBoundaryFullyCovered(false)
        , m_fLeftBoundary(0.0)
        , m_fRightBoundary(0.0)
        , m_fTopBoundary(0.0)
        , m_fBottomBoundary(0.0)
    {}
    virtual ~CCFollow(void);

    inline bool isBoundarySet(void) { return m_bBoundarySet; }
    /** alter behavior - turn on/off boundary */
    inline void setBoudarySet(bool bValue) { m_bBoundarySet = bValue; }

    /** initializes the action with a set boundary */
    bool initWithTarget(CCNode *pFollowedNode, const CCRect& rect = CCRectZero);

    virtual CCObject* copyWithZone(CCZone *pZone);
    virtual void step(float dt);
    virtual bool isDone(void);
    virtual void stop(void);

public:
    /** creates the action with a set boundary,
    It will work with no boundary if @param rect is equal to CCRectZero.
    */
    static CCFollow* create(CCNode *pFollowedNode, const CCRect& rect = CCRectZero);
protected:
    // node to follow
    CCNode *m_pobFollowedNode;

    // whether camera should be limited to certain area
    bool m_bBoundarySet;

    // if screen size is bigger than the boundary - update not needed
    bool m_bBoundaryFullyCovered;

    // fast access to the screen dimensions
    CCPoint m_obHalfScreenSize;
    CCPoint m_obFullScreenSize;

    // world boundaries
    float m_fLeftBoundary;
    float m_fRightBoundary;
    float m_fTopBoundary;
    float m_fBottomBoundary;
};

// end of actions group
/// @}

NS_CC_END

#endif // __ACTIONS_CCACTION_H__


text:
import '../xvg';
import '!style-loader!css-loader!tachyons';


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

<TITLE>
Uses of Interface org.hibernate.Session (Hibernate API Documentation)
</TITLE>

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

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
org.hibernate.Session

Packages that use Session

org.hibernate

	This package defines the central Hibernate APIs.

org.hibernate.classic

	This package implements backward-compatibility with Hibernate 2.1
	APIs now deprecated in Hibernate3.

org.hibernate.context

org.hibernate.criterion

	A framework for defining restriction criteria and order criteria.

org.hibernate.event

	This package defines an event framework for Hibernate.

org.hibernate.impl

	This package contains implementations of the
	central Hibernate APIs, especially the
	Hibernate session.

Uses of Session in org.hibernate

Methods in org.hibernate that return Session

 Session
Session.getSession(EntityMode entityMode)

          Starts a new Session with the given entity mode in effect.

Uses of Session in org.hibernate.classic

Subinterfaces of Session in org.hibernate.classic

 interface
Session

          An extension of the <tt>Session</tt> API, including all
 deprecated methods from Hibernate2.

Methods in org.hibernate.classic with parameters of type Session

 boolean
Lifecycle.onSave(Session s)

          Called when an entity is saved.

 boolean
Lifecycle.onUpdate(Session s)

          Called when an entity is passed to <tt>Session.update()</tt>.

 boolean
Lifecycle.onDelete(Session s)

          Called when an entity is deleted.

 void
Lifecycle.onLoad(Session s,
       Serializable id)

          Called after an entity is loaded.

Uses of Session in org.hibernate.context

Methods in org.hibernate.context with parameters of type Session

static void
ThreadLocalSessionContext.bind(Session session)

          Associates the given session with the current thread of execution.

Uses of Session in org.hibernate.criterion

Methods in org.hibernate.criterion with parameters of type Session

 Criteria
DetachedCriteria.getExecutableCriteria(Session session)

          Get an executable instance of <literal>Criteria</literal>,
 to actually run the query.

Uses of Session in org.hibernate.event

Subinterfaces of Session in org.hibernate.event

 interface
EventSource

Uses of Session in org.hibernate.impl

Classes in org.hibernate.impl that implement Session

 class
SessionImpl

          Concrete implementation of a Session, and also the central, organizing component
 of Hibernate's internal implementation.

Methods in org.hibernate.impl that return Session

 Session
SessionImpl.getSession(EntityMode entityMode)

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes


text:
set -e

mkdir -p /var/local/git
git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc

# copy service account keys if available
cp -r /var/local/jenkins/service_account $HOME || true

cd /var/local/git/grpc
nvm use 0.12
nvm alias default 0.12  # prevent the need to run 'nvm use' in every shell

make install-certs

# build Node interop client & server
npm install -g node-gyp
npm install --unsafe-perm --build-from-source


text:
package org.jabref.logic.help;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

import org.junit.Test;

import static junit.framework.TestCase.assertEquals;

public class HelpFileTest {
    private final String jabrefHelp = "https://help.jabref.org/en/";
    @Test
    public void referToValidPage() throws IOException {
        for (HelpFile help : HelpFile.values()) {
            URL url = new URL(jabrefHelp + help.getPageName());
            HttpURLConnection http = (HttpURLConnection) url.openConnection();
            http.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64)");
            assertEquals(200, http.getResponseCode());
        }
    }
}


text:
"use strict";

// function doubleAll(numbers) {
//   	var result = []
//   	for (var i = 0; i < numbers.length; i++) {
//     	result.push(numbers[i] * 2)
//   	}
//   	return result
// }

function doubleAll(numbers) {
	return numbers.map(i => i * 2);
}

module.exports = doubleAll


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>shared</artifactId>
        <groupId>org.glassfish.javaeetutorial</groupId>
        <version>7.0.4-SNAPSHOT</version>
    </parent>

    <groupId>org.glassfish.javaeetutorial</groupId>
    <artifactId>sharedconsumer</artifactId>
    <packaging>app-client</packaging>

    <name>sharedconsumer</name>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-acr-plugin</artifactId>
                <version>1.0</version>
                <extensions>true</extensions>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>javaeetutorial.sharedconsumer.SharedConsumer</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
import * as path from 'path'
import * as Promise from 'bluebird'
import * as fileSystem from 'fs'
const fs: any = Promise.promisifyAll(fileSystem)

function makeComparisonFolder(original: string, comparison: string): Promise<any> {
    const comparisonFolder = `${path.basename(original)}_${path.basename(comparison)}_comparisons`
    const comparisonPath = path.join(process.cwd(), comparisonFolder);
    return new Promise((resolve, reject) => {
        return fs.statAsync(comparisonPath, (error: any, stat: any) => {
            if (error && error.code !== 'ENOENT') {
                // Other obscure error
                reject(error)
            } else if (error && error.code === 'ENOENT') {
                // Make directory directory doesn't exist
                return fs.mkdir(comparisonPath, (_error: any) => {
                    if (_error) {
                        reject(error)
                    }
                    resolve(comparisonPath)
                });
            } else {
                resolve(comparisonPath)
            }
        })
    })
}

export default makeComparisonFolder


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Threading.Tasks;
using System.Threading;
using Xunit;

#if USE_MDT_EVENTSOURCE
using Microsoft.Diagnostics.Tracing;
#else
using System.Diagnostics.Tracing;
#endif
using System.Text.RegularExpressions;
using System.Diagnostics;
using SdtEventSources;

namespace BasicEventSourceTests
{
    public class TestsWriteEvent
    {
#if USE_ETW
        // Specifies whether the process is elevated or not.
        private static readonly Lazy<bool> s_isElevated = new Lazy<bool>(() => AdminHelpers.IsProcessElevated());
        private static bool IsProcessElevated => s_isElevated.Value;

        /// <summary>
        /// Tests WriteEvent using the manifest based mechanism.
        /// Tests the ETW path.
        /// </summary>
        [ConditionalFact(nameof(IsProcessElevated))]
        public void Test_WriteEvent_Manifest_ETW()
        {
            using (var listener = new EtwListener())
            {
                Test_WriteEvent(listener, false);
            }
        }
#endif // USE_ETW
        /// <summary>
        /// Tests WriteEvent using the manifest based mechanism.
        /// Tests bTraceListener path.
        /// </summary>
        [Fact]
        [ActiveIssue("dotnet/corefx #18806", TargetFrameworkMonikers.NetFramework)]
        public void Test_WriteEvent_Manifest_EventListener()
        {
            using (var listener = new EventListenerListener())
            {
                Test_WriteEvent(listener, false);
            }
        }

        /// <summary>
        /// Tests WriteEvent using the manifest based mechanism.
        /// Tests bTraceListener path using events instead of virtual callbacks.
        /// </summary>
        [Fact]
        [ActiveIssue("dotnet/corefx #18806", TargetFrameworkMonikers.NetFramework)]
        public void Test_WriteEvent_Manifest_EventListener_UseEvents()
        {
            Test_WriteEvent(new EventListenerListener(true), false);
        }
#if USE_ETW
        /// <summary>
        /// Tests WriteEvent using the self-describing mechanism.
        /// Tests both the ETW and TraceListener paths.
        /// </summary>
        [ConditionalFact(nameof(IsProcessElevated))]
        public void Test_WriteEvent_SelfDescribing_ETW()
        {
            using (var listener = new EtwListener())
            {
                Test_WriteEvent(listener, true);
            }
        }
#endif
        /// <summary>
        /// Tests WriteEvent using the self-describing mechanism.
        /// Tests both the ETW and TraceListener paths.
        /// </summary>
        [Fact]
        [ActiveIssue("dotnet/corefx #18806", TargetFrameworkMonikers.NetFramework)]
        public void Test_WriteEvent_SelfDescribing_EventListener()
        {
            using (var listener = new EventListenerListener())
            {
                Test_WriteEvent(listener, true);
            }
        }

        /// <summary>
        /// Tests WriteEvent using the self-describing mechanism.
        /// Tests both the ETW and TraceListener paths using events
        /// instead of virtual callbacks.
        /// </summary>
        [Fact]
        [ActiveIssue("dotnet/corefx #18806", TargetFrameworkMonikers.NetFramework)]
        public void Test_WriteEvent_SelfDescribing_EventListener_UseEvents()
        {
            Test_WriteEvent(new EventListenerListener(true), true);
        }

        [Fact]
        public void Test_WriteEvent_NoAttribute()
        {
            using (EventSourceNoAttribute es = new EventSourceNoAttribute())
            {
                Listener el = new EventListenerListener(true);
                var tests = new List<SubTest>();
                string arg = "a sample string";

                tests.Add(new SubTest("Write/Basic/EventWith9Strings",
                delegate ()
                {
                    es.EventNoAttributes(arg);
                },
                delegate (Event evt)
                {
                    Assert.Equal(es.Name, evt.ProviderName);
                    Assert.Equal("EventNoAttributes", evt.EventName);
                    Assert.Equal(arg, (string)evt.PayloadValue(0, null));
                }));

                EventTestHarness.RunTests(tests, el, es);
            }
        }

        /// <summary>
        /// Helper method for the two tests above.
        /// </summary>
        private void Test_WriteEvent(Listener listener, bool useSelfDescribingEvents)
        {
            using (var logger = new SdtEventSources.EventSourceTest(useSelfDescribingEvents))
            {
                var tests = new List<SubTest>();

                /*************************************************************************/
                tests.Add(new SubTest("WriteEvent/Basic/EventII",
                    delegate () { logger.EventII(10, 11); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventII", evt.EventName);
                        Assert.Equal(evt.PayloadValue(0, "arg1"), 10);
                        Assert.Equal(evt.PayloadValue(1, "arg2"), 11);
                    }));
                /*************************************************************************/
                tests.Add(new SubTest("WriteEvent/Basic/EventSS",
                    delegate () { logger.EventSS("one", "two"); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventSS", evt.EventName);
                        Assert.Equal(evt.PayloadValue(0, "arg1"), "one");
                        Assert.Equal(evt.PayloadValue(1, "arg2"), "two");
                    }));
#if USE_ETW
                /*************************************************************************/
                if(IsProcessElevated)
                {
                    tests.Add(new SubTest("Write/Basic/EventWithManyTypeArgs",
                        delegate ()
                        {
                            logger.EventWithManyTypeArgs("Hello", 1, 2, 3, 'a', 4, 5, 6, 7,
                                                     (float)10.0, (double)11.0, logger.Guid);
                        },
                        delegate (Event evt)
                        {
                            Assert.Equal(logger.Name, evt.ProviderName);
                            Assert.Equal("EventWithManyTypeArgs", evt.EventName);
                            Assert.Equal("Hello", evt.PayloadValue(0, "msg"));
                            Assert.Equal((float)10.0, evt.PayloadValue(9, "f"));
                            Assert.Equal((double)11.0, evt.PayloadValue(10, "d"));
                            Assert.Equal(logger.Guid, evt.PayloadValue(11, "guid"));
                        }));
                }
#endif // USE_ETW
                /*************************************************************************/
                tests.Add(new SubTest("Write/Basic/EventWith7Strings",
                    delegate ()
                    {
                        logger.EventWith7Strings("s0", "s1", "s2", "s3", "s4", "s5", "s6");
                    },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventWith7Strings", evt.EventName);
                        Assert.Equal("s0", (string)evt.PayloadValue(0, "s0"));
                        Assert.Equal("s6", (string)evt.PayloadValue(6, "s6"));
                    }));
                /*************************************************************************/
                tests.Add(new SubTest("Write/Basic/EventWith9Strings",
                    delegate ()
                    {
                        logger.EventWith9Strings("s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8");
                    },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventWith9Strings", evt.EventName);
                        Assert.Equal("s0", (string)evt.PayloadValue(0, "s0"));
                        Assert.Equal("s8", (string)evt.PayloadValue(8, "s8"));
                    }));
#if USE_ETW
                /*************************************************************************/
                if(IsProcessElevated)
                {
                    tests.Add(new SubTest("Write/Activity/EventWithXferWeirdArgs",
                        delegate ()
                        {
                            var actid = Guid.NewGuid();
                            logger.EventWithXferWeirdArgs(actid,
                                (IntPtr)128,
                                true,
                                SdtEventSources.MyLongEnum.LongVal1);
                        },
                        delegate (Event evt)
                        {
                            Assert.Equal(logger.Name, evt.ProviderName);

                            // We log EventWithXferWeirdArgs in one case and
                            // WorkWeirdArgs/Send in the other
                            Assert.True(evt.EventName.Contains("WeirdArgs"));

                            Assert.Equal("128", evt.PayloadValue(0, "iptr").ToString());
                            Assert.Equal(true, (bool)evt.PayloadValue(1, "b"));
                            Assert.Equal((long)SdtEventSources.MyLongEnum.LongVal1, ((IConvertible)evt.PayloadValue(2, "le")).ToInt64(null));
                        }));
                }
#endif // USE_ETW
                /*************************************************************************/
                /*************************** ENUM TESTING *******************************/
                /*************************************************************************/

                /*************************************************************************/
                tests.Add(new SubTest("WriteEvent/Enum/EventEnum",
                    delegate ()
                    {
                        logger.EventEnum(SdtEventSources.MyColor.Blue);
                    },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventEnum", evt.EventName);

                        Assert.Equal(1, ((IConvertible)evt.PayloadValue(0, "x")).ToInt32(null));
                        if (evt.IsEtw && !useSelfDescribingEvents)
                            Assert.Equal("Blue", evt.PayloadString(0, "x"));
                    }));

                tests.Add(new SubTest("WriteEvent/Enum/EventEnum1",
                   delegate ()
                   {
                       logger.EventEnum1(SdtEventSources.MyColor.Blue);
                   },
                   delegate (Event evt)
                   {
                       Assert.Equal(logger.Name, evt.ProviderName);
                       Assert.Equal("EventEnum1", evt.EventName);

                       Assert.Equal(1, ((IConvertible)evt.PayloadValue(0, "x")).ToInt32(null));
                       if (evt.IsEtw && !useSelfDescribingEvents)
                           Assert.Equal("Blue", evt.PayloadString(0, "x"));
                   }));

                tests.Add(new SubTest("WriteEvent/Basic/EventWithIntIntString",
                    delegate () { logger.EventWithIntIntString(10, 11, "test"); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventWithIntIntString", evt.EventName);
                        Assert.Equal(evt.PayloadValue(0, "i1"), 10);
                        Assert.Equal(evt.PayloadValue(1, "i2"), 11);
                        Assert.Equal(evt.PayloadValue(2, "str"), "test");
                    }));

                tests.Add(new SubTest("WriteEvent/Basic/EventWithIntLongString",
                    delegate () { logger.EventWithIntLongString(10, (long)11, "test"); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventWithIntLongString", evt.EventName);
                        Assert.Equal(evt.PayloadValue(0, "i1"), 10);
                        Assert.Equal(evt.PayloadValue(1, "l1"), (long)11);
                        Assert.Equal(evt.PayloadValue(2, "str"), "test");
                    }));

                tests.Add(new SubTest("WriteEvent/Basic/EventWithString",
                    delegate () { logger.EventWithString(null); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal(1, evt.PayloadCount);
                        Assert.Equal("", evt.PayloadValue(0, null));
                    }));

                tests.Add(new SubTest("WriteEvent/Basic/EventWithIntAndString",
                    delegate () { logger.EventWithIntAndString(12, null); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal(2, evt.PayloadCount);
                        Assert.Equal(12, evt.PayloadValue(0, null));
                        Assert.Equal("", evt.PayloadValue(1, null));
                    }));

                tests.Add(new SubTest("WriteEvent/Basic/EventWithLongAndString",
                    delegate () { logger.EventWithLongAndString(120L, null); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal(2, evt.PayloadCount);
                        Assert.Equal(120L, evt.PayloadValue(0, null));
                        Assert.Equal("", evt.PayloadValue(1, null));
                    }));

                tests.Add(new SubTest("WriteEvent/Basic/EventWithStringAndInt",
                    delegate () { logger.EventWithStringAndInt(null, 12); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal(2, evt.PayloadCount);
                        Assert.Equal("", evt.PayloadValue(0, null));
                        Assert.Equal(12, evt.PayloadValue(1, null));
                    }));

                tests.Add(new SubTest("WriteEvent/Basic/EventWithStringAndIntAndInt",
                    delegate () { logger.EventWithStringAndIntAndInt(null, 12, 13); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal(3, evt.PayloadCount);
                        Assert.Equal("", evt.PayloadValue(0, null));
                        Assert.Equal(12, evt.PayloadValue(1, null));
                        Assert.Equal(13, evt.PayloadValue(2, null));
                    }));

                tests.Add(new SubTest("WriteEvent/Basic/EventWithStringAndLong",
                    delegate () { logger.EventWithStringAndLong(null, 120L); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal(2, evt.PayloadCount);
                        Assert.Equal("", evt.PayloadValue(0, null));
                        Assert.Equal(120L, evt.PayloadValue(1, null));
                    }));

                tests.Add(new SubTest("WriteEvent/Basic/EventWithStringAndString",
                    delegate () { logger.EventWithStringAndString(null, null); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal(2, evt.PayloadCount);
                        Assert.Equal("", evt.PayloadValue(0, null));
                        Assert.Equal("", evt.PayloadValue(1, null));
                    }));

                tests.Add(new SubTest("WriteEvent/Basic/EventWithStringAndStringAndString",
                    delegate () { logger.EventWithStringAndStringAndString(null, null, null); },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal(3, evt.PayloadCount);
                        Assert.Equal("", evt.PayloadValue(0, null));
                        Assert.Equal("", evt.PayloadValue(1, null));
                        Assert.Equal("", evt.PayloadValue(2, null));
                    }));

                // Self-describing ETW does not support NULL arguments.
                if (useSelfDescribingEvents
#if USE_ETW
                    && !(listener is EtwListener)
#endif // USE_ETW
                   )
                {
                    tests.Add(new SubTest("WriteEvent/Basic/EventVarArgsWithString",
                        delegate () { logger.EventVarArgsWithString(1, 2, 12, null); },
                        delegate (Event evt)
                        {
                            Assert.Equal(logger.Name, evt.ProviderName);
                            Assert.Equal(4, evt.PayloadCount);
                            Assert.Equal(1, evt.PayloadValue(0, null));
                            Assert.Equal(2, evt.PayloadValue(1, null));
                            Assert.Equal(12, evt.PayloadValue(2, null));
                            Assert.Equal("", evt.PayloadValue(3, null));
                        }));
                }

                // Probably belongs in the user TestUsersErrors.cs.
                if (!useSelfDescribingEvents)
                {
                    tests.Add(new SubTest("WriteEvent/Basic/EventWithIncorrectNumberOfParameters",
                        delegate ()
                        {
                            logger.EventWithIncorrectNumberOfParameters("TestMessage", "TestPath", 10);
                        },
                        delegate (List<Event> evts)
                        {
                            Assert.True(0 < evts.Count);

                            // We give an error message in EventListener case but not the ETW case.
                            if (1 < evts.Count)
                            {
                                Assert.Equal(2, evts.Count);
                                Assert.Equal(logger.Name, evts[0].ProviderName);
                                Assert.Equal("EventSourceMessage", evts[0].EventName);
                                string errorMsg = evts[0].PayloadString(0, "message");
                                Assert.True(Regex.IsMatch(errorMsg, "called with 1.*defined with 3"));
                            }

                            int eventIdx = evts.Count - 1;
                            Assert.Equal(logger.Name, evts[eventIdx].ProviderName);
                            Assert.Equal("EventWithIncorrectNumberOfParameters", evts[eventIdx].EventName);
                            Assert.Equal("{TestPath:10}TestMessage", evts[eventIdx].PayloadString(0, "message"));
                        }));
                }

                // If you only wish to run one or several of the tests you can filter them here by
                // Uncommenting the following line.
                // tests = tests.FindAll(test => Regex.IsMatch(test.Name, "ventWithByteArray"));

                // Next run the same tests with the TraceLogging path.
                EventTestHarness.RunTests(tests, listener, logger);
            }
        }

        /**********************************************************************/
        /// <summary>
        /// Tests sending complex data (class, arrays etc) from WriteEvent
        /// Tests the EventListener case
        /// </summary>
        [Fact]
        public void Test_WriteEvent_ComplexData_SelfDescribing_EventListener()
        {
            using (var listener = new EventListenerListener())
            {
                Test_WriteEvent_ComplexData_SelfDescribing(listener);
            }
        }

#if USE_ETW
        /// <summary>
        /// Tests sending complex data (class, arrays etc) from WriteEvent
        /// Tests the EventListener case
        /// </summary>
        [ConditionalFact(nameof(IsProcessElevated))]
        public void Test_WriteEvent_ComplexData_SelfDescribing_ETW()
        {
            using (var listener = new EtwListener())
            {
                Test_WriteEvent_ComplexData_SelfDescribing(listener);
            }
        }
#endif // USE_ETW

        private void Test_WriteEvent_ComplexData_SelfDescribing(Listener listener)
        {
            using (var logger = new EventSourceTestSelfDescribingOnly())
            {
                var tests = new List<SubTest>();

                byte[] byteArray = { 0, 1, 2, 3 };
                tests.Add(new SubTest("WriteEvent/SelfDescribingOnly/Byte[]",
                    delegate ()
                    {
                        logger.EventByteArrayInt(byteArray, 5);
                    },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventByteArrayInt", evt.EventName);

                        var eventArray = evt.PayloadValue(0, "array");
                        Array.Equals(eventArray, byteArray);
                        Assert.Equal(5, evt.PayloadValue(1, "anInt"));
                    }));

                tests.Add(new SubTest("WriteEvent/SelfDescribingOnly/UserData",
                    delegate ()
                    {
                        logger.EventUserDataInt(new UserData() { x = 3, y = 8 }, 5);
                    },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventUserDataInt", evt.EventName);

                        var aClass = (IDictionary<string, object>)evt.PayloadValue(0, "aClass");
                        Assert.Equal(3, (int)aClass["x"]);
                        Assert.Equal(8, (int)aClass["y"]);
                        Assert.Equal(5, evt.PayloadValue(1, "anInt"));
                    }));

                // If you only wish to run one or several of the tests you can filter them here by
                // Uncommenting the following line.
                // tests = tests.FindAll(test => Regex.IsMatch(test.Name, "ventWithByteArray"));

                // Next run the same tests with the TraceLogging path.
                EventTestHarness.RunTests(tests, listener, logger);
            }
        }

        /**********************************************************************/
        /// <summary>
        /// Tests sending complex data (class, arrays etc) from WriteEvent
        /// Uses Manifest format
        /// Tests the EventListener case
        /// </summary>
        [Fact]
        public void Test_WriteEvent_ByteArray_Manifest_EventListener()
        {
            using (var listener = new EventListenerListener())
            {
                Test_WriteEvent_ByteArray(false, listener);
            }
        }

        /// <summary>
        /// Tests sending complex data (class, arrays etc) from WriteEvent
        /// Uses Manifest format
        /// Tests the EventListener case using events instead of virtual
        /// callbacks.
        /// </summary>
        [Fact]
        public void Test_WriteEvent_ByteArray_Manifest_EventListener_UseEvents()
        {
            Test_WriteEvent_ByteArray(false, new EventListenerListener(true));
        }

#if USE_ETW
        /// <summary>
        /// Tests sending complex data (class, arrays etc) from WriteEvent
        /// Uses Manifest format
        /// Tests the EventListener case
        /// </summary>
        [ConditionalFact(nameof(IsProcessElevated))]
        public void Test_WriteEvent_ByteArray_Manifest_ETW()
        {
            using (var listener = new EtwListener())
            {
                Test_WriteEvent_ByteArray(false, listener);
            }
        }
#endif // USE_ETW

        /// <summary>
        /// Tests sending complex data (class, arrays etc) from WriteEvent
        /// Uses Self-Describing format
        /// Tests the EventListener case
        /// </summary>
        [Fact]
        public void Test_WriteEvent_ByteArray_SelfDescribing_EventListener()
        {
            using (var listener = new EventListenerListener())
            {
                Test_WriteEvent_ByteArray(true, listener);
            }
        }

#if USE_ETW
        /// <summary>
        /// Tests sending complex data (class, arrays etc) from WriteEvent
        /// Uses Self-Describing format
        /// Tests the EventListener case
        /// </summary>
        [ConditionalFact(nameof(IsProcessElevated))]
        public void Test_WriteEvent_ByteArray_SelfDescribing_ETW()
        {
            using (var listener = new EtwListener())
            {
                Test_WriteEvent_ByteArray(true, listener);
            }
        }
#endif // USE_ETW

        private void Test_WriteEvent_ByteArray(bool useSelfDescribingEvents, Listener listener)
        {
            EventSourceSettings settings = EventSourceSettings.EtwManifestEventFormat;
            if (useSelfDescribingEvents)
                settings = EventSourceSettings.EtwSelfDescribingEventFormat;

            using (var logger = new EventSourceTestByteArray(settings))
            {
                var tests = new List<SubTest>();
                /*************************************************************************/
                /**************************** byte[] TESTING *****************************/
                /*************************************************************************/
                // We only support arrays of any type with the SelfDescribing case.
                /*************************************************************************/
                byte[] blob = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
                tests.Add(new SubTest("Write/Array/EventWithByteArrayArg",
                    delegate ()
                    {
                        logger.EventWithByteArrayArg(blob, 1000);
                    },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventWithByteArrayArg", evt.EventName);

                        if (evt.IsEventListener)
                        {
                            byte[] retBlob = (byte[])evt.PayloadValue(0, "blob");
                            Assert.NotNull(retBlob);
                            Assert.True(Equal(blob, retBlob));
                            Assert.Equal(1000, (int)evt.PayloadValue(1, "n"));
                        }
                    }));

                if (!useSelfDescribingEvents)
                {
                    /*************************************************************************/
                    tests.Add(new SubTest("Write/Array/NonEventCallingEventWithBytePtrArg",
                        delegate ()
                        {
                            logger.NonEventCallingEventWithBytePtrArg(blob, 2, 4, 1001);
                        },
                        delegate (Event evt)
                        {
                            Assert.Equal(logger.Name, evt.ProviderName);
                            Assert.Equal("EventWithBytePtrArg", evt.EventName);

                            if (evt.IsEtw)
                            {
                                Assert.Equal(2, evt.PayloadCount);
                                byte[] retBlob = (byte[])evt.PayloadValue(0, "blob");
                                Assert.Equal(4, retBlob.Length);
                                Assert.Equal(retBlob[0], blob[2]);
                                Assert.Equal(retBlob[3], blob[2 + 3]);
                                Assert.Equal(1001, (int)evt.PayloadValue(1, "n"));
                            }
                            else
                            {
                                Assert.Equal(3, evt.PayloadCount);
                                byte[] retBlob = (byte[])evt.PayloadValue(1, "blob");
                                Assert.Equal(1001, (int)evt.PayloadValue(2, "n"));
                            }
                        }));
                }

                tests.Add(new SubTest("Write/Array/EventWithLongByteArray",
                    delegate ()
                    {
                        logger.EventWithLongByteArray(blob, 1000);
                    },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventWithLongByteArray", evt.EventName);

                        Assert.Equal(2, evt.PayloadCount);
                        byte[] retBlob = (byte[])evt.PayloadValue(0, "blob");
                        Assert.True(Equal(blob, retBlob));

                        Assert.Equal(1000, (long)evt.PayloadValue(1, "lng"));
                    }));

                /* TODO: NULL byte array does not seem to be supported.
                 * An EventSourceMessage event is written for this case.
                tests.Add(new SubTest("Write/Array/EventWithNullByteArray",
                    delegate ()
                    {
                        logger.EventWithByteArrayArg(null, 0);
                    },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventWithByteArrayArg", evt.EventName);

                        if (evt.IsEventListener)
                        {
                            byte[] retBlob = (byte[])evt.PayloadValue(0, "blob");
                            Assert.Null(retBlob);
                            Assert.Equal(0, (int)evt.PayloadValue(1, "n"));
                        }
                    }));
                */

                tests.Add(new SubTest("Write/Array/EventWithEmptyByteArray",
                    delegate ()
                    {
                        logger.EventWithByteArrayArg(Array.Empty<byte>(), 0);
                    },
                    delegate (Event evt)
                    {
                        Assert.Equal(logger.Name, evt.ProviderName);
                        Assert.Equal("EventWithByteArrayArg", evt.EventName);

                        Assert.Equal(2, evt.PayloadCount);
                        byte[] retBlob = (byte[])evt.PayloadValue(0, "blob");
                        Assert.True(Equal(Array.Empty<byte>(), retBlob));

                        Assert.Equal(0, (int)evt.PayloadValue(1, "n"));
                    }));

                // If you only wish to run one or several of the tests you can filter them here by
                // Uncommenting the following line.
                // tests = tests.FindAll(test => Regex.IsMatch(test.Name, "ventWithByteArray"));

                // Next run the same tests with the TraceLogging path.
                EventTestHarness.RunTests(tests, listener, logger);
            }
        }

        /**********************************************************************/
        // Helper that compares two arrays for equality.
        private static bool Equal(byte[] blob1, byte[] blob2)
        {
            if (blob1.Length != blob2.Length)
                return false;
            for (int i = 0; i < blob1.Length; i++)
                if (blob1[i] != blob2[i])
                    return false;
            return true;
        }
    }

    [EventData]
    public class UserData
    {
        public int x { get; set; }
        public int y { get; set; }
    }

    /// <summary>
    /// Used to show the more complex data type that
    /// </summary>
    public sealed class EventSourceTestSelfDescribingOnly : EventSource
    {
        public EventSourceTestSelfDescribingOnly() : base(EventSourceSettings.EtwSelfDescribingEventFormat) { }
        public void EventByteArrayInt(byte[] array, int anInt) { WriteEvent(1, array, anInt); }
        public void EventUserDataInt(UserData aClass, int anInt) { WriteEvent(2, aClass, anInt); }
    }

    public sealed class EventSourceTestByteArray : EventSource
    {
        public EventSourceTestByteArray(EventSourceSettings settings) : base(settings) { }
        // byte[] args not supported on 4.5
        [Event(1, Level = EventLevel.Informational, Message = "Int arg after byte array: {1}")]
        public void EventWithByteArrayArg(byte[] blob, int n)
        { WriteEvent(1, blob, n); }

        [NonEvent]
        public unsafe void NonEventCallingEventWithBytePtrArg(byte[] blob, int start, uint size, int n)
        {
            if (blob == null || start + size > blob.Length)
                throw new ArgumentException("start + size must be smaller than blob.Length");
            fixed (byte* p = blob)
                EventWithBytePtrArg(size, p + start, n);
        }

        [Event(2, Level = EventLevel.Informational, Message = "Int arg after byte ptr: {2}")]
        public unsafe void EventWithBytePtrArg(uint blobSize, byte* blob, int n)
        {
            if (IsEnabled())
            {
                {
                    EventSource.EventData* descrs = stackalloc EventSource.EventData[3];
                    descrs[0].DataPointer = (IntPtr)(&blobSize);
                    descrs[0].Size = 4;
                    descrs[1].DataPointer = (IntPtr)blob;
                    descrs[1].Size = (int)blobSize;
                    descrs[2].Size = 4;
                    descrs[2].DataPointer = (IntPtr)(&n);
                    WriteEventCore(2, 3, descrs);
                }
            }
        }
        [Event(3, Level = EventLevel.Informational, Message = "long after byte array: {1}")]
        public void EventWithLongByteArray(byte[] blob, long lng)
        { WriteEvent(3, blob, lng); }
    }
}


text:
import SummaryPage from '../../summary.page'

class HouseholdCompositionSummary extends SummaryPage {

  clickAddAnother() {
    browser.click('[name="household-composition-add-another"][value="No"]')
    return this
  }

  submit() {
    browser.click('.qa-btn-submit')
    return this
  }

  isNameDisplayed(name) {
    return browser.element('#further-section ul li').getText() === name
  }

  getElementTextForAnswer(answer) {
    var householdNames = []
    var elements = browser.elements('#further-section ul li')

    elements.value.forEach((elem) => {
      householdNames.push(browser.elementIdText(elem.ELEMENT).value)
    })
    return householdNames
  }
}

export default new HouseholdCompositionSummary()


text:
(function() {
  'use strict';
  var app = angular.module('app', [
    'ui.router',
    'ui.bootstrap',
    'appmap',
    'ngAnimate'
  ]);

  app.config(function($compileProvider) {
    //tell angular to allow 'chrome-extension' urls
    var currentImgSrcSanitizationWhitelist = $compileProvider.imgSrcSanitizationWhitelist();
    var newImgSrcSanitizationWhiteList = currentImgSrcSanitizationWhitelist.toString().slice(0, -1) +
      '|chrome-extension:' +
      currentImgSrcSanitizationWhitelist.toString().slice(-1);

    $compileProvider.imgSrcSanitizationWhitelist(newImgSrcSanitizationWhiteList);
  });

})();


text:
package mil.nga.giat.geowave.vector.adapter;

import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.type.AttributeDescriptor;

import mil.nga.giat.geowave.index.ByteArrayId;
import mil.nga.giat.geowave.store.TimeUtils;
import mil.nga.giat.geowave.store.adapter.IndexFieldHandler;
import mil.nga.giat.geowave.store.data.PersistentValue;
import mil.nga.giat.geowave.store.data.field.FieldVisibilityHandler;
import mil.nga.giat.geowave.store.dimension.Time;
import mil.nga.giat.geowave.store.dimension.Time.Timestamp;

/**
 * This class handles the internal responsibility of persisting single timestamp
 * instants based on a temporal attribute (a Java binding class of Date or
 * Calendar for an attribute)to and from a GeoWave common index field for
 * SimpleFeature data.
 *
 */
public class FeatureTimestampHandler implements
		IndexFieldHandler<SimpleFeature, Time, Object>
{
	private final FeatureAttributeHandler nativeTimestampHandler;
	private final FieldVisibilityHandler<SimpleFeature, Object> visibilityHandler;

	public FeatureTimestampHandler(
			AttributeDescriptor timestampAttrDesc ) {
		this(
				timestampAttrDesc,
				null);
	}

	public FeatureTimestampHandler(
			AttributeDescriptor timestampAttrDesc,
			FieldVisibilityHandler<SimpleFeature, Object> visibilityHandler ) {
		this.nativeTimestampHandler = new FeatureAttributeHandler(
				timestampAttrDesc);
		this.visibilityHandler = visibilityHandler;
	}

	@Override
	public ByteArrayId[] getNativeFieldIds() {
		return new ByteArrayId[] {
			nativeTimestampHandler.getFieldId()
		};
	}

	@Override
	public Time toIndexValue(
			SimpleFeature row ) {
		Object object = nativeTimestampHandler.getFieldValue(row);
		byte[] visibility;
		if (visibilityHandler != null) {
			visibility = visibilityHandler.getVisibility(
					row,
					nativeTimestampHandler.getFieldId(),
					object);
		}
		else {
			visibility = new byte[] {};
		}
		return new Timestamp(
				TimeUtils.getTimeMillis(object),
				visibility);
	}

	@SuppressWarnings("unchecked")
	@Override
	public PersistentValue<Object>[] toNativeValues(
			Time indexValue ) {
		Class<?> bindingClass = nativeTimestampHandler.attrDesc.getType().getBinding();
		Object obj = TimeUtils.getTimeValue(
				bindingClass,
				(long) indexValue.toNumericData().getCentroid());
		return new PersistentValue[] {
			new PersistentValue<Object>(
					nativeTimestampHandler.getFieldId(),
					obj)
		};
	}
}