text:
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")

class Admin::Images2IntegrationTest < ActionController::IntegrationTest
  def test_index
    Image.destroy_all
    @image = Image.create!(
      :image_file_name => '123.jpg', :image_content_type => 'image/jpeg',
      :image_file_size => '456'
    )
    @path = "/images/#{@image.id}/original/123.jpg"
    get "/admin/images2"
    assert_response :success

    # should show the image in-line as an <img> tag
    assert_select("img[src=?]", @path)

    # should not show the image path on its own as a value
    assert_no_match(%r|<td[^>]*>#{@path}</td>|, response.body)

    # should show path text field
    assert_select('input[value=?]', "http://www.example.com#{@path}")

    # should not show an edit link since we can only create or index
    assert_select(
      'a[href=?]', "/admin/images2/edit/#{@image.id}", false
    )

    # should have a new link
    assert_select(
      "a[href=/admin/images2/new]", 'New image'
    )
  end
end


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

  <servlet>
    <servlet-name>FigServlet</servlet-name>
    <servlet-class>fig.servlet.FigServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>FigServlet</servlet-name>
    <url-pattern>/Fig</url-pattern>
  </servlet-mapping>

  <security-constraint>
    <web-resource-collection>
      <url-pattern>/Fig</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>fig-user</role-name>
    </auth-constraint>
  </security-constraint>

  <login-config>
    <auth-method>BASIC</auth-method>
  </login-config>

  <security-role>
    <role-name>fig-user</role-name>
  </security-role>

  <!-- Important: Add the following lines to conf/tomcat-users.xml
  <user username="YOUR_USERNAME" password="YOUR_PASSWORD" roles="fig-user"/>
  -->
</web-app>

redpajama_set_name: RedPajamaGithub


text:
[![](https://jitpack.io/v/AleksanderMielczarek/BindingSnackbar.svg)](https://jitpack.io/#AleksanderMielczarek/BindingSnackbar)

# BindingSnackbar

Library simplifying usage of Snackbar with [Android Data Binding](http://developer.android.com/tools/data-binding/guide.html).

## Usage

Add it in your root build.gradle at the end of repositories:

```groovy
allprojects {
	repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}
```

Add the dependency

```groovy
dependencies {
    compile 'com.github.AleksanderMielczarek:BindingSnackbar:0.1.2'
}
```

## Example

```java
public class MainViewModel {

    public final ObservableBindingSnackbar snackbar = new ObservableBindingSnackbar();

    public View.OnClickListener getShowSnackbar() {
        return new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                BindingSnackbar.builder("BindingSnackbar", Snackbar.LENGTH_SHORT)
                        .build()
                        .show(snackbar);
            }
        };
    }
```

```xml
<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:snackbar="@{viewModel.snackbar}" />
```

Yoy can use builder to specify snackbar settings.

```java
BindingSnackbar snackbar = BindingSnackbar.builder("BindingSnackbar", Snackbar.LENGTH_SHORT)
        .setAction("BindingSnackbarAction", new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //do some snackbar action
            }
        })
        .addSnackbarSettingsSetter(new SnackbarSettingsSetter() {
            @Override
            public void setSettings(Snackbar snackbar) {
                //do sth with snackbar
            }
        })
        .build();
```

It can be also used standalone without databinding.

```java
View view = findViewById(R.id.myView);
BindingSnackbar.builder("BindingSnackbar", Snackbar.LENGTH_SHORT)
        .build()
        .show(view);
```

## Changelog

### 0.1.2 (2016-09-14)

- update SDK

### 0.1.1 (2016-06-04)

- add dismiss method

## License

    Copyright 2016 Aleksander Mielczarek

    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.


text:
#include "includes.h"

static
VOID
VmKdcStopSrvThreads(
    VOID);

static
VOID
VmKdcCleanupGlobals(
    PVMKDC_GLOBALS pGlobals);

/*
 * Server shutdown
 */
VOID
VmKdcShutdown(
    VOID)
{
    PVMKDC_GLOBALS pGlobals = &gVmkdcGlobals;
#if 0
    VmKdcRpcServerShutdown();
#endif

    // Free gVmkdcGlobals.pSrvThrInfo
    VmKdcStopSrvThreads();

    /* Synchronize with KDC thread it is really gone */
    pthread_mutex_lock(&pGlobals->mutex);
    while (pGlobals->vmkdcdState == VMKDC_STOPPING)
    {
        pthread_cond_wait(&pGlobals->stateCond,
                          &pGlobals->mutex);
    }
    pthread_mutex_unlock(&pGlobals->mutex);

#ifndef _WIN32
    VmKdcSrvCloseSocketAcceptFd();
#endif

    VmKdcTerminateDirectory(&gVmkdcGlobals);

    VmKdcDestroyKrb5(gVmkdcGlobals.pKrb5Ctx);

    VmKdcCleanupGlobals(&gVmkdcGlobals);
}

static
VOID
VmKdcStopSrvThreads(
    VOID)
{
#if 0
    PVMKDC_THREAD_INFO   pThrInfo = NULL;

    pthread_mutex_lock(&gVmkdcGlobals.mutex);

    pThrInfo = gVmkdcGlobals.pSrvThrInfo;

    pthread_mutex_unlock(&gVmkdcGlobals.mutex);

    // do shutdown outside lock as mutex is used for other resources too
    while (pThrInfo)
    {
        PVMKDC_THREAD_INFO pNext = pThrInfo->pNext;

        VmKdcSrvThrShutdown(pThrInfo); // this free pThrInfo
        pThrInfo = pNext;
    }
#endif

    return;
}

static
VOID
VmKdcCleanupGlobals(
    PVMKDC_GLOBALS pGlobals
    )
{
    // Free Server global 'gVmkdcServerGlobals' upon shutdown
    pthread_mutex_destroy(&pGlobals->mutex);
// Adam: TBD VmKdcFreeAbsoluteSecurityDescriptor(&gVmkdcGlobals.gpVmKdcSrvSD);
}


text:
package com.navercorp.pinpoint.web.controller;

import com.navercorp.pinpoint.thrift.dto.TResult;
import com.navercorp.pinpoint.thrift.dto.command.TActiveThreadDump;
import com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump;
import com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDump;
import com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDumpRes;
import com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDump;
import com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDumpRes;
import com.navercorp.pinpoint.thrift.dto.command.TRouteResult;
import com.navercorp.pinpoint.thrift.io.DeserializerFactory;
import com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer;
import com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializer;
import com.navercorp.pinpoint.thrift.io.SerializerFactory;
import com.navercorp.pinpoint.web.cluster.PinpointRouteResponse;
import com.navercorp.pinpoint.web.config.ConfigProperties;
import com.navercorp.pinpoint.web.service.AgentService;
import com.navercorp.pinpoint.web.vo.AgentActiveThreadDump;
import com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpFactory;
import com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpList;
import com.navercorp.pinpoint.web.vo.AgentInfo;
import org.apache.thrift.TBase;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Taejin Koo
 */
@Controller
@RequestMapping("/agent")
public class AgentCommandController {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private SerializerFactory<HeaderTBaseSerializer> commandSerializerFactory;

    @Autowired
    private DeserializerFactory<HeaderTBaseDeserializer> commandDeserializerFactory;

    @Autowired
    private AgentService agentService;

    @Autowired
    private ConfigProperties webProperties;

    @RequestMapping(value = "/activeThreadDump", method = RequestMethod.GET)
    public ModelAndView getActiveThreadDump(@RequestParam(value = "applicationName") String applicationName,
                                            @RequestParam(value = "agentId") String agentId,
                                            @RequestParam(value = "limit", required = false, defaultValue = "-1") int limit,
                                            @RequestParam(value = "threadName", required = false) String[] threadNameList,
                                            @RequestParam(value = "localTraceId", required = false) Long[] localTraceIdList) throws TException {
        if (!webProperties.isEnableActiveThreadDump()) {
            return createResponse(false, "Disable activeThreadDump option. 'config.enable.activeThreadDump=false'");
        }

        AgentInfo agentInfo = agentService.getAgentInfo(applicationName, agentId);
        if (agentInfo == null) {
            return createResponse(false, String.format("Can't find suitable Agent(%s/%s)", applicationName, agentId));
        }

        TCmdActiveThreadDump threadDump = new TCmdActiveThreadDump();
        if (limit > 0) {
            threadDump.setLimit(limit);
        }

        if (threadNameList != null) {
            threadDump.setThreadNameList(Arrays.asList(threadNameList));
        }
        if (localTraceIdList != null) {
            threadDump.setLocalTraceIdList(Arrays.asList(localTraceIdList));
        }

        try {
            PinpointRouteResponse pinpointRouteResponse = agentService.invoke(agentInfo, threadDump);
            if (pinpointRouteResponse != null && pinpointRouteResponse.getRouteResult() == TRouteResult.OK) {
                TBase<?, ?> result = pinpointRouteResponse.getResponse();
                if (result instanceof TCmdActiveThreadDumpRes) {
                    TCmdActiveThreadDumpRes activeThreadDumpResponse = (TCmdActiveThreadDumpRes) result;

                    AgentActiveThreadDumpList activeThreadDumpList = new AgentActiveThreadDumpList(activeThreadDumpResponse.getThreadDumpsSize());
                    List<TActiveThreadDump> activeThreadDumps = activeThreadDumpResponse.getThreadDumps();
                    if (activeThreadDumps != null) {
                        AgentActiveThreadDumpFactory factory = new AgentActiveThreadDumpFactory();
                        for (TActiveThreadDump activeThreadDump : activeThreadDumps) {
                            try {
                                AgentActiveThreadDump agentActiveThreadDump = factory.create(activeThreadDump);
                                activeThreadDumpList.add(agentActiveThreadDump);
                            } catch (Exception e) {
                                logger.warn("create AgentActiveThreadDump fail. arguments(TActiveThreadDump:{})", activeThreadDump);
                            }
                        }
                    }

                    Map<String, Object> response =new HashMap<>(3);
                    response.put("threadDumpData", activeThreadDumpList);
                    response.put("type", activeThreadDumpResponse.getType());
                    response.put("subType", activeThreadDumpResponse.getSubType());
                    response.put("version", activeThreadDumpResponse.getVersion());

                    return createResponse(true, response);
                } else {
                    return handleFailedResponse(result);
                }
            } else {
                return createResponse(false, "unknown");
            }
        } catch (TException e) {
            return createResponse(false, e.getMessage());
        }
    }

    @RequestMapping(value = "/activeThreadLightDump", method = RequestMethod.GET)
    public ModelAndView getActiveThreadLightDump(@RequestParam(value = "applicationName") String applicationName,
                                            @RequestParam(value = "agentId") String agentId,
                                            @RequestParam(value = "limit", required = false, defaultValue = "-1") int limit,
                                            @RequestParam(value = "threadName", required = false) String[] threadNameList,
                                            @RequestParam(value = "localTraceId", required = false) Long[] localTraceIdList) throws TException {
        if (!webProperties.isEnableActiveThreadDump()) {
            return createResponse(false, "Disable activeThreadDump option. 'config.enable.activeThreadDump=false'");
        }

        AgentInfo agentInfo = agentService.getAgentInfo(applicationName, agentId);
        if (agentInfo == null) {
            return createResponse(false, String.format("Can't find suitable Agent(%s/%s)", applicationName, agentId));
        }

        TCmdActiveThreadLightDump threadDump = new TCmdActiveThreadLightDump();
        if (limit > 0) {
            threadDump.setLimit(limit);
        }
        if (threadNameList != null) {
            threadDump.setThreadNameList(Arrays.asList(threadNameList));
        }
        if (localTraceIdList != null) {
            threadDump.setLocalTraceIdList(Arrays.asList(localTraceIdList));
        }

        try {
            PinpointRouteResponse pinpointRouteResponse = agentService.invoke(agentInfo, threadDump);
            if (pinpointRouteResponse != null && pinpointRouteResponse.getRouteResult() == TRouteResult.OK) {
                TBase<?, ?> result = pinpointRouteResponse.getResponse();
                if (result instanceof TCmdActiveThreadLightDumpRes) {
                    TCmdActiveThreadLightDumpRes activeThreadDumpResponse = (TCmdActiveThreadLightDumpRes) result;

                    AgentActiveThreadDumpList activeThreadDumpList = new AgentActiveThreadDumpList(activeThreadDumpResponse.getThreadDumpsSize());
                    List<TActiveThreadLightDump> activeThreadDumps = activeThreadDumpResponse.getThreadDumps();
                    if (activeThreadDumps != null) {
                        AgentActiveThreadDumpFactory factory = new AgentActiveThreadDumpFactory();
                        for (TActiveThreadLightDump activeThreadDump : activeThreadDumps) {
                            try {
                                AgentActiveThreadDump agentActiveThreadDump = factory.create(activeThreadDump);
                                activeThreadDumpList.add(agentActiveThreadDump);
                            } catch (Exception e) {
                                logger.warn("create AgentActiveThreadDump fail. arguments(TActiveThreadDump:{})", activeThreadDump);
                            }
                        }
                    }

                    Map<String, Object> response =new HashMap<>(3);
                    response.put("threadDumpData", activeThreadDumpList);
                    response.put("type", activeThreadDumpResponse.getType());
                    response.put("subType", activeThreadDumpResponse.getSubType());
                    response.put("version", activeThreadDumpResponse.getVersion());

                    return createResponse(true, response);
                } else {
                    return handleFailedResponse(result);
                }
            } else {
                return createResponse(false, "unknown");
            }
        } catch (TException e) {
            return createResponse(false, e.getMessage());
        }
    }

    private ModelAndView handleFailedResponse(TBase<?, ?> failedResponse) {
        if (failedResponse == null) {
            return createResponse(false, "result null");
        } else if (failedResponse instanceof TResult) {
            return createResponse(false, ((TResult) failedResponse).getMessage());
        } else {
            return createResponse(false, failedResponse.toString());
        }
    }

    private ModelAndView createResponse(boolean success, Object message) {
        ModelAndView mv = new ModelAndView();
        mv.setViewName("jsonView");

        if (success) {
            mv.addObject("code", 0);
        } else {
            mv.addObject("code", -1);
        }

        mv.addObject("message", message);

        return mv;
    }

}


text:
package org.apache.calcite.linq4j.tree;

import java.util.Objects;

/**
 * Used to represent the target of a {@link GotoStatement}.
 */
public class LabelTarget {
  public final String name;

  public LabelTarget(String name) {
    this.name = name;
  }

  @Override public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    LabelTarget that = (LabelTarget) o;

    if (name != null ? !name.equals(that.name) : that.name != null) {
      return false;
    }

    return true;
  }

  @Override public int hashCode() {
    return Objects.hashCode(name);
  }
}

// End LabelTarget.java


text:
package com.github.mobile.ui.project;

import android.app.Activity;
import android.content.res.Resources;
import android.view.View;

import com.github.kevinsawicki.wishlist.SingleTypeAdapter;
import com.github.mobile.R;
import com.github.mobile.api.model.ProjectCard;
import com.github.mobile.util.TimeUtils;
import com.github.mobile.util.TypefaceUtils;

/**
 * Adapter to display a list of {@link ProjectCard} objects
 */
public class ProjectCardsListAdapter extends SingleTypeAdapter<ProjectCard> {

    private final String updateText;

    private final int colorIconClosed;
    private final int colorIconOpen;
    private final int colorIconDefault;

    /**
     * Create {@link ProjectCard} list adapter
     *
     * @param activity
     * @param elements
     */
    public ProjectCardsListAdapter(Activity activity, ProjectCard[] elements) {
        super(activity.getLayoutInflater(), R.layout.project_card_item);

        updateText = activity.getString(R.string.updated);

        Resources resources = activity.getResources();

        colorIconClosed = resources.getColor(R.color.issue_event_red);
        colorIconOpen = resources.getColor(R.color.issue_event_green);
        colorIconDefault = resources.getColor(R.color.text_icon);

        setItems(elements);
    }

    @Override
    protected int[] getChildViewIds() {
        return new int[] { R.id.tv_type_icon, R.id.tv_title, R.id.tv_update_date };
    }

    @Override
    protected View initialize(View view) {
        view = super.initialize(view);

        TypefaceUtils.setOcticons(textView(view, 0));
        return view;
    }

    @Override
    protected void update(int position, ProjectCard card) {
        if (card.issue != null) {
            if (card.issue.closed_at == null) {
                textView(0).setTextColor(colorIconOpen);
                setText(0, TypefaceUtils.ICON_ISSUE_OPENED);
            } else {
                textView(0).setTextColor(colorIconClosed);
                setText(0, TypefaceUtils.ICON_ISSUE_CLOSED);
            }
            setText(1, card.issue.title);
        } else {
            textView(0).setTextColor(colorIconDefault);
            setText(0, TypefaceUtils.ICON_BOOK);
            setText(1, card.note);
        }
        setText(2, String.format(updateText, TimeUtils.getRelativeTime(card.updated_at)));
    }
}


text:
package apps.sling.test.htl.java;

import java.util.Date;

public class Bean {
    public String getStatic() {
        return "from-java-use-bean";
    }
}


text:
'''Instant Actions

Instant Actions
===============

Instant actions are immediate actions. They don't have a duration like
the Interval Actions.

'''

from __future__ import division, print_function, unicode_literals

__docformat__ = 'restructuredtext'

import copy
from .base_actions import *

__all__ = [
            'Place',                            # placement action
            'CallFunc','CallFuncS',             # Calls a function
            'Hide','Show','ToggleVisibility',   # Visibility actions
            ]

class Place( InstantAction ):
    """Place the `CocosNode` object in the position x,y.

    Example::

        action = Place( (320,240) )
        sprite.do( action )
    """
    def init(self, position):
        """Init method.

        :Parameters:
            `position` : (x,y)
                Coordinates where the sprite will be placed
        """
        self.position = position

    def start(self):
        self.target.position = self.position

class Hide( InstantAction ):
    """Hides the `CocosNode` object. To show it again call the `Show` () action

    Example::

        action = Hide()
        sprite.do( action )
    """
    def start(self):
        self.target.visible = False

    def __reversed__(self):
        return Show()

class Show( InstantAction ):
    """Shows the `CocosNode` object. To hide it call the `Hide` () action

    Example::

        action = Show()
        sprite.do( action )
    """
    def start(self):
        self.target.visible = True

    def __reversed__(self):
        return Hide()

class ToggleVisibility( InstantAction ):
    """Toggles the visible attribute of a `CocosNode` object

    Example::

        action = ToggleVisibility()
        sprite.do( action )
    """
    def start(self):
        self.target.visible = not self.target.visible

    def __reversed__(self):
        return self

class CallFunc(InstantAction):
    """An action that will call a function.

    Example::

        def my_func():
            print "hello baby"

        action = CallFunc( my_func )
        sprite.do( action )
    """
    def init(self, func, *args, **kwargs):
        self.func = func
        self.args = args
        self.kwargs = kwargs

    def start(self):
        self.func(*self.args, **self.kwargs)

    def __deepcopy__(self, memo):
        return copy.copy( self )

    def __reversed__(self):
        return self

class CallFuncS(CallFunc):
    """An action that will call a funtion with the target as the first argument

    Example::

        def my_func( sprite ):
            print "hello baby"

        action = CallFuncS( my_func )
        sprite.do( action )
        """
    def start(self):
        self.func( self.target, *self.args, **self.kwargs)


text:
require 'spec_helper'

describe Affilinet::Search do
  subject { Affilinet::Search.new double('Affilinet::Client') }

  describe '#all' do
    it 'correctly queries the client' do
      expect(subject.client).to receive(:get).with('SearchProducts', {'query' => 'jeans'})
      subject.query('jeans').all
    end
  end
end


text:
import Vue from 'vue'
import Router from 'vue-router'
import ShowUsers from '@/components/ShowUsers'
import Profile from '@/components/Profile'
import CreateUser from '@/components/CreateUser'
import UpdateUser from '@/components/UpdateUser'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: ShowUsers
    },
    {
      path: '/create',
      name: 'Create',
      component: CreateUser

    },
    {
      path: '/user/:id',
      name: 'Profile',
      component: Profile
    },
    {
      path: '/update/:id',
      name: 'Update',
      component: UpdateUser
    }
  ]
})


text:
#import "JRCaptureTypes.h"

@protocol JRCaptureDelegate;

@interface JREngageWrapper : NSObject

+ (void)configureEngageWithAppId:(NSString *)appId customIdentityProviders:(NSDictionary *)customProviders;

+ (void)reconfigureEngageWithNewAppId:(NSString *)appId;

+ (void)startAuthenticationDialogWithTraditionalSignIn:(JRTraditionalSignInType)nativeSignInType
                           andCustomInterfaceOverrides:(NSDictionary *)customInterfaceOverrides
                                           forDelegate:(id <JRCaptureDelegate>)delegate;

+ (void)startAuthenticationDialogOnProvider:(NSString *)provider
               withCustomInterfaceOverrides:(NSDictionary *)customInterfaceOverrides
                                 mergeToken:(NSString *)mergeToken
                                forDelegate:(id <JRCaptureDelegate>)delegate;

+ (void)startAuthenticationWithProviderToken:(NSString *)provider
                                  withToken:(NSString *)token
                             andTokenSecret:(NSString *)tokenSecret
               withCustomInterfaceOverrides:(NSDictionary *)customInterfaceOverrides
                                 mergeToken:(NSString *)mergeToken
                                forDelegate:(id <JRCaptureDelegate>)delegate;

+ (id)getDelegate;
+ (void)startAuthenticationDialogWithTraditionalSignIn:(JRTraditionalSignInType)nativeSignInType
                           andCustomInterfaceOverrides:(NSDictionary *)customInterfaceOverrides
                                           forDelegate:(id <JRCaptureDelegate>)delegate
                                     forAccountLinking:(BOOL)linkAccount
                                       withRedirectUri:(NSString *)redirectUri;

+ (void)performCommonAuthenticationForTraditionalSignIn:(JRTraditionalSignInType)nativeSignInType
                            andCustomInterfaceOverrides:(NSDictionary *)customInterfaceOverrides
                                            forDelegate:(id <JRCaptureDelegate>)delegate
                                        withRedirectUri:(NSString *)redirectUri
                                      forAccountLinking:(BOOL)linkAccount;
@end


text:
<?php

namespace Panza\Library\Executor;

use Panza\Library\BranchMapping;
use Panza\Library\Bridge\Fs\IssueRepository;
use Panza\Library\Event\MergeEvent;
use Panza\Library\Event\MergeCycleEvent;
use Symfony\Component\Filesystem\Filesystem;

/**
 * Class MergeExecutorTest
 * @package Panza\Library\Executor
 * @todo test this class using blackbox, stop testing it aka whitebox.
 */
final class MergeExecutorTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    private $codeRepository;

    /**
     * @var IssueRepository
     */
    private $issueRepository;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    private $dispatcher;

    /**
     * {@inheritdoc}
     */
    public function setUp()
    {
        $filesystem = new Filesystem();
        $this->codeRepository = $this->getMock('\Panza\Library\CodeRepository');
        $path = BUILD_DIR . '/issue-repository';
        $filesystem->mkdir($path);
        $this->issueRepository = new IssueRepository($path);
        $issue = $this->issueRepository->create('TST-1', 'Test issue');
        $issue->set('mappings', array(
            array('name' => 'first mapping', 'skipCycle' => true),
            array('name' => 'second mapping', 'skipCycle' => false), // only this should be processed
        ));
        $this->dispatcher = $this->getMock('\Symfony\Component\EventDispatcher\EventDispatcher');
    }

    /**
     * Tests method execute() triggers MergeEvent first.
     *
     * @expectedException \DomainException
     * @expectedExceptionMessage Event failed
     */
    public function testExecuteTriggersMergeBeforeEventFirst()
    {
        // Given
        $self = $this;
        $codeRepository = $this->codeRepository;
        $this->dispatcher->expects($this->once())
            ->method('dispatch')
            ->with($this->equalTo('merge.main.before'))
            ->will($this->returnCallback(function ($name, MergeEvent $event) use ($self, $codeRepository) {
                $self->assertEquals('merge.main.before', $name);
                $self->assertSame($codeRepository, $event->getCodeRepository());
                $self->assertEquals('TST-1', $event->getIssue()->getId());
                throw new \DomainException('Event failed');
            }));
        $executor = new MergeExecutor($this->codeRepository, $this->issueRepository, $this->dispatcher);

        // When
        $executor->execute('TST-1');

        // Then
        // @see expectedException
    }

    /**
     * Tests execute() iterates all the branch mappings, running merge() properly.
     */
    public function testExecuteIteratesThroughBranchMappings()
    {
        // Given
        $self = $this;
        $codeRepository = $this->codeRepository;
        $this->dispatcher->expects($this->at(1))
            ->method('dispatch')
            ->with($this->equalTo('merge.cycle.before'))
            ->will($this->returnCallback(function ($name, MergeCycleEvent $event) use ($self, $codeRepository) {
                $self->assertEquals('merge.cycle.before', $name);
                $self->assertSame($codeRepository, $event->getCodeRepository());
                $self->assertEquals('TST-1', $event->getIssue()->getId());
                $self->assertEquals('second mapping', $event->getBranchMapping()->getName());
            }));
        $this->dispatcher->expects($this->at(2))
            ->method('dispatch')
            ->with($this->equalTo('merge.cycle.after'))
            ->will($this->returnCallback(function ($name, MergeCycleEvent $event) use ($self, $codeRepository) {
                $self->assertEquals('merge.cycle.after', $name);
                $self->assertSame($codeRepository, $event->getCodeRepository());
                $self->assertEquals('TST-1', $event->getIssue()->getId());
                $self->assertEquals('second mapping', $event->getBranchMapping()->getName());
            }));
        $this->codeRepository->expects($this->at(0))
            ->method('init');
        $this->codeRepository->expects($this->at(1))
            ->method('merge')
            ->with($this->callback(function (BranchMapping $mapping) use ($self) {
                return 'first mapping' == $mapping->getName();
            }));
        $this->codeRepository->expects($this->at(2))
            ->method('merge')
            ->with($this->callback(function (BranchMapping $mapping) use ($self) {
                return 'second mapping' == $mapping->getName();
            }));
        $this->codeRepository->expects($this->at(3))
            ->method('cleanup');
        $executor = new MergeExecutor($this->codeRepository, $this->issueRepository, $this->dispatcher);

        // When
        $executor->execute('TST-1');

        // Then
        // @see expects()
    }

    /**
     * Tests execute() triggers after merge event before publish.
     */
    public function testExecuteTriggersAfterMergeEventBeforePublish()
    {
        // Given
        $this->issueRepository->get('TST-1')->set('mappings', array());
        $self = $this;
        $codeRepository = $this->codeRepository;
        $this->dispatcher->expects($this->at(1))
            ->method('dispatch')
            ->with($this->equalTo('merge.main.after'))
            ->will($this->returnCallback(function ($name, MergeEvent $event) use ($self, $codeRepository) {
                $self->assertEquals('merge.main.after', $name);
                $self->assertEquals('TST-1', $event->getIssue()->getId());
                $self->assertSame($codeRepository, $event->getCodeRepository());
            }));
        $executor = new MergeExecutor($this->codeRepository, $this->issueRepository, $this->dispatcher);

        // When
        $executor->execute('TST-1');

        // Then

    }

    /**
     * Tests execute() triggers event in the case of merge exception.
     * @expectedException \DomainException
     * @expectedExceptionMessage Merge failed
     * @todo is not finished
     */
    public function testExecuteTriggersEventOnExceptionInMerge()
    {
        // Given
        $this->codeRepository->expects($this->once())
            ->method('merge')
            ->will($this->throwException(new \DomainException('Merge failed')));
        $this->codeRepository->expects($this->once())
            ->method('cleanup');
//        $self = $this;
//        $codeRepository = $this->codeRepository;
//        $this->dispatcher->expects($this->at(2))
//            ->method('dispatch')
//            ->with($this->equalTo('merge.exception'))
//            ->will($this->returnCallback(function ($name, MergeExceptionEvent $event) use ($self, $mappings, $codeRepository) {
//                $self->assertEquals('merge.exception', $name);
//                $self->assertSame($codeRepository, $event->getCodeRepository());
//                $self->assertEquals('TST-1', $event->getIssue()->getId());
//                $self->assertSame($mappings[0], $event->getBranchMapping());
//            }));
        $executor = new MergeExecutor($this->codeRepository, $this->issueRepository, $this->dispatcher);

        // When
        $executor->execute('TST-1');

        // Then
        // @see expectedException and expects()
    }
}


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.

#nullable disable

using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Remote.Testing;
using Microsoft.CodeAnalysis.Serialization;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.UnitTests;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.Remote.UnitTests
{
    [UseExportProvider]
    public class SnapshotSerializationTests
    {
        private static Workspace CreateWorkspace(Type[] additionalParts = null)
            => new AdhocWorkspace(FeaturesTestCompositions.Features.AddParts(additionalParts).WithTestHostParts(TestHost.OutOfProcess).GetHostServices());

        internal static Solution CreateFullSolution(Workspace workspace)
        {
            var solution = workspace.CurrentSolution;
            var languages = ImmutableHashSet.Create(LanguageNames.CSharp, LanguageNames.VisualBasic);
            var solutionOptions = solution.Workspace.Services.GetRequiredService<IOptionService>().GetSerializableOptionsSnapshot(languages);
            solution = solution.WithOptions(solutionOptions);

            var csCode = "class A { }";
            var project1 = solution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
            var document1 = project1.AddDocument("Document1", SourceText.From(csCode));

            var vbCode = "Class B\r\nEnd Class";
            var project2 = document1.Project.Solution.AddProject("Project2", "Project2.dll", LanguageNames.VisualBasic);
            var document2 = project2.AddDocument("Document2", SourceText.From(vbCode));

            solution = document2.Project.Solution.GetRequiredProject(project1.Id)
                .AddProjectReference(new ProjectReference(project2.Id, ImmutableArray.Create("test")))
                .AddMetadataReference(MetadataReference.CreateFromFile(typeof(object).Assembly.Location))
                .AddAnalyzerReference(new AnalyzerFileReference(Path.Combine(TempRoot.Root, "path1"), new TestAnalyzerAssemblyLoader()))
                .AddAdditionalDocument("Additional", SourceText.From("hello"), ImmutableArray.Create("test"), @".\Add").Project.Solution;

            return solution
                .WithAnalyzerReferences(new[] { new AnalyzerFileReference(Path.Combine(TempRoot.Root, "path2"), new TestAnalyzerAssemblyLoader()) })
                .AddAnalyzerConfigDocuments(
                ImmutableArray.Create(
                    DocumentInfo.Create(
                        DocumentId.CreateNewId(project1.Id),
                        ".editorconfig",
                        loader: TextLoader.From(TextAndVersion.Create(SourceText.From("root = true"), VersionStamp.Create())))));
        }

        [Fact]
        public async Task CreateSolutionSnapshotId_Empty()
        {
            using var workspace = CreateWorkspace();
            var solution = workspace.CurrentSolution;

            var validator = new SerializationValidator(workspace.Services);

            using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
            var checksum = scope.SolutionInfo.SolutionChecksum;
            var solutionSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, checksum, CancellationToken.None).ConfigureAwait(false);

            await validator.VerifySynchronizationObjectInServiceAsync(solutionSyncObject).ConfigureAwait(false);

            var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(checksum).ConfigureAwait(false);
            await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes).ConfigureAwait(false);
            await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet).ConfigureAwait(false);

            var projectsSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, solutionObject.Projects.Checksum, CancellationToken.None).ConfigureAwait(false);
            await validator.VerifySynchronizationObjectInServiceAsync(projectsSyncObject).ConfigureAwait(false);

            Assert.Equal(0, solutionObject.Projects.Count);
        }

        [Fact]
        public async Task CreateSolutionSnapshotId_Empty_Serialization()
        {
            using var workspace = CreateWorkspace();
            var solution = workspace.CurrentSolution;

            var validator = new SerializationValidator(workspace.Services);
            using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
            await validator.VerifySolutionStateSerializationAsync(solution, scope.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
        }

        [Fact]
        public async Task CreateSolutionSnapshotId_Project()
        {
            using var workspace = CreateWorkspace();
            var solution = workspace.CurrentSolution;
            var project = solution.AddProject("Project", "Project.dll", LanguageNames.CSharp);

            var validator = new SerializationValidator(workspace.Services);

            using var scope = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
            var checksum = scope.SolutionInfo.SolutionChecksum;
            var solutionSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, checksum, CancellationToken.None).ConfigureAwait(false);

            await validator.VerifySynchronizationObjectInServiceAsync(solutionSyncObject).ConfigureAwait(false);

            var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(checksum).ConfigureAwait(false);

            await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes);
            await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet);

            var projectSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, solutionObject.Projects.Checksum, CancellationToken.None).ConfigureAwait(false);
            await validator.VerifySynchronizationObjectInServiceAsync(projectSyncObject).ConfigureAwait(false);

            Assert.Equal(1, solutionObject.Projects.Count);
            await validator.VerifySnapshotInServiceAsync(validator.ToProjectObjects(solutionObject.Projects)[0], 0, 0, 0, 0, 0).ConfigureAwait(false);
        }

        [Fact]
        public async Task CreateSolutionSnapshotId_Project_Serialization()
        {
            using var workspace = CreateWorkspace();
            var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp);

            var validator = new SerializationValidator(workspace.Services);

            using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
            await validator.VerifySolutionStateSerializationAsync(project.Solution, snapshot.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
        }

        [Fact]
        public async Task CreateSolutionSnapshotId()
        {
            var code = "class A { }";

            using var workspace = CreateWorkspace();
            var document = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp).AddDocument("Document", SourceText.From(code));

            var validator = new SerializationValidator(workspace.Services);

            using var scope = await validator.AssetStorage.StoreAssetsAsync(document.Project.Solution, CancellationToken.None).ConfigureAwait(false);
            var syncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, scope.SolutionInfo.SolutionChecksum, CancellationToken.None).ConfigureAwait(false);
            var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(syncObject.Checksum).ConfigureAwait(false);

            await validator.VerifySynchronizationObjectInServiceAsync(syncObject).ConfigureAwait(false);
            await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes).ConfigureAwait(false);
            await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet).ConfigureAwait(false);
            await validator.VerifyChecksumInServiceAsync(solutionObject.Projects.Checksum, WellKnownSynchronizationKind.Projects).ConfigureAwait(false);

            Assert.Equal(1, solutionObject.Projects.Count);
            await validator.VerifySnapshotInServiceAsync(validator.ToProjectObjects(solutionObject.Projects)[0], 1, 0, 0, 0, 0).ConfigureAwait(false);
        }

        [Fact]
        public async Task CreateSolutionSnapshotId_Serialization()
        {
            var code = "class A { }";

            using var workspace = CreateWorkspace();
            var solution = workspace.CurrentSolution;
            var document = solution.AddProject("Project", "Project.dll", LanguageNames.CSharp).AddDocument("Document", SourceText.From(code));

            var validator = new SerializationValidator(workspace.Services);

            using var scope = await validator.AssetStorage.StoreAssetsAsync(document.Project.Solution, CancellationToken.None).ConfigureAwait(false);
            await validator.VerifySolutionStateSerializationAsync(document.Project.Solution, scope.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
        }

        [Fact]
        public async Task CreateSolutionSnapshotId_Full()
        {
            using var workspace = CreateWorkspace();
            var solution = CreateFullSolution(workspace);

            var firstProjectChecksum = await solution.GetProject(solution.ProjectIds[0]).State.GetChecksumAsync(CancellationToken.None);
            var secondProjectChecksum = await solution.GetProject(solution.ProjectIds[1]).State.GetChecksumAsync(CancellationToken.None);

            var validator = new SerializationValidator(workspace.Services);

            using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
            var syncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, scope.SolutionInfo.SolutionChecksum, CancellationToken.None).ConfigureAwait(false);
            var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(syncObject.Checksum).ConfigureAwait(false);

            await validator.VerifySynchronizationObjectInServiceAsync(syncObject).ConfigureAwait(false);
            await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes).ConfigureAwait(false);
            await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet).ConfigureAwait(false);
            await validator.VerifyChecksumInServiceAsync(solutionObject.Projects.Checksum, WellKnownSynchronizationKind.Projects).ConfigureAwait(false);

            Assert.Equal(2, solutionObject.Projects.Count);

            var projects = validator.ToProjectObjects(solutionObject.Projects);
            await validator.VerifySnapshotInServiceAsync(projects.Where(p => p.Checksum == firstProjectChecksum).First(), 1, 1, 1, 1, 1).ConfigureAwait(false);
            await validator.VerifySnapshotInServiceAsync(projects.Where(p => p.Checksum == secondProjectChecksum).First(), 1, 0, 0, 0, 0).ConfigureAwait(false);
        }

        [Fact]
        public async Task CreateSolutionSnapshotId_Full_Serialization()
        {
            using var workspace = CreateWorkspace();
            var solution = CreateFullSolution(workspace);

            var validator = new SerializationValidator(workspace.Services);

            using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
            await validator.VerifySolutionStateSerializationAsync(solution, scope.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
        }

        [Fact]
        public async Task CreateSolutionSnapshotId_Full_Asset_Serialization()
        {
            using var workspace = CreateWorkspace();
            var solution = CreateFullSolution(workspace);

            var validator = new SerializationValidator(workspace.Services);

            using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
            var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(scope.SolutionInfo.SolutionChecksum);
            await validator.VerifyAssetAsync(solutionObject).ConfigureAwait(false);
        }

        [Fact]
        public async Task CreateSolutionSnapshotId_Full_Asset_Serialization_Desktop()
        {
            using var workspace = CreateWorkspace();
            var solution = CreateFullSolution(workspace);

            var validator = new SerializationValidator(workspace.Services);

            using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
            var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(scope.SolutionInfo.SolutionChecksum);
            await validator.VerifyAssetAsync(solutionObject).ConfigureAwait(false);
        }

        [Fact]
        public async Task CreateSolutionSnapshotId_Duplicate()
        {
            using var workspace = CreateWorkspace();
            var solution = CreateFullSolution(workspace);

            // this is just data, one can hold the id outside of using statement. but
            // one can't get asset using checksum from the id.
            SolutionStateChecksums solutionId1;
            SolutionStateChecksums solutionId2;

            var validator = new SerializationValidator(workspace.Services);

            using (var scope1 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false))
            {
                solutionId1 = await validator.GetValueAsync<SolutionStateChecksums>(scope1.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
            }

            using (var scope2 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false))
            {
                solutionId2 = await validator.GetValueAsync<SolutionStateChecksums>(scope2.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
            }

            // once pinned snapshot scope is released, there is no way to get back to asset.
            // catch Exception because it will throw 2 different exception based on release or debug (ExceptionUtilities.UnexpectedValue)
            Assert.ThrowsAny<Exception>(() => validator.SolutionStateEqual(solutionId1, solutionId2));
        }

        [Fact]
        public void MetadataReference_RoundTrip_Test()
        {
            using var workspace = CreateWorkspace();

            var reference = MetadataReference.CreateFromFile(typeof(object).Assembly.Location);

            var serializer = workspace.Services.GetService<ISerializerService>();
            var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);

            var assetFromStorage = CloneAsset(serializer, assetFromFile);
            _ = CloneAsset(serializer, assetFromStorage);
        }

        [Fact]
        public async Task Workspace_RoundTrip_Test()
        {
            using var workspace = CreateWorkspace();
            var solution = CreateFullSolution(workspace);

            var validator = new SerializationValidator(workspace.Services);

            var scope1 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);

            // recover solution from given snapshot
            var recovered = await validator.GetSolutionAsync(scope1).ConfigureAwait(false);
            var solutionObject1 = await validator.GetValueAsync<SolutionStateChecksums>(scope1.SolutionInfo.SolutionChecksum).ConfigureAwait(false);

            // create new snapshot from recovered solution
            using var scope2 = await validator.AssetStorage.StoreAssetsAsync(recovered, CancellationToken.None).ConfigureAwait(false);

            // verify asset created by recovered solution is good
            var solutionObject2 = await validator.GetValueAsync<SolutionStateChecksums>(scope2.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
            await validator.VerifyAssetAsync(solutionObject2).ConfigureAwait(false);

            // verify snapshots created from original solution and recovered solution are same
            validator.SolutionStateEqual(solutionObject1, solutionObject2);

            // recover new solution from recovered solution
            var roundtrip = await validator.GetSolutionAsync(scope2).ConfigureAwait(false);

            // create new snapshot from round tripped solution
            using var scope3 = await validator.AssetStorage.StoreAssetsAsync(roundtrip, CancellationToken.None).ConfigureAwait(false);
            // verify asset created by rount trip solution is good
            var solutionObject3 = await validator.GetValueAsync<SolutionStateChecksums>(scope3.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
            await validator.VerifyAssetAsync(solutionObject3).ConfigureAwait(false);

            // verify snapshots created from original solution and round trip solution are same.
            validator.SolutionStateEqual(solutionObject2, solutionObject3);
        }

        [Fact]
        public async Task Workspace_RoundTrip_Test_Desktop()
        {
            using var workspace = CreateWorkspace();
            var solution = CreateFullSolution(workspace);

            var validator = new SerializationValidator(workspace.Services);

            var scope1 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);

            // recover solution from given snapshot
            var recovered = await validator.GetSolutionAsync(scope1).ConfigureAwait(false);
            var solutionObject1 = await validator.GetValueAsync<SolutionStateChecksums>(scope1.SolutionInfo.SolutionChecksum).ConfigureAwait(false);

            // create new snapshot from recovered solution
            using var scope2 = await validator.AssetStorage.StoreAssetsAsync(recovered, CancellationToken.None).ConfigureAwait(false);

            // verify asset created by recovered solution is good
            var solutionObject2 = await validator.GetValueAsync<SolutionStateChecksums>(scope2.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
            await validator.VerifyAssetAsync(solutionObject2).ConfigureAwait(false);

            // verify snapshots created from original solution and recovered solution are same
            validator.SolutionStateEqual(solutionObject1, solutionObject2);
            scope1.Dispose();

            // recover new solution from recovered solution
            var roundtrip = await validator.GetSolutionAsync(scope2).ConfigureAwait(false);

            // create new snapshot from round tripped solution
            using var scope3 = await validator.AssetStorage.StoreAssetsAsync(roundtrip, CancellationToken.None).ConfigureAwait(false);
            // verify asset created by rount trip solution is good
            var solutionObject3 = await validator.GetValueAsync<SolutionStateChecksums>(scope3.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
            await validator.VerifyAssetAsync(solutionObject3).ConfigureAwait(false);

            // verify snapshots created from original solution and round trip solution are same.
            validator.SolutionStateEqual(solutionObject2, solutionObject3);
        }

        [Fact]
        public async Task OptionSet_Serialization()
        {
            using var workspace = CreateWorkspace()
                .CurrentSolution.AddProject("Project1", "Project.dll", LanguageNames.CSharp)
                .Solution.AddProject("Project2", "Project2.dll", LanguageNames.VisualBasic)
                .Solution.Workspace;
            await VerifyOptionSetsAsync(workspace, _ => { }).ConfigureAwait(false);
        }

        [Fact]
        public async Task OptionSet_Serialization_CustomValue()
        {
            using var workspace = CreateWorkspace();

            var newQualifyFieldAccessValue = new CodeStyleOption2<bool>(false, NotificationOption2.Error);
            var newQualifyMethodAccessValue = new CodeStyleOption2<bool>(true, NotificationOption2.Warning);
            var newVarWhenTypeIsApparentValue = new CodeStyleOption2<bool>(false, NotificationOption2.Suggestion);
            var newPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue = new CodeStyleOption2<bool>(true, NotificationOption2.Silent);

            workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options
                                                 .WithChangedOption(CodeStyleOptions2.QualifyFieldAccess, LanguageNames.CSharp, newQualifyFieldAccessValue)
                                                 .WithChangedOption(CodeStyleOptions2.QualifyMethodAccess, LanguageNames.VisualBasic, newQualifyMethodAccessValue)
                                                 .WithChangedOption(CSharpCodeStyleOptions.VarWhenTypeIsApparent, newVarWhenTypeIsApparentValue)
                                                 .WithChangedOption(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.VisualBasic, newPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue)));

            var validator = new SerializationValidator(workspace.Services);

            await VerifyOptionSetsAsync(workspace, VerifyOptions).ConfigureAwait(false);

            void VerifyOptions(OptionSet options)
            {
                var actualQualifyFieldAccessValue = options.GetOption(CodeStyleOptions2.QualifyFieldAccess, LanguageNames.CSharp);
                Assert.Equal(newQualifyFieldAccessValue, actualQualifyFieldAccessValue);

                var actualQualifyMethodAccessValue = options.GetOption(CodeStyleOptions2.QualifyMethodAccess, LanguageNames.VisualBasic);
                Assert.Equal(newQualifyMethodAccessValue, actualQualifyMethodAccessValue);

                var actualVarWhenTypeIsApparentValue = options.GetOption(CSharpCodeStyleOptions.VarWhenTypeIsApparent);
                Assert.Equal(newVarWhenTypeIsApparentValue, actualVarWhenTypeIsApparentValue);

                var actualPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue = options.GetOption(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.VisualBasic);
                Assert.Equal(newPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue, actualPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue);
            }
        }

        [Fact]
        public void Missing_Metadata_Serialization_Test()
        {
            using var workspace = CreateWorkspace();
            var serializer = workspace.Services.GetService<ISerializerService>();

            var reference = new MissingMetadataReference();

            // make sure this doesn't throw
            var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
            var assetFromStorage = CloneAsset(serializer, assetFromFile);
            _ = CloneAsset(serializer, assetFromStorage);
        }

        [Fact]
        public void Missing_Analyzer_Serialization_Test()
        {
            using var workspace = CreateWorkspace();
            var serializer = workspace.Services.GetService<ISerializerService>();

            var reference = new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing_reference"), new MissingAnalyzerLoader());

            // make sure this doesn't throw
            var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
            var assetFromStorage = CloneAsset(serializer, assetFromFile);
            _ = CloneAsset(serializer, assetFromStorage);
        }

        [Fact]
        public void Missing_Analyzer_Serialization_Desktop_Test()
        {
            using var workspace = CreateWorkspace();
            var serializer = workspace.Services.GetService<ISerializerService>();

            var reference = new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing_reference"), new MissingAnalyzerLoader());

            // make sure this doesn't throw
            var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
            var assetFromStorage = CloneAsset(serializer, assetFromFile);
            _ = CloneAsset(serializer, assetFromStorage);
        }

        [Fact]
        public void RoundTrip_Analyzer_Serialization_Test()
        {
            using var tempRoot = new TempRoot();
            using var workspace = CreateWorkspace();

            var serializer = workspace.Services.GetService<ISerializerService>();

            // actually shadow copy content
            var location = typeof(object).Assembly.Location;
            var file = tempRoot.CreateFile("shadow", "dll");
            file.CopyContentFrom(location);

            var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path)));

            // make sure this doesn't throw
            var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
            var assetFromStorage = CloneAsset(serializer, assetFromFile);
            _ = CloneAsset(serializer, assetFromStorage);
        }

        [Fact]
        public void RoundTrip_Analyzer_Serialization_Desktop_Test()
        {
            using var tempRoot = new TempRoot();

            using var workspace = CreateWorkspace();
            var serializer = workspace.Services.GetService<ISerializerService>();

            // actually shadow copy content
            var location = typeof(object).Assembly.Location;
            var file = tempRoot.CreateFile("shadow", "dll");
            file.CopyContentFrom(location);

            var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path)));

            // make sure this doesn't throw
            var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
            var assetFromStorage = CloneAsset(serializer, assetFromFile);
            _ = CloneAsset(serializer, assetFromStorage);
        }

        [Fact]
        public void ShadowCopied_Analyzer_Serialization_Desktop_Test()
        {
            using var tempRoot = new TempRoot();
            using var workspace = CreateWorkspace();
            var reference = CreateShadowCopiedAnalyzerReference(tempRoot);

            var serializer = workspace.Services.GetService<ISerializerService>();

            // make sure this doesn't throw
            var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);

            // this will verify serialized analyzer reference return same checksum as the original one
            _ = CloneAsset(serializer, assetFromFile);
        }

        [Fact]
        [WorkItem(1107294, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1107294")]
        public async Task SnapshotWithIdenticalAnalyzerFiles()
        {
            using var workspace = CreateWorkspace();
            var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp);

            using var temp = new TempRoot();
            var dir = temp.CreateDirectory();

            // create two analyzer assembly files whose content is identical but path is different:
            var file1 = dir.CreateFile("analyzer1.dll").WriteAllBytes(TestResources.AnalyzerTests.FaultyAnalyzer);
            var file2 = dir.CreateFile("analyzer2.dll").WriteAllBytes(TestResources.AnalyzerTests.FaultyAnalyzer);

            var analyzer1 = new AnalyzerFileReference(file1.Path, TestAnalyzerAssemblyLoader.LoadNotImplemented);
            var analyzer2 = new AnalyzerFileReference(file2.Path, TestAnalyzerAssemblyLoader.LoadNotImplemented);

            project = project.AddAnalyzerReferences(new[] { analyzer1, analyzer2 });

            var validator = new SerializationValidator(workspace.Services);
            using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);

            var recovered = await validator.GetSolutionAsync(snapshot).ConfigureAwait(false);
            AssertEx.Equal(new[] { file1.Path, file2.Path }, recovered.GetProject(project.Id).AnalyzerReferences.Select(r => r.FullPath));
        }

        [Fact]
        public async Task SnapshotWithMissingReferencesTest()
        {
            using var workspace = CreateWorkspace();
            var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp);

            var metadata = new MissingMetadataReference();
            var analyzer = new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing_reference"), new MissingAnalyzerLoader());

            project = project.AddMetadataReference(metadata);
            project = project.AddAnalyzerReference(analyzer);

            var validator = new SerializationValidator(workspace.Services);

            using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
            // this shouldn't throw
            var recovered = await validator.GetSolutionAsync(snapshot).ConfigureAwait(false);
        }

        [Fact]
        public async Task UnknownLanguageTest()
        {
            using var workspace = CreateWorkspace(new[] { typeof(NoCompilationLanguageServiceFactory) });
            var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", NoCompilationConstants.LanguageName);

            var validator = new SerializationValidator(workspace.Services);

            using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
            // this shouldn't throw
            var recovered = await validator.GetSolutionAsync(snapshot).ConfigureAwait(false);
        }

        [Fact, WorkItem(44791, "https://github.com/dotnet/roslyn/issues/44791")]
        public async Task UnknownLanguageOptionsTest()
        {
            using var workspace = CreateWorkspace(new[] { typeof(NoCompilationLanguageServiceFactory) });
            var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", NoCompilationConstants.LanguageName)
                .Solution.AddProject("Project2", "Project2.dll", LanguageNames.CSharp);
            workspace.TryApplyChanges(project.Solution);

            await VerifyOptionSetsAsync(workspace, verifyOptionValues: _ => { });
        }

        [Fact]
        public async Task EmptyAssetChecksumTest()
        {
            var document = CreateWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.CSharp).AddDocument("empty", SourceText.From(""));
            var serializer = document.Project.Solution.Workspace.Services.GetService<ISerializerService>();

            var source = serializer.CreateChecksum(await document.GetTextAsync().ConfigureAwait(false), CancellationToken.None);
            var metadata = serializer.CreateChecksum(new MissingMetadataReference(), CancellationToken.None);
            var analyzer = serializer.CreateChecksum(new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing"), new MissingAnalyzerLoader()), CancellationToken.None);

            Assert.NotEqual(source, metadata);
            Assert.NotEqual(source, analyzer);
            Assert.NotEqual(metadata, analyzer);
        }

        [Fact]
        public async Task VBParseOptionsInCompilationOptions()
        {
            var project = CreateWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.VisualBasic);
            project = project.WithCompilationOptions(
                ((VisualBasic.VisualBasicCompilationOptions)project.CompilationOptions).WithParseOptions((VisualBasic.VisualBasicParseOptions)project.ParseOptions));

            var checksum = await project.State.GetChecksumAsync(CancellationToken.None).ConfigureAwait(false);

            Assert.NotNull(checksum);
        }

        [Fact]
        public async Task TestMetadataXmlDocComment()
        {
            using var tempRoot = new TempRoot();
            // get original assembly location
            var mscorlibLocation = typeof(object).Assembly.Location;

            // set up dll and xml doc content
            var tempDir = tempRoot.CreateDirectory();
            var tempCorlib = tempDir.CopyFile(mscorlibLocation);
            var tempCorlibXml = tempDir.CreateFile(Path.ChangeExtension(tempCorlib.Path, "xml"));
            tempCorlibXml.WriteAllText(@"<?xml version=""1.0"" encoding=""utf-8""?>
<doc>
  <assembly>
    <name>mscorlib</name>
  </assembly>
  <members>
    <member name=""T:System.Object"">
      <summary>Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.To browse the .NET Framework source code for this type, see the Reference Source.</summary>
    </member>
  </members>
</doc>");

            using var workspace = CreateWorkspace();
            var solution = workspace.CurrentSolution
                .AddProject("Project", "Project.dll", LanguageNames.CSharp)
                .AddMetadataReference(MetadataReference.CreateFromFile(tempCorlib.Path))
                .Solution;

            var validator = new SerializationValidator(workspace.Services);

            using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None);
            // recover solution from given snapshot
            var recovered = await validator.GetSolutionAsync(scope);

            var compilation = await recovered.Projects.First().GetCompilationAsync(CancellationToken.None);
            var objectType = compilation.GetTypeByMetadataName("System.Object");
            var xmlDocComment = objectType.GetDocumentationCommentXml();

            Assert.False(string.IsNullOrEmpty(xmlDocComment));
        }

        [Fact]
        public void TestEncodingSerialization()
        {
            using var workspace = CreateWorkspace();

            var serializer = workspace.Services.GetService<ISerializerService>();

            // test with right serializable encoding
            var sourceText = SourceText.From("Hello", Encoding.UTF8);
            using (var stream = SerializableBytes.CreateWritableStream())
            {
                using (var objectWriter = new ObjectWriter(stream, leaveOpen: true))
                {
                    serializer.Serialize(sourceText, objectWriter, CancellationToken.None);
                }

                stream.Position = 0;

                using var objectReader = ObjectReader.TryGetReader(stream);

                var newText = serializer.Deserialize<SourceText>(sourceText.GetWellKnownSynchronizationKind(), objectReader, CancellationToken.None);
                Assert.Equal(sourceText.ToString(), newText.ToString());
            }

            // test with wrong encoding that doesn't support serialization
            sourceText = SourceText.From("Hello", new NotSerializableEncoding());
            using (var stream = SerializableBytes.CreateWritableStream())
            {
                using (var objectWriter = new ObjectWriter(stream, leaveOpen: true))
                {
                    serializer.Serialize(sourceText, objectWriter, CancellationToken.None);
                }

                stream.Position = 0;

                using var objectReader = ObjectReader.TryGetReader(stream);

                var newText = serializer.Deserialize<SourceText>(sourceText.GetWellKnownSynchronizationKind(), objectReader, CancellationToken.None);
                Assert.Equal(sourceText.ToString(), newText.ToString());
            }
        }

        [Fact]
        public void TestCompilationOptions_NullableAndImport()
        {
            var csharpOptions = CSharp.CSharpCompilation.Create("dummy").Options.WithNullableContextOptions(NullableContextOptions.Warnings).WithMetadataImportOptions(MetadataImportOptions.All);
            var vbOptions = VisualBasic.VisualBasicCompilation.Create("dummy").Options.WithMetadataImportOptions(MetadataImportOptions.Internal);

            using var workspace = CreateWorkspace();
            var serializer = workspace.Services.GetService<ISerializerService>();

            VerifyOptions(csharpOptions);
            VerifyOptions(vbOptions);

            void VerifyOptions(CompilationOptions originalOptions)
            {
                using var stream = SerializableBytes.CreateWritableStream();
                using (var objectWriter = new ObjectWriter(stream, leaveOpen: true))
                {
                    serializer.Serialize(originalOptions, objectWriter, CancellationToken.None);
                }

                stream.Position = 0;
                using var objectReader = ObjectReader.TryGetReader(stream);
                var recoveredOptions = serializer.Deserialize<CompilationOptions>(originalOptions.GetWellKnownSynchronizationKind(), objectReader, CancellationToken.None);

                var original = serializer.CreateChecksum(originalOptions, CancellationToken.None);
                var recovered = serializer.CreateChecksum(recoveredOptions, CancellationToken.None);

                Assert.Equal(original, recovered);
            }
        }

        private static async Task VerifyOptionSetsAsync(Workspace workspace, Action<OptionSet> verifyOptionValues)
        {
            var solution = workspace.CurrentSolution;

            verifyOptionValues(workspace.Options);
            verifyOptionValues(solution.Options);

            var validator = new SerializationValidator(workspace.Services);

            using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
            var checksum = scope.SolutionInfo.SolutionChecksum;
            var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(checksum).ConfigureAwait(false);

            await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes);
            await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet);

            var recoveredSolution = await validator.GetSolutionAsync(scope);

            // option should be exactly same
            Assert.Equal(0, recoveredSolution.Options.GetChangedOptions(workspace.Options).Count());

            verifyOptionValues(workspace.Options);
            verifyOptionValues(recoveredSolution.Options);

            // checksum for recovered solution should be the same.
            using var recoveredScope = await validator.AssetStorage.StoreAssetsAsync(recoveredSolution, CancellationToken.None).ConfigureAwait(false);
            var recoveredChecksum = recoveredScope.SolutionInfo.SolutionChecksum;
            Assert.Equal(checksum, recoveredChecksum);
        }

        private static SolutionAsset CloneAsset(ISerializerService serializer, SolutionAsset asset)
        {
            using var stream = SerializableBytes.CreateWritableStream();

            using (var writer = new ObjectWriter(stream, leaveOpen: true))
            {
                serializer.Serialize(asset.Value, writer, CancellationToken.None);
            }

            stream.Position = 0;
            using var reader = ObjectReader.TryGetReader(stream);
            var recovered = serializer.Deserialize<object>(asset.Kind, reader, CancellationToken.None);
            var assetFromStorage = new SolutionAsset(serializer.CreateChecksum(recovered, CancellationToken.None), recovered);

            Assert.Equal(asset.Checksum, assetFromStorage.Checksum);
            return assetFromStorage;
        }

        private static AnalyzerFileReference CreateShadowCopiedAnalyzerReference(TempRoot tempRoot)
        {
            // use 2 different files as shadow copied content
            var original = typeof(AdhocWorkspace).Assembly.Location;

            var shadow = tempRoot.CreateFile("shadow", "dll");
            shadow.CopyContentFrom(typeof(object).Assembly.Location);

            return new AnalyzerFileReference(original, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(original, shadow.Path)));
        }

        private class MissingAnalyzerLoader : AnalyzerAssemblyLoader
        {
            protected override Assembly LoadFromPathImpl(string fullPath)
                => throw new FileNotFoundException(fullPath);
        }

        private class MissingMetadataReference : PortableExecutableReference
        {
            public MissingMetadataReference()
                : base(MetadataReferenceProperties.Assembly, "missing_reference", XmlDocumentationProvider.Default)
            {
            }

            protected override DocumentationProvider CreateDocumentationProvider()
                => null;

            protected override Metadata GetMetadataImpl()
                => throw new FileNotFoundException("can't find");

            protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
                => this;
        }

        private class MockShadowCopyAnalyzerAssemblyLoader : IAnalyzerAssemblyLoader
        {
            private readonly ImmutableDictionary<string, string> _map;

            public MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string> map)
                => _map = map;

            public void AddDependencyLocation(string fullPath)
            {
            }

            public Assembly LoadFromPath(string fullPath)
                => Assembly.LoadFrom(_map[fullPath]);
        }

        private class NotSerializableEncoding : Encoding
        {
            private readonly Encoding _real = Encoding.UTF8;

            public override string WebName => _real.WebName;
            public override int GetByteCount(char[] chars, int index, int count) => _real.GetByteCount(chars, index, count);
            public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) => GetBytes(chars, charIndex, charCount, bytes, byteIndex);
            public override int GetCharCount(byte[] bytes, int index, int count) => GetCharCount(bytes, index, count);
            public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) => GetChars(bytes, byteIndex, byteCount, chars, charIndex);
            public override int GetMaxByteCount(int charCount) => GetMaxByteCount(charCount);
            public override int GetMaxCharCount(int byteCount) => GetMaxCharCount(byteCount);
        }
    }
}


text:
Features:

- Added `parseDataName`, `parseHelperName`, and `parsePartialName` options.

## 2.4.3

Features:

- Cleaned up internals to facilitate cleaner pass-through of options to core dependencies. Exposes more options without having to explicitly support them.
- Exposed handlebars instance.

## 2.4.2

Features:

- Improved error handling.

## 2.4.1

Documentation updates and test correction.

## 2.4.0

Features:

- Switched internals from using `map-stream` to `through2.obj`.
- Added `debug` option.

## 2.3.0

Features:

- Added `dataEach` option to support modifying the context on a per-file basis.

## 2.2.0

Features:

- Added support for defining data, helpers, and partials as objects or maker functions.

## 2.1.1

Bufixes:

- Updated `require-glob` to latest version to improve default handling of data property names.

## 2.0.0

Breaking changes:

- Data globbing was updated to use `require-glob`. This introduced a subtle, but significant change. The data object passed into templates will now contain keys based on the paths to data files. Previously, all data objects would be merged into a single object. See the [`require-glob`][reqglob] README for more information about the new behavior.

[reqglob]: http://github.com/shannonmoeller/require-glob


text:
#import <Foundation/Foundation.h>
#import "UriBeacon.h"

@interface PWBeacon : NSObject

- (id)initWithUriBeacon:(UBUriBeacon *)beacon info:(NSDictionary *)info;

@property(nonatomic, retain) UBUriBeacon *uriBeacon;

// URL of the page stored on the beacon.
@property(nonatomic, copy) NSURL *URL;

// URL of the page to display to the user.
@property(nonatomic, copy) NSURL *displayURL;

// Whether the display URL has been set by the server.
@property(nonatomic, assign) BOOL hasDisplayURL;

// Title of the page.
@property(nonatomic, copy) NSString *title;

// Snippet of the page.
@property(nonatomic, copy) NSString *snippet;

// Favicon.
@property(nonatomic, copy) NSURL *iconURL;

// Date of discovery of the beacon.
@property(nonatomic, retain) NSDate *date;

// The beacon is in the first batch. We should sort it by region.
@property(nonatomic, assign) BOOL sortByRegion;

// Region of the beacon.
@property(nonatomic, assign) UBUriBeaconRegion region;

// Rank of the beacon, computed by the metadata server.
@property(nonatomic, assign) double rank;

// Returns YES if the rank has been computed by the metadata server.
@property(nonatomic, assign) BOOL hasRank;

// Returns the delay to discover the beacon via bluetooth.
@property(nonatomic, assign) NSTimeInterval discoveryDelay;

// Returns the delay to get the metadata of the beacon via The Physical Web
// Server.
@property(nonatomic, assign) NSTimeInterval requestDelay;

@property (nonatomic, retain, readonly) NSArray * rssiHistory;

// Returns the region name of the beacon when it was created.
- (NSString *)debugRegionName;

// Returns the updated region name of the beacon.
- (NSString *)debugUriRegionName;

@end


text:
@interface BNRDynamicTypeManagedTextView : UITextView

- (instancetype)initWithFrame:(CGRect)frame textContainer:(NSTextContainer *)textContainer textStyle:(NSString *)textStyle;

@end


text:
<!DOCTYPE html>

    <title>HostDeviceArrayResult Enum Reference</title>
    <link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
    <meta charset='utf-8'>

BrewAPI Docs (100% documented)

View on GitHub

        BrewAPI Reference

        HostDeviceArrayResult Enum Reference

            Classes

                BrewAPI

                – BoolResult

                – SocketMessage

                Container

                – ContainerResult

                – ContainerArrayResult

                – ConflictActionType

                – TemperatureSettings

                Cycle

                Device

                – DeviceResult

                – DeviceArrayResult

                – CyclesArrayResult

                – TemperaturesArrayResult

                – ForceMode

                – HostDevicePin

                – OneWireDeviceType

                – DeviceType

                HostDevice

                – HostDeviceResult

                – HostDeviceArrayResult

                – SourceCodeResult

                Log

                – LogResult

                – LogArrayResult

                – LogType

                Object

                ParticleDevice

                – ParticleDeviceArrayResult

                – ParticleDeviceType

                ScheduledTemperature

                Temperature

                User

                – UserResult

                – SavedUser

            Enums

                BrewError

                Result

            Structs

                BrewAPIConstants

                ParticleAPI

                Response

HostDeviceArrayResult

public enum HostDeviceArrayResult

Result with an array of HostDevice objects.

                    success

The array of HostDevice objects from request.

Declaration

Swift

case success(hostDevices: [HostDevice])

                    failure

NSError object.

Declaration

Swift

case failure(error: Error)

Copyright © 2017 Brew. All rights reserved.

Generated by jazzy ♪♫ v0.7.4, a Realm project.


text:
<!DOCTYPE html>
<html lang="en">

<head>
    <title>Best books of 2015 : NPR</title>

    <meta name="twitter:card" content="summary">
    <meta name="twitter:site" content="nprbooks">
    <meta name="twitter:image" content="http://apps.npr.org/best-books-2015/assets/cover/make-the-road-new-jersey.jpg" />

    <meta property="og:title" content="NPR's Best Books of 2015 - Make the Road New Jersey" />
    <meta property="og:url" content="http://127.0.0.1:8000/share/make-the-road-new-jersey.html" />
    <meta property="og:type" content="article" />
    <meta property="og:description" content="A new branch of NY-based Make the Road, organizing primarily Latinos and immigrant communities in New Jersey." />
    <meta property="og:image" content="http://apps.npr.org/best-books-2015/assets/cover/make-the-road-new-jersey.jpg" />
    <meta property="og:site_name" content="NPR.org" />
    <meta property="fb:app_id" content="1.38837436155e+14" />

    <meta name="thumbnail" content="http://apps.npr.org/best-books-2015/assets/cover/make-the-road-new-jersey.jpg" />
</head>

<body>
</body>

</html>


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/bigtable/admin/v2/table.proto

namespace Google\Cloud\Bigtable\Admin\V2;

/**
 * Table replication states.
 *
 * Protobuf enum Google\Bigtable\Admin\V2\Table\ClusterState\ReplicationState
 */
class Table_ClusterState_ReplicationState
{
    /**
     * The replication state of the table is unknown in this cluster.
     *
     * Generated from protobuf enum STATE_NOT_KNOWN = 0;
     */
    const STATE_NOT_KNOWN = 0;
    /**
     * The cluster was recently created, and the table must finish copying
     * over pre-existing data from other clusters before it can begin
     * receiving live replication updates and serving Data API requests.
     *
     * Generated from protobuf enum INITIALIZING = 1;
     */
    const INITIALIZING = 1;
    /**
     * The table is temporarily unable to serve Data API requests from this
     * cluster due to planned internal maintenance.
     *
     * Generated from protobuf enum PLANNED_MAINTENANCE = 2;
     */
    const PLANNED_MAINTENANCE = 2;
    /**
     * The table is temporarily unable to serve Data API requests from this
     * cluster due to unplanned or emergency maintenance.
     *
     * Generated from protobuf enum UNPLANNED_MAINTENANCE = 3;
     */
    const UNPLANNED_MAINTENANCE = 3;
    /**
     * The table can serve Data API requests from this cluster. Depending on
     * replication delay, reads may not immediately reflect the state of the
     * table in other clusters.
     *
     * Generated from protobuf enum READY = 4;
     */
    const READY = 4;
}


text:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
module Ros.Sensor_msgs.RegionOfInterest where
import qualified Prelude as P
import Prelude ((.), (+), (*))
import qualified Data.Typeable as T
import Control.Applicative
import Ros.Internal.RosBinary
import Ros.Internal.Msg.MsgInfo
import qualified GHC.Generics as G
import qualified Data.Default.Generics as D
import qualified Data.Word as Word
import Foreign.Storable (Storable(..))
import qualified Ros.Internal.Util.StorableMonad as SM
import Lens.Family.TH (makeLenses)
import Lens.Family (view, set)

data RegionOfInterest = RegionOfInterest { _x_offset :: Word.Word32
                                         , _y_offset :: Word.Word32
                                         , _height :: Word.Word32
                                         , _width :: Word.Word32
                                         , _do_rectify :: P.Bool
                                         } deriving (P.Show, P.Eq, P.Ord, T.Typeable, G.Generic)

$(makeLenses ''RegionOfInterest)

instance RosBinary RegionOfInterest where
  put obj' = put (_x_offset obj') *> put (_y_offset obj') *> put (_height obj') *> put (_width obj') *> put (_do_rectify obj')
  get = RegionOfInterest <$> get <*> get <*> get <*> get <*> get

instance Storable RegionOfInterest where
  sizeOf _ = sizeOf (P.undefined::Word.Word32) +
             sizeOf (P.undefined::Word.Word32) +
             sizeOf (P.undefined::Word.Word32) +
             sizeOf (P.undefined::Word.Word32) +
             sizeOf (P.undefined::P.Bool)
  alignment _ = 8
  peek = SM.runStorable (RegionOfInterest <$> SM.peek <*> SM.peek <*> SM.peek <*> SM.peek <*> SM.peek)
  poke ptr' obj' = SM.runStorable store' ptr'
    where store' = SM.poke (_x_offset obj') *> SM.poke (_y_offset obj') *> SM.poke (_height obj') *> SM.poke (_width obj') *> SM.poke (_do_rectify obj')

instance MsgInfo RegionOfInterest where
  sourceMD5 _ = "bdb633039d588fcccb441a4d43ccfe09"
  msgTypeName _ = "sensor_msgs/RegionOfInterest"

instance D.Default RegionOfInterest


text:
package edu.oregonstate.subertd.finalproject;

import android.util.Log;

import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;

/**
 * Created by Donald on 6/7/2015.
 */
public class UpcFinder {

    private static final String TAG = UpcFinder.class.getName();

    private static final String HTTP_PROTOCOL = "http://";
    private static final String API_ROOT = "api.upcdatabase.org";
    private static final String JSON_REPRESENTATION = "/json";
    private static final String API_KEY = "/e389ec5b0adc511ac1d48899d4079d93";

    private static final String PRODUCT_DESCRIPTION = "description";

    public String getProductDescription(final String upc) {

        final String path = HTTP_PROTOCOL + API_ROOT + JSON_REPRESENTATION + API_KEY + "/" + upc;
        Log.i(TAG, "Get Product Description Path: " + path);

        try {
            final HttpGet httpGet = new HttpGet(path);
            final DefaultHttpClient httpClient = new DefaultHttpClient();
            final ResponseHandler<String> responseHandler = new BasicResponseHandler();
            final String response = httpClient.execute(httpGet, responseHandler);

            final JSONObject jsonResponse = new JSONObject(response);

            final String productDescription = jsonResponse.getString(PRODUCT_DESCRIPTION);

            return productDescription;
        } catch (JSONException | IOException e) {
            final String message = "Unable to get product from UPC";
            Log.e(TAG, message, e);
            return null;
        }
    }
}