text:
<!DOCTYPE html>

	<link href="js/bootstrap.min.css" rel="stylesheet"type="text/css">
	<link href="css/moncss.css" rel="stylesheet"type="text/css">

	<title>Comparison of eDonkey software - Features (continued)</title>
	<meta charset="utf-8">

Comparison of eDonkey software - Features (continued)

			<fieldset>

					<form action="" method="post">
						<legend style="color:red;font-weight: bold;font-style:italic;text-align: center;" >Formulaire</legend>

								Yes - No :

 <input type="radio" name="FeatureYes - No" value="oui">Yes <input type="radio" name="FeatureYes - No" value = "non">No <input type="radio" name="FeatureYes - No" value = "non">Partial

											<input  style="display:none;" id ="id2Yes - No"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Yes - No','id2Yes - No');">Changer type</button>

								Chat - Yes :

 <input type="radio" name="FeatureChat - Yes" value="oui">Yes <input type="radio" name="FeatureChat - Yes" value = "non">No <input type="radio" name="FeatureChat - Yes" value = "non">Partial

											<input  style="display:none;" id ="id2Chat - Yes"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Chat - Yes','id2Chat - Yes');">Changer type</button>

								Protocol Obfuscation - Yes :

 <input type="radio" name="FeatureProtocol Obfuscation - Yes" value="oui">Yes <input type="radio" name="FeatureProtocol Obfuscation - Yes" value = "non">No <input type="radio" name="FeatureProtocol Obfuscation - Yes" value = "non">Partial

											<input  style="display:none;" id ="id2Protocol Obfuscation - Yes"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Protocol Obfuscation - Yes','id2Protocol Obfuscation - Yes');">Changer type</button>

								AICH - Yes :

 <input type="radio" name="FeatureAICH - Yes" value="oui">Yes <input type="radio" name="FeatureAICH - Yes" value = "non">No <input type="radio" name="FeatureAICH - Yes" value = "non">Partial

											<input  style="display:none;" id ="id2AICH - Yes"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1AICH - Yes','id2AICH - Yes');">Changer type</button>

								UPnP port mapping - Yes :

 <input type="radio" name="FeatureUPnP port mapping - Yes" value="oui">Yes <input type="radio" name="FeatureUPnP port mapping - Yes" value = "non">No <input type="radio" name="FeatureUPnP port mapping - Yes" value = "non">Partial

											<input  style="display:none;" id ="id2UPnP port mapping - Yes"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1UPnP port mapping - Yes','id2UPnP port mapping - Yes');">Changer type</button>

								HideOS / SotN - No :

 <input type="radio" name="FeatureHideOS / SotN - No" value="oui">Yes <input type="radio" name="FeatureHideOS / SotN - No" value = "non">No <input type="radio" name="FeatureHideOS / SotN - No" value = "non">Partial

											<input  style="display:none;" id ="id2HideOS / SotN - No"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1HideOS / SotN - No','id2HideOS / SotN - No');">Changer type</button>

								Yes - zz's Version :
 <input id="0" type="text" name="Feature">

								Global Searches - Yes :

 <input type="radio" name="FeatureGlobal Searches - Yes" value="oui">Yes <input type="radio" name="FeatureGlobal Searches - Yes" value = "non">No <input type="radio" name="FeatureGlobal Searches - Yes" value = "non">Partial

											<input  style="display:none;" id ="id2Global Searches - Yes"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Global Searches - Yes','id2Global Searches - Yes');">Changer type</button>

								L2HAC - No :

 <input type="radio" name="FeatureL2HAC - No" value="oui">Yes <input type="radio" name="FeatureL2HAC - No" value = "non">No <input type="radio" name="FeatureL2HAC - No" value = "non">Partial

											<input  style="display:none;" id ="id2L2HAC - No"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1L2HAC - No','id2L2HAC - No');">Changer type</button>

								Buddy list - Yes :

 <input type="radio" name="FeatureBuddy list - Yes" value="oui">Yes <input type="radio" name="FeatureBuddy list - Yes" value = "non">No <input type="radio" name="FeatureBuddy list - Yes" value = "non">Partial

											<input  style="display:none;" id ="id2Buddy list - Yes"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Buddy list - Yes','id2Buddy list - Yes');">Changer type</button>

								Send FILERATING tags to servers - Yes :

 <input type="radio" name="FeatureSend FILERATING tags to servers - Yes" value="oui">Yes <input type="radio" name="FeatureSend FILERATING tags to servers - Yes" value = "non">No <input type="radio" name="FeatureSend FILERATING tags to servers - Yes" value = "non">Partial

											<input  style="display:none;" id ="id2Send FILERATING tags to servers - Yes"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Send FILERATING tags to servers - Yes','id2Send FILERATING tags to servers - Yes');">Changer type</button>

								Secure User ID - Yes :

 <input type="radio" name="FeatureSecure User ID - Yes" value="oui">Yes <input type="radio" name="FeatureSecure User ID - Yes" value = "non">No <input type="radio" name="FeatureSecure User ID - Yes" value = "non">Partial

											<input  style="display:none;" id ="id2Secure User ID - Yes"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Secure User ID - Yes','id2Secure User ID - Yes');">Changer type</button>

								Intelligent Chunk Selection - No :

 <input type="radio" name="FeatureIntelligent Chunk Selection - No" value="oui">Yes <input type="radio" name="FeatureIntelligent Chunk Selection - No" value = "non">No <input type="radio" name="FeatureIntelligent Chunk Selection - No" value = "non">Partial

											<input  style="display:none;" id ="id2Intelligent Chunk Selection - No"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Intelligent Chunk Selection - No','id2Intelligent Chunk Selection - No');">Changer type</button>

								Lancast - No :

 <input type="radio" name="FeatureLancast - No" value="oui">Yes <input type="radio" name="FeatureLancast - No" value = "non">No <input type="radio" name="FeatureLancast - No" value = "non">Partial

											<input  style="display:none;" id ="id2Lancast - No"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Lancast - No','id2Lancast - No');">Changer type</button>

								aMule - eMule :
 <input id="1" type="text" name="Feature">

								aMule - Official :
 <input id="2" type="text" name="Feature">

								Handles files >4GB - Yes :

4GB - Yes"> <input type="radio" name="FeatureHandles files >4GB - Yes" value="oui">Yes <input type="radio" name="FeatureHandles files >4GB - Yes" value = "non">No <input type="radio" name="FeatureHandles files >4GB - Yes" value = "non">Partial

											<input  style="display:none;" id ="id2Handles files >4GB - Yes"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1Handles files >4GB - Yes','id2Handles files >4GB - Yes');">Changer type</button>

<input type="submit" class="btn btn-info" value="Ajouter un produit" />
					</form>

			</fieldset>


text:
layout: page-fullwidth
title: "PEGASUS"
subheadline: ""
teaser: "PEGASUS 設備簡介"
header: no
categories:
    - distributor
---
[http://www.pongee.com/index.php?_lang=T](http://www.pongee.com/index.php?_lang=T)

redpajama_set_name: RedPajamaGithub


text:
package pl.asie.charset.lib.render;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.client.model.pipeline.LightUtil;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;

 public final class ModelTransformer {
     private ModelTransformer() {

     }

     public static IBakedModel transform(IBakedModel model, IBlockState state, long rand, IVertexTransformer transformer) {
         SimpleBakedModel out = new SimpleBakedModel(model);

         for (int i = 0; i <= 6; i++) {
             EnumFacing side = (i == 6 ? null : EnumFacing.getFront(i));
             for (BakedQuad quad : model.getQuads(state, side, rand)) {
                 out.addQuad(side, transform(quad, transformer));
             }
         }

         return out;
     }

     private static BakedQuad transform(BakedQuad quad, IVertexTransformer transformer) {
         VertexFormat format = quad.getFormat();
         UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
         LightUtil.putBakedQuad(new VertexTransformerWrapper(builder, quad, transformer), quad);
         return builder.build();
     }

     private static final class VertexTransformerWrapper implements IVertexConsumer {
         private final IVertexConsumer parent;
         private final BakedQuad parentQuad;
         private final VertexFormat format;
         private final IVertexTransformer transformer;

         public VertexTransformerWrapper(IVertexConsumer parent, BakedQuad parentQuad, IVertexTransformer transformer) {
             this.parent = parent;
             this.parentQuad = parentQuad;
             this.format = parent.getVertexFormat();
             this.transformer = transformer;
         }

         @Override
         public VertexFormat getVertexFormat() {
             return format;
         }

         @Override
         public void setQuadTint(int tint) {
             parent.setQuadTint(tint);
         }

         @Override
         public void setQuadOrientation(EnumFacing orientation) {
             parent.setQuadOrientation(orientation);
         }

         @Override
         public void setApplyDiffuseLighting(boolean diffuse) {
             parent.setApplyDiffuseLighting(diffuse);
         }

         @Override
         public void put(int elementId, float... data) {
             VertexFormatElement element = format.getElement(elementId);
             parent.put(elementId, transformer.transform(parentQuad, element, data));
         }
     }

     public interface IVertexTransformer {
         float[] transform(BakedQuad quad, VertexFormatElement element, float... data);
     }
}


text:
<?php
class mediatorMediaLibraryInitializeTask extends sfBaseTask
{
  /**
   * @see sfTask
   */
  protected function configure()
  {
    $this->addArguments(array(
      new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'),
    ));

    $this->addOptions(array(
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
    ));

    $this->aliases = array('media:init');
    $this->namespace = 'media';
    $this->name = 'initialize';
    $this->briefDescription = 'Initializes the media library environement';

    $this->detailedDescription = <<<EOF
The [media:initialize|INFO] task initializes the media library environement:

  [./symfony media:initialize|INFO]

EOF;
  }

  /**
   * @see sfTask
   */
  protected function execute($arguments = array(), $options = array())
  {
    // load dtabase configuration before Phing
    $databaseManager = new sfDatabaseManager($this->configuration);
    $context = sfContext::createInstance($this->configuration);

    if (count(Doctrine::getTable('MmMediaFolder')->getTree()->fetchRoots()) > 0)
    {
      throw new sfException('The media library has already been initialized!');
    }

    // create the filesystem
    $filesystem = mediatorMediaLibraryToolkit::getFilesystem();

    if ($filesystem->exists(''))
    {
      $media_library_root = $filesystem->getRoot();
      throw new sfException(sprintf('The media library folder, %s, already exists. Please delete this folder or change the parameter in the app.yml file !', $media_library_root));
    }
    else
    {
      $filesystem->mkdir('');
    }

    $sizes = mediatorMediaLibraryToolkit::getAvailableSizes();

    foreach ($sizes as $size => $params)
    {
      if (!isset($params['directory']))
      {
        throw new sfException(sprintf('Could not create directory for size %s', $size));
      }

      $filesystem->mkdir($params['directory']);
      $filesystem->chmod($params['directory'], 0777);
    }

    $node = new mmMediaFolder();
    $node->setName('Media');
    $node->setRoot(0);
    $node->setFolderPath('');
    $node->setAbsolutePath('');
    $node->save();
    $treeObject = Doctrine::getTable('MmMediaFolder')->getTree();
    $treeObject->createRoot($node);

    $this->log('The media library has been initialized');
   }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
  <name>TermSuiteTypeSystem</name>
  <description>This Type System gathers Type Systems required by every UIMA CAS processors used within the fr.univnantes.termsuite.</description>
  <version>1.0</version>
  <vendor>University of Nantes (LINA, UMR CNRS 6241)</vendor>
  <imports />
  <types>
    <typeDescription>
      <name>fr.univnantes.termsuite.types.WordAnnotation</name>
      <description/>
      <supertypeName>uima.tcas.Annotation</supertypeName>
      <features>
	      <featureDescription>
          <name>category</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>lemma</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>stem</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>tag</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>subCategory</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>regexLabel</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>number</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>gender</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>case</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>mood</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>tense</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>person</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>possessor</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>degree</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>formation</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
      <featureDescription>
          <name>labels</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
      <featureDescription>
          <name>wordFloatTestFeat</name>
          <description/>
          <rangeTypeName>uima.cas.Float</rangeTypeName>
      </featureDescription>
          <featureDescription>
              <name>wordIntTestFeat</name>
              <description/>
              <rangeTypeName>uima.cas.Integer</rangeTypeName>
          </featureDescription>

      </features>
    </typeDescription>
    <typeDescription>
      <name>fr.univnantes.termsuite.types.FixedExpression</name>
      <description/>
      <supertypeName>uima.tcas.Annotation</supertypeName>
      <features>
      </features>
    </typeDescription>
    <typeDescription>
      <name>fr.univnantes.termsuite.types.TermOccAnnotation</name>
      <description/>
      <supertypeName>uima.tcas.Annotation</supertypeName>
      <features>
      	<featureDescription>
          <name>words</name>
          <description/>
          <rangeTypeName>uima.cas.FSArray</rangeTypeName>
          <elementType>fr.univnantes.termsuite.types.WordAnnotation</elementType>
        </featureDescription>
         <featureDescription>
          <name>pattern</name>
          <description>The list of regex matcher labels (e.g. [N, A, A, C, A] )</description>
          <rangeTypeName>uima.cas.StringArray</rangeTypeName>
          <multipleReferencesAllowed>false</multipleReferencesAllowed>
        </featureDescription>
        <featureDescription>
          <name>spottingRuleName</name>
          <description>The unique name of the spotting rule matched</description>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
        <featureDescription>
          <name>termKey</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
      </features>
    </typeDescription>
	<typeDescription>
	<name>fr.univnantes.termsuite.types.SourceDocumentInformation</name>
			<description>Stores detailed information about the original source document from which the current CAS was initialized. All information (like size) refers to the source document and not to the document in the CAS which may be converted and filtered by a CAS Initializer. For example this information will be written to the Semantic Search index so that the original document contents can be retrieved by queries.</description>
			<supertypeName>uima.tcas.Annotation</supertypeName>
			<features>
				<featureDescription>
					<name>uri</name>
					<description>URI of document. (For example, file:///MyDirectory/myFile.txt for a simple file or http://incubator.apache.org/uima/index.html for content from a web source.)</description>
					<rangeTypeName>uima.cas.String</rangeTypeName>
				</featureDescription>
				<featureDescription>
					<name>offsetInSource</name>
					<description>Byte offset of the start of document content within original source file or other input source. Only used if the CAS document was retrieved from an source where one physical source file contained several conceptual documents. Zero otherwise.</description>
					<rangeTypeName>uima.cas.Integer</rangeTypeName>
				</featureDescription>
				<featureDescription>
					<name>documentIndex</name>
					<description>The index of the document in the order of processing.</description>
					<rangeTypeName>uima.cas.Integer</rangeTypeName>
				</featureDescription>
				<featureDescription>
					<name>nbDocuments</name>
					<description>The total number of documents in the collection.</description>
					<rangeTypeName>uima.cas.Integer</rangeTypeName>
				</featureDescription>
				<featureDescription>
					<name>documentSize</name>
					<description>Size of original document in bytes before processing by CAS Initializer. Either absolute file size of size within file or other source.</description>
					<rangeTypeName>uima.cas.Integer</rangeTypeName>
				</featureDescription>
				<featureDescription>
					<name>cumulatedDocumentSize</name>
					<description>Cumulated sum of sizes of original document in bytes before processing by CAS Initializer. Either absolute file size of size within file or other source.</description>
					<rangeTypeName>uima.cas.Long</rangeTypeName>
				</featureDescription>
				<featureDescription>
					<name>corpusSize</name>
					<description>Sum of sizes of original documents in bytes in the input collection.</description>
					<rangeTypeName>uima.cas.Long</rangeTypeName>
				</featureDescription>
				<featureDescription>
				  <name>lastSegment</name>
				  <description>For a CAS that represents a segment of a larger source document, this flag indicates whether this CAS is the final segment of the source document.  This is useful for downstream components that want to take some action after having seen all of the segments of a particular source document. </description>
			      <rangeTypeName>uima.cas.Boolean</rangeTypeName>
			    </featureDescription>
			</features>
	</typeDescription>

  </types>
</typeSystemDescription>


text:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$valt = Loader::helper('validation/token');
$ci = Loader::helper('concrete/urls');
$ch = Loader::helper('concrete/interface');
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
	$mi = Marketplace::getInstance();
}
$pkgArray = Package::getInstalledList();?>

<?php
if ($this->controller->getTask() == 'install_package' && $showInstallOptionsScreen && $tp->canInstallPackages()) { ?>

<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Install %s', $pkg->getPackageName()), false, 'span10 offset1', false);?>
<form method="post" action="<?php echo $this->action('install_package', $pkg->getPackageHandle())?>">
<?php echo Loader::helper('validation/token')->output('install_options_selected')?>

<?php echo Loader::packageElement('dashboard/install', $pkg->getPackageHandle())?>
<?php if ($pkg->allowsFullContentSwap()) { ?>

<?php echo t('Clear this Site?')?>

<?php echo t('%s can fully clear you website of all existing content and install its own custom content in its place. If you\'re installing a theme for the first time you may want to do this. Clear all site content?', $pkg->getPackageName())?>

	<?php $u = new User(); ?>
	<?php if ($u->isSuperUser()) {
		$disabled = ''; ?>

<?php echo t('This will clear your home page, uploaded files and any content pages out of your site completely. It will completely reset your site and any content you have added will be lost.')?>

	<?php } else {
		$disabled = 'disabled';?>

<?php echo t('Only the %s user may reset the site\'s content.', USER_SUPER)?>

	<?php } ?>

	<?php echo t("Swap Site Contents")?>

<input type="radio" name="pkgDoFullContentSwap" value="0" checked="checked" <?php echo $disabled?> /> <?php echo t('No. Do not remove any content or files from this website.')?>

<input type="radio" name="pkgDoFullContentSwap" value="1" <?php echo $disabled?> /> <?php echo t('Yes. Reset site content with the content found in this package')?>

<?php } ?>

	<a href="<?php echo $this->url('/dashboard/extend/install')?>" class="btn"><?php echo t('Cancel')?>
	<input type="submit" value="<?php echo t('Install %s', $pkg->getPackageName())?>" class="btn primary ccm-button-right" />

</form>
<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneFooterWrapper(false); ?>

<?php } else if ($this->controller->getTask() == 'uninstall' && $tp->canUninstallPackages()) { ?>
<?php
	$removeBTConfirm = t('This will remove all elements associated with the %s package. This cannot be undone. Are you sure?', $pkg->getPackageHandle());
?>
<form method="post" class="form-stacked" id="ccm-uninstall-form" action="<?php echo $this->action('do_uninstall_package')?>" onsubmit="return confirm('<?php echo $removeBTConfirm?>')">

<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Uninstall Package'), false, 'span10 offset1', false);?>

	<?php echo $valt->output('uninstall')?>
	<input type="hidden" name="pkgID" value="<?php echo $pkg->getPackageID()?>" />

<?php echo t('Items To Uninstall')?>

<?php echo t('Uninstalling %s will remove the following data from your system.', $pkg->getPackageName())?>

		<?php foreach($items as $k => $itemArray) {
			if (count($itemArray) == 0) {
				continue;
			}
			?>

<?php echo $pkg->getPackageItemsCategoryDisplayName($k)?>

			<?php foreach($itemArray as $item) { ?>
				<?php echo $pkg->getItemName($item)?>

			<?php } ?>

		<?php } ?>

<?php echo t('Move package to trash directory on server?')?>

<?php echo Loader::helper('form')->checkbox('pkgMoveToTrash', 1)?>
		<?php echo t('Yes, remove the package\'s directory from the installation directory.')?>

		<?php @Loader::packageElement('dashboard/uninstall', $pkg->getPackageHandle()); ?>

<?php print $ch->submit(t('Uninstall'), 'ccm-uninstall-form', 'right', 'error'); ?>
<?php print $ch->button(t('Cancel'), $this->url('/dashboard/extend/install', 'inspect_package', $pkg->getPackageID()), ''); ?>

<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneFooterWrapper()?>
</form>

<?php
} else {

	function sortAvailableArray($obj1, $obj2) {
		$name1 = $obj1->getPackageName();
		$name2 = $obj2->getPackageName();
		return strcasecmp($name1, $name2);
	}

	// grab the total numbers of updates.
	// this consists of
	// 1. All packages that have greater pkgAvailableVersions than pkgVersion
	// 2. All packages that have greater pkgVersion than getPackageCurrentlyInstalledVersion
	$local = array();
	$remote = array();
	$pkgAvailableArray = array();
	if ($tp->canInstallPackages()) {
		$local = Package::getLocalUpgradeablePackages();
		$remote = Package::getRemotelyUpgradeablePackages();
	}

	// now we strip out any dupes for the total
	$updates = 0;
	$localHandles = array();
	foreach($local as $_pkg) {
		$updates++;
		$localHandles[] = $_pkg->getPackageHandle();
	}
	foreach($remote as $_pkg) {
		if (!in_array($_pkg->getPackageHandle(), $localHandles)) {
			$updates++;
		}
	}
	if ($tp->canInstallPackages()) {
		foreach(Package::getAvailablePackages() as $_pkg) {
			$_pkg->setupPackageLocalization();
			$pkgAvailableArray[] = $_pkg;
		}
	}

	$thisURL = $this->url('/dashboard/extend/install');
	$availableArray = $pkgAvailableArray;
	usort($availableArray, 'sortAvailableArray');

	/* Load featured add-ons from the marketplace.
	 */
	Loader::model('collection_attributes');
	$db = Loader::db();

	if(ENABLE_MARKETPLACE_SUPPORT && $tp->canInstallPackages()){
		$purchasedBlocksSource = Marketplace::getAvailableMarketplaceItems();
	}else{
		$purchasedBlocksSource = array();
	}

	$skipHandles = array();
	foreach($availableArray as $ava) {
		foreach($purchasedBlocksSource as $pi) {
			if ($pi->getHandle() == $ava->getPackageHandle()) {
				$skipHandles[] = $ava->getPackageHandle();
			}
		}
	}

	$purchasedBlocks = array();
	foreach($purchasedBlocksSource as $pb) {
		if (!in_array($pb->getHandle(), $skipHandles)) {
			$purchasedBlocks[] = $pb;
		}
	}

	if (is_object($pkg)) { ?>

		<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Inspect Package'), false, 'span10 offset1', false);?>

				<img src="<?php echo $ci->getPackageIconURL($pkg)?>" />

<?php echo $pkg->getPackageName()?> - <?php echo $pkg->getPackageVersion()?>
<?php echo $pkg->getPackageDescription()?>

			<?php

			$items = $pkg->getPackageItems();
			$blocks = array();
			if (isset($items['block_types']) && is_array($items['block_types'])) {
				$blocks = $items['block_types'];
			}

			if (count($blocks) > 0) { ?>

<?php echo $pkg->getPackageItemsCategoryDisplayName('block_types')?>

				<?php foreach($blocks as $bt) {
					$btIcon = $ci->getBlockTypeIconURL($bt);?>

						<a style="background-image: url(<?php echo $btIcon?>)" class="ccm-block-type-inner" href="<?php echo $this->url('/dashboard/blocks/types', 'inspect', $bt->getBlockTypeID())?>"><?php echo t($bt->getBlockTypeName())?>
						<div class="ccm-block-type-description"  id="ccm-bt-help<?php echo $bt->getBlockTypeID()?>"><?php echo t($bt->getBlockTypeDescription())?>

				<?php } ?>

			<?php } ?>

			<?php $tp = new TaskPermission();
			if ($tp->canUninstallPackages()) {  ?>
				<?php print $ch->button(t('Uninstall Package'), $this->url('/dashboard/extend/install', 'uninstall', $pkg->getPackageID()), 'right'); ?>
			<?php } ?>
				<a href="<?php echo $this->url('/dashboard/extend/install')?>" class="btn"><?php echo t('Back to Add Functionality')?>

			<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneFooterWrapper(false)?>
	<?php

	 } else { ?>

		<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Add Functionality'), t('Install custom add-ons or those downloaded from the concrete5.org marketplace.'), 'span10 offset1');?>

		<?php if (is_object($installedPKG) && $installedPKG->hasInstallPostScreen()) { ?>

<?php echo Loader::element('dashboard/install_post', false, $installedPKG->getPackageHandle())?>

				<?php echo t('Ok')?>

		<?php } ?>

<?php echo t('Currently Installed')?>

		<?php if (count($pkgArray) > 0) { ?>

			<?php if ($updates > 0) { ?>

<?php echo t('Add-On updates are available!')?>

				<?php if ($updates == 1) { ?>

<?php echo t('There is currently 1 update available.')?>

				<?php } else { ?>

<?php echo t('There are currently %s updates available.', $updates)?>

				<?php } ?>

<a class="small btn" href="<?php echo $this->url('/dashboard/extend/update')?>"><?php echo t('Update Add-Ons')?>

			<?php } ?>

			<?php	foreach ($pkgArray as $pkg) { ?>

					<img src="<?php echo $ci->getPackageIconURL($pkg)?>" />

<?php echo $pkg->getPackageName()?> - <?php echo $pkg->getPackageVersion()?>
<?php echo $pkg->getPackageDescription()?>

					<?php echo $ch->button(t("Edit"), View::url('/dashboard/extend/install', 'inspect_package', $pkg->getPackageID()), "")?>

			<?php } ?>

		<?php } else { ?>

<?php echo t('No packages have been installed.')?>

		<?php } ?>

		<?php if ($tp->canInstallPackages()) { ?>

<?php echo t('Awaiting Installation')?>

		<?php if (count($availableArray) == 0 && count($purchasedBlocks) == 0) { ?>

			<?php if (!$mi->isConnected()) { ?>
				<?php echo t('Nothing currently available to install.')?>
			<?php } ?>

		<?php } else { ?>

			<?php foreach ($purchasedBlocks as $pb) {
				$file = $pb->getRemoteFileURL();
				if (!empty($file)) {?>

					<img src="<?php echo $pb->getRemoteIconURL()?>" />

<?php echo $pb->getName()?>

					<?php echo $pb->getDescription()?>

					<?php echo $ch->button(t("Download"), View::url('/dashboard/extend/install', 'download', $pb->getMarketplaceItemID()), "", 'primary')?>

				<?php } ?>
			<?php } ?>
			<?php	foreach ($availableArray as $obj) { ?>

					<img src="<?php echo $ci->getPackageIconURL($obj)?>" />

<?php echo $obj->getPackageName()?>

					<?php echo $obj->getPackageDescription()?>
					<?php echo $ch->button(t("Install"), $this->url('/dashboard/extend/install','install_package', $obj->getPackageHandle()), "");?>

			<?php } ?>

			<?php } ?>

		<?php
		if (is_object($mi) && $mi->isConnected()) { ?>

<?php echo t("Project Page")?>

<?php echo t('Your site is currently connected to the concrete5 community. Your project page URL is:')?>

			<a href="<?php echo $mi->getSitePageURL()?>"><?php echo $mi->getSitePageURL()?>

		<?php } else if (is_object($mi) && $mi->hasConnectionError()) { ?>

			<?php echo Loader::element('dashboard/marketplace_connect_failed');?>

		<?php } else if ($tp->canInstallPackages() && ENABLE_MARKETPLACE_SUPPORT == true) { ?>

<?php echo t('Connect to Community')?>

<?php echo t('Your site is not connected to the concrete5 community. Connecting lets you easily extend a site with themes and add-ons.')?>

<a class="btn success" href="<?php echo $this->url('/dashboard/extend/connect', 'register_step1')?>"><?php echo t("Connect to Community")?>

		<?php } ?>
	<?php } ?>
<?php }

} ?>


text:
module Fog
  module Compute
    class Brightbox
      class Real
        # Get full details of the server type.
        #
        # @param [String] identifier Unique reference to identify the resource
        #
        # @return [Hash] if successful Hash version of JSON object
        #
        # @see https://api.gb1.brightbox.com/1.0/#server_type_get_server_type
        #
        def get_server_type(identifier)
          return nil if identifier.nil? || identifier == ""
          wrapped_request("get", "/1.0/server_types/#{identifier}", [200])
        end
      end
    end
  end
end


text:
package pl.grzeslowski.jsupla.protocol.impl.encoders.sc;

import pl.grzeslowski.jsupla.protocol.api.encoders.PrimitiveEncoder;
import pl.grzeslowski.jsupla.protocol.api.encoders.sc.SuplaChannelGroupRelationEncoder;
import pl.grzeslowski.jsupla.protocol.api.encoders.sc.SuplaChannelGroupRelationPackEncoder;
import pl.grzeslowski.jsupla.protocol.api.structs.sc.SuplaChannelGroupRelation;
import pl.grzeslowski.jsupla.protocol.api.structs.sc.SuplaChannelGroupRelationPack;
import pl.grzeslowski.jsupla.protocol.impl.encoders.PrimitiveEncoderImpl;

import static java.util.Objects.requireNonNull;

public final class SuplaChannelGroupRelationPackEncoderImpl implements SuplaChannelGroupRelationPackEncoder {
    public static final SuplaChannelGroupRelationPackEncoderImpl INSTANCE =
            new SuplaChannelGroupRelationPackEncoderImpl(PrimitiveEncoderImpl.INSTANCE,
                    SuplaChannelGroupRelationEncoderImpl.INSTANCE);
    private final PrimitiveEncoder primitiveEncoder;
    private final SuplaChannelGroupRelationEncoder suplaChannelGroupRelationEncoder;

    SuplaChannelGroupRelationPackEncoderImpl(final PrimitiveEncoder primitiveEncoder,
                                             final SuplaChannelGroupRelationEncoder suplaChannelGroupRelationEncoder) {
        this.primitiveEncoder = requireNonNull(primitiveEncoder);
        this.suplaChannelGroupRelationEncoder = requireNonNull(suplaChannelGroupRelationEncoder);
    }

    @Override
    public byte[] encode(final SuplaChannelGroupRelationPack proto) {
        final byte[] bytes = new byte[proto.size()];
        int offset = 0;

        offset += primitiveEncoder.writeInteger(proto.count, bytes, offset);
        offset += primitiveEncoder.writeInteger(proto.totalLeft, bytes, offset);
        for (SuplaChannelGroupRelation item : proto.items) {
            final byte[] itemBytes = suplaChannelGroupRelationEncoder.encode(item);
            offset += primitiveEncoder.writeBytes(itemBytes, bytes, offset);
        }

        return bytes;
    }
}


text:
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/app_list/app_list_client_impl.h"

#include <stddef.h>

#include <utility>
#include <vector>

#include "ash/public/cpp/app_list/app_list_controller.h"
#include "ash/public/cpp/new_window_delegate.h"
#include "ash/public/cpp/shelf_model.h"
#include "ash/public/cpp/tablet_mode.h"
#include "base/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/strings/strcat.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "chrome/browser/ash/crosapi/url_handler_ash.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
#include "chrome/browser/ui/app_list/app_list_model_updater.h"
#include "chrome/browser/ui/app_list/app_list_notifier_impl.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
#include "chrome/browser/ui/app_list/app_sync_ui_state_watcher.h"
#include "chrome/browser/ui/app_list/search/app_result.h"
#include "chrome/browser/ui/app_list/search/chrome_search_result.h"
#include "chrome/browser/ui/app_list/search/cros_action_history/cros_action_recorder.h"
#include "chrome/browser/ui/app_list/search/ranking/launch_data.h"
#include "chrome/browser/ui/app_list/search/search_controller.h"
#include "chrome/browser/ui/app_list/search/search_controller_factory.h"
#include "chrome/browser/ui/app_list/search/search_result_ranker/ranking_item_util.h"
#include "chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.h"
#include "chrome/browser/ui/ash/shelf/chrome_shelf_controller.h"
#include "chrome/browser/ui/ash/shelf/chrome_shelf_controller_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
#include "chromeos/crosapi/cpp/gurl_os_handler_utils.h"
#include "components/session_manager/core/session_manager.h"
#include "extensions/common/extension.h"
#include "ui/base/page_transition_types.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/display/types/display_constants.h"
#include "ui/gfx/geometry/rect.h"

namespace {

AppListClientImpl* g_app_list_client_instance = nullptr;

// Parameters used by the time duration metrics.
constexpr base::TimeDelta kTimeMetricsMin = base::Seconds(1);
constexpr base::TimeDelta kTimeMetricsMax = base::Days(7);
constexpr int kTimeMetricsBucketCount = 100;

bool IsTabletMode() {
  return ash::TabletMode::IsInTabletMode();
}

// Returns whether the session is active.
bool IsSessionActive() {
  return session_manager::SessionManager::Get()->session_state() ==
         session_manager::SessionState::ACTIVE;
}

}  // namespace

AppListClientImpl::AppListClientImpl()
    : app_list_controller_(ash::AppListController::Get()),
      app_list_notifier_(
          std::make_unique<AppListNotifierImpl>(app_list_controller_)) {
  app_list_controller_->SetClient(this);
  user_manager::UserManager::Get()->AddSessionStateObserver(this);
  session_manager::SessionManager::Get()->AddObserver(this);

  DCHECK(!g_app_list_client_instance);
  g_app_list_client_instance = this;
}

AppListClientImpl::~AppListClientImpl() {
  SetProfile(nullptr);

  auto* user_manager = user_manager::UserManager::Get();
  user_manager->RemoveSessionStateObserver(this);

  // We assume that the current user is new if `state_for_new_user_` has value.
  if (state_for_new_user_.has_value() &&
      !state_for_new_user_->showing_recorded) {
    DCHECK(user_manager->IsCurrentUserNew());

    // Prefer the function to the macro because the usage data is recorded no
    // more than once per second.
    base::UmaHistogramEnumeration(
        "Apps.AppListUsageByNewUsers",
        AppListUsageStateByNewUsers::kNotUsedBeforeDestruction);
  }

  session_manager::SessionManager::Get()->RemoveObserver(this);

  DCHECK_EQ(this, g_app_list_client_instance);
  g_app_list_client_instance = nullptr;

  if (app_list_controller_)
    app_list_controller_->SetClient(nullptr);
}

// static
AppListClientImpl* AppListClientImpl::GetInstance() {
  return g_app_list_client_instance;
}

void AppListClientImpl::OnAppListControllerDestroyed() {
  // |app_list_controller_| could be released earlier, e.g. starting a kiosk
  // next session.
  app_list_controller_ = nullptr;
  if (current_model_updater_)
    current_model_updater_->SetActive(false);
}

void AppListClientImpl::StartZeroStateSearch(base::OnceClosure on_done,
                                             base::TimeDelta timeout) {
  // TODO(https://crbug.com/1269115): Refresh the zero state results.
  base::SequencedTaskRunnerHandle::Get()->PostDelayedTask(
      FROM_HERE, std::move(on_done), timeout);
}

void AppListClientImpl::StartSearch(const std::u16string& trimmed_query) {
  if (search_controller_) {
    search_controller_->Start(trimmed_query);
    OnSearchStarted();
  }
}

void AppListClientImpl::OpenSearchResult(
    int profile_id,
    const std::string& result_id,
    ash::AppListSearchResultType result_type,
    int event_flags,
    ash::AppListLaunchedFrom launched_from,
    ash::AppListLaunchType launch_type,
    int suggestion_index,
    bool launch_as_default) {
  if (!search_controller_)
    return;

  auto requested_model_updater_iter = profile_model_mappings_.find(profile_id);
  DCHECK(requested_model_updater_iter != profile_model_mappings_.end());
  DCHECK_EQ(current_model_updater_, requested_model_updater_iter->second);

  ChromeSearchResult* result = search_controller_->FindSearchResult(result_id);
  if (!result)
    return;

  app_list::LaunchData launch_data;
  launch_data.id = result_id;
  launch_data.result_type = result_type;
  launch_data.ranking_item_type =
      app_list::RankingItemTypeFromSearchResult(*result);
  launch_data.launch_type = launch_type;
  launch_data.launched_from = launched_from;
  launch_data.suggestion_index = suggestion_index;
  launch_data.score = result->relevance();

  if (launch_type == ash::AppListLaunchType::kAppSearchResult &&
      launched_from == ash::AppListLaunchedFrom::kLaunchedFromSearchBox &&
      launch_data.ranking_item_type == app_list::RankingItemType::kApp &&
      search_controller_->GetLastQueryLength() != 0) {
    ash::RecordSuccessfulAppLaunchUsingSearch(
        launched_from, search_controller_->GetLastQueryLength());
  }

  // Send training signal to search controller.
  search_controller_->Train(std::move(launch_data));

  RecordSearchResultOpenTypeHistogram(launched_from, result->metrics_type(),
                                      IsTabletMode());

  if (launch_as_default)
    RecordDefaultSearchResultOpenTypeHistogram(result->metrics_type());

  if (!search_controller_->GetLastQueryLength() &&
      launched_from == ash::AppListLaunchedFrom::kLaunchedFromSearchBox)
    RecordZeroStateSuggestionOpenTypeHistogram(result->metrics_type());

  if (launched_from == ash::AppListLaunchedFrom::kLaunchedFromSearchBox)
    RecordOpenedResultFromSearchBox(result_type);

  MaybeRecordLauncherAction(launched_from);

  // OpenResult may cause |result| to be deleted.
  search_controller_->OpenResult(result, event_flags);
}

void AppListClientImpl::InvokeSearchResultAction(
    const std::string& result_id,
    ash::SearchResultActionType action) {
  if (!search_controller_)
    return;
  ChromeSearchResult* result = search_controller_->FindSearchResult(result_id);
  if (result)
    search_controller_->InvokeResultAction(result, action);
}

void AppListClientImpl::GetSearchResultContextMenuModel(
    const std::string& result_id,
    GetContextMenuModelCallback callback) {
  if (!search_controller_) {
    std::move(callback).Run(nullptr);
    return;
  }
  ChromeSearchResult* result = search_controller_->FindSearchResult(result_id);
  if (!result) {
    std::move(callback).Run(nullptr);
    return;
  }
  result->GetContextMenuModel(base::BindOnce(
      [](GetContextMenuModelCallback callback,
         std::unique_ptr<ui::SimpleMenuModel> menu_model) {
        std::move(callback).Run(std::move(menu_model));
      },
      std::move(callback)));
}

void AppListClientImpl::ViewClosing() {
  display_id_ = display::kInvalidDisplayId;
  if (search_controller_)
    search_controller_->ViewClosing();
}

void AppListClientImpl::ViewShown(int64_t display_id) {
  MaybeRecordViewShown();

  if (current_model_updater_) {
    base::RecordAction(base::UserMetricsAction("Launcher_Show"));
    base::UmaHistogramSparse("Apps.AppListBadgedAppsCount",
                             current_model_updater_->BadgedItemCount());
  }
  display_id_ = display_id;
}

void AppListClientImpl::ActivateItem(int profile_id,
                                     const std::string& id,
                                     int event_flags) {
  auto* requested_model_updater = profile_model_mappings_[profile_id];

  // Pointless to notify the AppListModelUpdater of the activated item if the
  // |requested_model_updater| is not the current one, which means that the
  // active profile is changed. The same rule applies to the GetContextMenuModel
  // and ContextMenuItemSelected.
  if (requested_model_updater != current_model_updater_ ||
      !requested_model_updater) {
    return;
  }

  // Send a training signal to the search controller.
  const auto* item = current_model_updater_->FindItem(id);
  if (item) {
    app_list::LaunchData launch_data;
    launch_data.id = id;
    // We don't have easy access to the search result type here, so
    // launch_data.result_type isn't set. However we have no need to distinguish
    // the type of apps launched from the grid in SearchController::Train.
    launch_data.ranking_item_type =
        app_list::RankingItemTypeFromChromeAppListItem(*item);
    launch_data.launched_from = ash::AppListLaunchedFrom::kLaunchedFromGrid;
    search_controller_->Train(std::move(launch_data));
  }

  MaybeRecordLauncherAction(ash::AppListLaunchedFrom::kLaunchedFromGrid);
  requested_model_updater->ActivateChromeItem(id, event_flags);
}

void AppListClientImpl::GetContextMenuModel(
    int profile_id,
    const std::string& id,
    bool add_sort_options,
    GetContextMenuModelCallback callback) {
  auto* requested_model_updater = profile_model_mappings_[profile_id];
  if (requested_model_updater != current_model_updater_ ||
      !requested_model_updater) {
    std::move(callback).Run(nullptr);
    return;
  }
  requested_model_updater->GetContextMenuModel(
      id, add_sort_options,
      base::BindOnce(
          [](GetContextMenuModelCallback callback,
             std::unique_ptr<ui::SimpleMenuModel> menu_model) {
            std::move(callback).Run(std::move(menu_model));
          },
          std::move(callback)));
}

void AppListClientImpl::OnAppListVisibilityWillChange(bool visible) {
  app_list_target_visibility_ = visible;
  if (visible && search_controller_)
    search_controller_->Start(std::u16string());
}

void AppListClientImpl::OnAppListVisibilityChanged(bool visible) {
  app_list_visible_ = visible;
  if (visible) {
    if (search_controller_)
      search_controller_->AppListShown();
  } else if (current_model_updater_) {
    current_model_updater_->OnAppListHidden();
  }
}

void AppListClientImpl::OnSearchResultVisibilityChanged(const std::string& id,
                                                        bool visibility) {
  if (!search_controller_)
    return;

  ChromeSearchResult* result = search_controller_->FindSearchResult(id);
  if (result == nullptr) {
    return;
  }
  result->OnVisibilityChanged(visibility);
}

void AppListClientImpl::OnQuickSettingsChanged(
    const std::string& setting_name,
    const std::map<std::string, int>& values) {
  // CrOS action recorder.
  app_list::CrOSActionRecorder::GetCrosActionRecorder()->RecordAction(
      {base::StrCat({"SettingsChanged-", setting_name})}, values);
}

void AppListClientImpl::ActiveUserChanged(user_manager::User* active_user) {
  if (user_manager::UserManager::Get()->IsCurrentUserNew()) {
    // In tests, the user before switching and the one after switching may
    // be both new. It should not happen in the real world.
    state_for_new_user_ = StateForNewUser();
  } else if (state_for_new_user_) {
    if (!state_for_new_user_->showing_recorded) {
      // We assume that the previous user before switching was new if
      // `state_for_new_user_` is not null.
      base::UmaHistogramEnumeration(
          "Apps.AppListUsageByNewUsers",
          AppListUsageStateByNewUsers::kNotUsedBeforeSwitchingAccounts);
    }
    state_for_new_user_.reset();
  }

  if (!active_user->is_profile_created())
    return;

  UpdateProfile();
}

void AppListClientImpl::UpdateProfile() {
  Profile* profile = ProfileManager::GetActiveUserProfile();
  app_list::AppListSyncableService* syncable_service =
      app_list::AppListSyncableServiceFactory::GetForProfile(profile);
  // AppListSyncableService is null in tests.
  if (syncable_service)
    SetProfile(profile);
}

void AppListClientImpl::SetProfile(Profile* new_profile) {
  if (profile_ == new_profile)
    return;

  if (profile_) {
    DCHECK(current_model_updater_);
    current_model_updater_->SetActive(false);

    search_controller_.reset();
    app_sync_ui_state_watcher_.reset();
    current_model_updater_ = nullptr;
  }

  template_url_service_observation_.Reset();

  profile_ = new_profile;
  if (!profile_) {
    GetAppListController()->ClearActiveModel();
    return;
  }

  // If we are in guest mode, the new profile should be an OffTheRecord profile.
  // Otherwise, this may later hit a check (same condition as this one) in
  // Browser::Browser when opening links in a browser window (see
  // http://crbug.com/460437).
  DCHECK(!profile_->IsGuestSession() || profile_->IsOffTheRecord())
      << "Guest mode must use OffTheRecord profile";

  template_url_service_observation_.Observe(
      TemplateURLServiceFactory::GetForProfile(profile_));

  app_list::AppListSyncableService* syncable_service =
      app_list::AppListSyncableServiceFactory::GetForProfile(profile_);

  current_model_updater_ = syncable_service->GetModelUpdater();
  current_model_updater_->SetActive(true);

  // On ChromeOS, there is no way to sign-off just one user. When signing off
  // all users, AppListClientImpl instance is destructed before profiles are
  // unloaded. So we don't need to remove elements from
  // |profile_model_mappings_| explicitly.
  profile_model_mappings_[current_model_updater_->model_id()] =
      current_model_updater_;

  app_sync_ui_state_watcher_ =
      std::make_unique<AppSyncUIStateWatcher>(profile_, current_model_updater_);

  SetUpSearchUI();
  OnTemplateURLServiceChanged();

  // Clear search query.
  current_model_updater_->UpdateSearchBox(std::u16string(),
                                          false /* initiated_by_user */);
}

void AppListClientImpl::SetUpSearchUI() {
  search_controller_ = app_list::CreateSearchController(
      profile_, current_model_updater_, this, GetNotifier());

  // Refresh the results used for the suggestion chips with empty query.
  // This fixes crbug.com/999287.
  StartSearch(std::u16string());
}

app_list::SearchController* AppListClientImpl::search_controller() {
  return search_controller_.get();
}

void AppListClientImpl::SetSearchControllerForTest(
    std::unique_ptr<app_list::SearchController> test_controller) {
  search_controller_ = std::move(test_controller);
}

AppListModelUpdater* AppListClientImpl::GetModelUpdaterForTest() {
  return current_model_updater_;
}

void AppListClientImpl::InitializeAsIfNewUserLoginForTest() {
  new_user_session_activation_time_ = base::Time::Now();
  state_for_new_user_ = StateForNewUser();
}

void AppListClientImpl::OnSessionStateChanged() {
  // Return early if the current user is not new or the session is not active.
  if (!user_manager::UserManager::Get()->IsCurrentUserNew() ||
      !IsSessionActive()) {
    return;
  }

  new_user_session_activation_time_ = base::Time::Now();
}

void AppListClientImpl::OnTemplateURLServiceChanged() {
  DCHECK(current_model_updater_);

  TemplateURLService* template_url_service =
      TemplateURLServiceFactory::GetForProfile(profile_);
  const TemplateURL* default_provider =
      template_url_service->GetDefaultSearchProvider();
  const bool is_google =
      default_provider &&
      default_provider->GetEngineType(
          template_url_service->search_terms_data()) == SEARCH_ENGINE_GOOGLE;

  current_model_updater_->SetSearchEngineIsGoogle(is_google);
}

void AppListClientImpl::ShowAppList() {
  // This may not work correctly if the profile passed in is different from the
  // one the ash Shell is currently using.
  if (!app_list_controller_)
    return;
  app_list_controller_->ShowAppList();
}

Profile* AppListClientImpl::GetCurrentAppListProfile() const {
  return ChromeShelfController::instance()->profile();
}

ash::AppListController* AppListClientImpl::GetAppListController() const {
  return app_list_controller_;
}

void AppListClientImpl::DismissView() {
  if (!app_list_controller_)
    return;
  app_list_controller_->DismissAppList();
}

aura::Window* AppListClientImpl::GetAppListWindow() {
  return app_list_controller_->GetWindow();
}

int64_t AppListClientImpl::GetAppListDisplayId() {
  return display_id_;
}

bool AppListClientImpl::IsAppPinned(const std::string& app_id) {
  return ChromeShelfController::instance()->IsAppPinned(app_id);
}

bool AppListClientImpl::IsAppOpen(const std::string& app_id) const {
  return ChromeShelfController::instance()->IsOpen(ash::ShelfID(app_id));
}

void AppListClientImpl::PinApp(const std::string& app_id) {
  PinAppWithIDToShelf(app_id);
}

void AppListClientImpl::UnpinApp(const std::string& app_id) {
  UnpinAppWithIDFromShelf(app_id);
}

AppListControllerDelegate::Pinnable AppListClientImpl::GetPinnable(
    const std::string& app_id) {
  return GetPinnableForAppID(app_id,
                             ChromeShelfController::instance()->profile());
}

void AppListClientImpl::CreateNewWindow(bool incognito,
                                        bool should_trigger_session_restore) {
  ash::NewWindowDelegate::GetInstance()->NewWindow(
      incognito, should_trigger_session_restore);
}

void AppListClientImpl::OpenURL(Profile* profile,
                                const GURL& url,
                                ui::PageTransition transition,
                                WindowOpenDisposition disposition) {
  if (crosapi::browser_util::IsLacrosPrimaryBrowser()) {
    const GURL sanitized_url =
        crosapi::gurl_os_handler_utils::SanitizeAshURL(url);
    if ((PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_TYPED) ||
         PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_GENERATED)) &&
        ChromeWebUIControllerFactory::GetInstance()->CanHandleUrl(
            sanitized_url)) {
      // Let our os url handler take care of the call.
      crosapi::UrlHandlerAsh().OpenUrl(sanitized_url);
    } else {
      // Send the url to the current primary browser.
      ash::NewWindowDelegate::GetPrimary()->OpenUrl(url, true);
    }
  } else {
    NavigateParams params(profile, url, transition);
    params.disposition = disposition;
    Navigate(&params);
  }
}

void AppListClientImpl::NotifySearchResultsForLogging(
    const std::u16string& trimmed_query,
    const ash::SearchResultIdWithPositionIndices& results,
    int position_index) {
  if (search_controller_) {
    search_controller_->OnSearchResultsImpressionMade(trimmed_query, results,
                                                      position_index);
  }
}

ash::AppListNotifier* AppListClientImpl::GetNotifier() {
  return app_list_notifier_.get();
}

void AppListClientImpl::LoadIcon(int profile_id, const std::string& app_id) {
  auto* requested_model_updater = profile_model_mappings_[profile_id];
  if (requested_model_updater != current_model_updater_ ||
      !requested_model_updater) {
    return;
  }
  requested_model_updater->LoadAppIcon(app_id);
}

void AppListClientImpl::MaybeRecordViewShown() {
  // Record the time duration between session activation and the first launcher
  // showing if the current user is new.

  // We do not need to worry about the scenario below:
  // log in to a new account -> switch to another account -> switch back to the
  // initial account-> show the launcher
  // In this case, when showing the launcher, the current user is not
  // new anymore.
  // TODO(https://crbug.com/1211620): If this bug is fixed, we might need to
  // do some changes here.
  if (!user_manager::UserManager::Get()->IsCurrentUserNew()) {
    DCHECK(!state_for_new_user_);
    return;
  }

  // Record launcher usage only when the session is active.
  // TODO(https://crbug.com/1248250): handle ui events during OOBE in a more
  // elegant way. For example, do not bother showing the app list when handling
  // the app list toggling event because the app list is not visible in OOBE.
  if (!IsSessionActive())
    return;

  // Return early if `state_for_new_user_` is null.
  // TODO(https://crbug.com/1278947): Theoretically, `state_for_new_user_`
  // should be meaningful when the current user is new. However, it is not hold
  // under some edge cases. When the root issue gets fixed, replace it with a
  // check statement.
  if (!state_for_new_user_)
    return;

  if (state_for_new_user_->showing_recorded) {
    // Showing launcher was recorded before so return early.
    return;
  }

  state_for_new_user_->showing_recorded = true;

  CHECK(new_user_session_activation_time_.has_value());
  const base::TimeDelta opening_duration =
      base::Time::Now() - *new_user_session_activation_time_;
  if (opening_duration >= base::TimeDelta()) {
    // `base::Time` may skew. Therefore only record when the time duration is
    // non-negative.
    UMA_HISTOGRAM_CUSTOM_TIMES(
        /*name=*/
        "Apps."
        "TimeDurationBetweenNewUserSessionActivationAndFirstLauncherOpening",
        /*sample=*/opening_duration, kTimeMetricsMin, kTimeMetricsMax,
        kTimeMetricsBucketCount);

    base::UmaHistogramEnumeration("Apps.AppListUsageByNewUsers",
                                  AppListUsageStateByNewUsers::kUsed);
  }
}

void AppListClientImpl::RecordOpenedResultFromSearchBox(
    ash::AppListSearchResultType result_type) {
  // Check whether there is any Chrome non-app browser window open and not
  // minimized.
  bool non_app_browser_open_and_not_minimzed = false;
  for (auto* browser : *BrowserList::GetInstance()) {
    if (browser->type() != Browser::TYPE_NORMAL ||
        browser->window()->IsMinimized()) {
      // Skip if `browser` is not a normal browser or `browser` is minimized.
      continue;
    }

    non_app_browser_open_and_not_minimzed = true;
    break;
  }

  if (non_app_browser_open_and_not_minimzed) {
    UMA_HISTOGRAM_ENUMERATION(
        "Apps.OpenedAppListSearchResultFromSearchBox."
        "ExistNonAppBrowserWindowOpenAndNotMinimized",
        result_type);
  } else {
    UMA_HISTOGRAM_ENUMERATION(
        "Apps.OpenedAppListSearchResultFromSearchBox."
        "NonAppBrowserWindowsEitherClosedOrMinimized",
        result_type);
  }
}

void AppListClientImpl::MaybeRecordLauncherAction(
    ash::AppListLaunchedFrom launched_from) {
  DCHECK(launched_from == ash::AppListLaunchedFrom::kLaunchedFromGrid ||
         launched_from ==
             ash::AppListLaunchedFrom::kLaunchedFromSuggestionChip ||
         launched_from == ash::AppListLaunchedFrom::kLaunchedFromSearchBox ||
         launched_from == ash::AppListLaunchedFrom::kLaunchedFromContinueTask);

  // Return early if the current user is not new.
  if (!user_manager::UserManager::Get()->IsCurrentUserNew()) {
    DCHECK(!state_for_new_user_);
    return;
  }

  // The launcher action has been recorded so return early.
  if (state_for_new_user_->action_recorded)
    return;

  state_for_new_user_->action_recorded = true;
  base::UmaHistogramEnumeration("Apps.FirstLauncherActionByNewUsers",
                                launched_from);

  DCHECK(new_user_session_activation_time_.has_value());
  const base::TimeDelta launcher_action_duration =
      base::Time::Now() - *new_user_session_activation_time_;
  if (launcher_action_duration >= base::TimeDelta()) {
    // `base::Time` may skew. Therefore only record when the time duration is
    // non-negative.
    UMA_HISTOGRAM_CUSTOM_TIMES(
        /*name=*/
        "Apps.TimeBetweenNewUserSessionActivationAndFirstLauncherAction",
        /*sample=*/launcher_action_duration, kTimeMetricsMin, kTimeMetricsMax,
        kTimeMetricsBucketCount);
  }
}


text:
'use strict';

const chai = require('chai');
const { Sequelize, DataTypes, Op } = require('@sequelize/core');

const expect = chai.expect;
const Support = require('../support');

describe(Support.getTestDialectTeaser('Model'), () => {
  describe('scope', () => {
    beforeEach(async function () {
      this.ScopeMe = this.sequelize.define('ScopeMe', {
        username: DataTypes.STRING,
        email: DataTypes.STRING,
        access_level: DataTypes.INTEGER,
        other_value: DataTypes.INTEGER,
      }, {
        scopes: {
          lowAccess: {
            attributes: ['other_value', 'access_level'],
            where: {
              access_level: {
                [Op.lte]: 5,
              },
            },
          },
          withName: {
            attributes: ['username'],
          },
          highAccess: {
            where: {
              [Op.or]: [
                { access_level: { [Op.gte]: 5 } },
                { access_level: { [Op.eq]: 10 } },
              ],
            },
          },
          lessThanFour: {
            where: {
              [Op.and]: [
                { access_level: { [Op.lt]: 4 } },
              ],
            },
          },
          issue8473: {
            where: {
              [Op.or]: {
                access_level: 3,
                other_value: 10,
              },
              access_level: 5,
            },
          },
          like_t: {
            where: Sequelize.where(Sequelize.fn('LOWER', Sequelize.col('username')), 'LIKE', '%t%'),
          },
        },
      });

      await this.sequelize.sync({ force: true });
      const records = [
        { username: 'tony', email: 'tony@sequelizejs.com', access_level: 3, other_value: 7 },
        { username: 'tobi', email: 'tobi@fakeemail.com', access_level: 10, other_value: 11 },
        { username: 'dan', email: 'dan@sequelizejs.com', access_level: 5, other_value: 10 },
        { username: 'fred', email: 'fred@foobar.com', access_level: 3, other_value: 7 },
      ];

      await this.ScopeMe.bulkCreate(records);
    });

    it('should be able to merge attributes as array', async function () {
      const record = await this.ScopeMe.scope('lowAccess', 'withName').findOne();
      expect(record.other_value).to.exist;
      expect(record.username).to.exist;
      expect(record.access_level).to.exist;
    });

    it('should work with Symbol operators', async function () {
      const record = await this.ScopeMe.scope('highAccess').findOne();
      expect(record.username).to.equal('tobi');
      const records0 = await this.ScopeMe.scope('lessThanFour').findAll();
      expect(records0).to.have.length(2);
      expect(records0[0].get('access_level')).to.equal(3);
      expect(records0[1].get('access_level')).to.equal(3);
      const records = await this.ScopeMe.scope('issue8473').findAll();
      expect(records).to.have.length(1);
      expect(records[0].get('access_level')).to.equal(5);
      expect(records[0].get('other_value')).to.equal(10);
    });

    it('should keep symbols after default assignment', async function () {
      const record = await this.ScopeMe.scope('highAccess').findOne();
      expect(record.username).to.equal('tobi');

      const records = await this.ScopeMe.scope('lessThanFour').findAll({
        where: {},
      });

      expect(records).to.have.length(2);
      expect(records[0].get('access_level')).to.equal(3);
      expect(records[1].get('access_level')).to.equal(3);
      await this.ScopeMe.scope('issue8473').findAll();
    });

    it('should not throw error with sequelize.where', async function () {
      const records = await this.ScopeMe.scope('like_t').findAll();
      expect(records).to.have.length(2);
    });
  });
});


text:
import { useRouterHistory } from 'react-router';
import createHistory from 'history/lib/createBrowserHistory';

let historyInstance: ?Object = null;

export default function getHistoryInstance(): Object {
  if (!historyInstance) {
    historyInstance = useRouterHistory(createHistory)();
  }

  return historyInstance;
}


text:
<?php

/**
 * PurePO
 * @company Frenzel GmbH
 * @copy    Frenzel GmbH 2013-2014
 * @contact philipp@frenzel.net
 */

//Set the default time zone to europe/berlin
ini_set('date.timezone','Europe/Berlin');

if (function_exists('date_default_timezone_set')) {
  date_default_timezone_set('Europe/Berlin');
}

function includeIfExists($file)
{
  if(file_exists($file)) {
    return include $file;
  }
}

// comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');

if(($baseConfig = includeIfExists(__DIR__.'/../config/web.php')) && ($localConfig = includeIfExists(__DIR__.'/../config/web-test.php'))) {
  $config = \yii\helpers\ArrayHelper::merge($baseConfig,$localConfig);
} else {
  $config = $baseConfig;
}

$application = new yii\web\Application($config);

$application->run();


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Sydowia 7(1-4): 16 (1953)

#### Original name
Puccinia huber-morathii Petr.

### Remarks
null


text: twitter hildosantosjr15@gmail.com


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project

     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.
-->
<com.android.launcher2.PagedViewWidget
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:orientation="vertical"

    android:background="@drawable/focusable_view_bg"
    android:focusable="true">

    <!-- The preview of the widget or shortcut. -->
    <com.android.launcher2.PagedViewWidgetImageView
        android:id="@+id/widget_preview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:paddingTop="@dimen/app_widget_preview_padding_top"
        android:paddingStart="@dimen/app_widget_preview_padding_left"
        android:paddingEnd="@dimen/app_widget_preview_padding_right"
        android:scaleType="matrix"
        android:background="@drawable/widget_container_holo" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/app_widget_preview_label_margin_top"
        android:layout_marginStart="@dimen/app_widget_preview_label_margin_left"
        android:layout_marginEnd="@dimen/app_widget_preview_label_margin_right"
        android:orientation="horizontal">
        <!-- The name of the widget. -->
        <TextView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/widget_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="start"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:fadingEdge="horizontal"

            android:textColor="#FFFFFFFF"
            android:textSize="13sp"
            android:textAlignment="viewStart" />

        <!-- The original dimensions of the widget (can't be the same text as above due to different
             style. -->
        <TextView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/widget_dims"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginStart="5dp"
            android:layout_weight="0"
            android:gravity="start"

            android:textColor="#FF555555"
            android:textSize="12sp" />
    </LinearLayout>

</com.android.launcher2.PagedViewWidget>


text:
package org.keycloak.testsuite.oauth;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.keycloak.models.OAuth2DeviceConfig.DEFAULT_OAUTH2_DEVICE_CODE_LIFESPAN;
import static org.keycloak.models.OAuth2DeviceConfig.DEFAULT_OAUTH2_DEVICE_POLLING_INTERVAL;

import org.jboss.arquillian.graphene.page.Page;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.models.ClientScopeModel;
import org.keycloak.models.OAuth2DeviceConfig;
import org.keycloak.models.utils.KeycloakModelUtils;
import org.keycloak.protocol.oidc.OIDCAdvancedConfigWrapper;
import org.keycloak.protocol.oidc.OIDCConfigAttributes;
import org.keycloak.representations.AccessToken;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.testsuite.AbstractKeycloakTest;
import org.keycloak.testsuite.Assert;
import org.keycloak.testsuite.AssertEvents;
import org.keycloak.testsuite.admin.ApiUtil;
import org.keycloak.testsuite.pages.ErrorPage;
import org.keycloak.testsuite.pages.OAuth2DeviceVerificationPage;
import org.keycloak.testsuite.pages.OAuthGrantPage;
import org.keycloak.testsuite.util.ClientBuilder;
import org.keycloak.testsuite.util.OAuthClient;
import org.keycloak.testsuite.util.RealmBuilder;
import org.keycloak.testsuite.util.UserBuilder;

import java.util.List;

/**
 * @author Hiroyuki Wada
 */
public class OAuth2DeviceAuthorizationGrantTest extends AbstractKeycloakTest {

    private static String userId;

    public static final String REALM_NAME = "test";
    public static final String DEVICE_APP = "test-device";
    public static final String DEVICE_APP_PUBLIC = "test-device-public";
    public static final String DEVICE_APP_PUBLIC_CUSTOM_CONSENT = "test-device-public-custom-consent";

    @Rule
    public AssertEvents events = new AssertEvents(this);

    @Page
    protected OAuth2DeviceVerificationPage verificationPage;

    @Page
    protected OAuthGrantPage grantPage;

    @Page
    protected ErrorPage errorPage;

    @Override
    public void addTestRealms(List<RealmRepresentation> testRealms) {
        RealmBuilder realm = RealmBuilder.create().name(REALM_NAME)
                .privateKey("MIICXAIBAAKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQABAoGAfmO8gVhyBxdqlxmIuglbz8bcjQbhXJLR2EoS8ngTXmN1bo2L90M0mUKSdc7qF10LgETBzqL8jYlQIbt+e6TH8fcEpKCjUlyq0Mf/vVbfZSNaVycY13nTzo27iPyWQHK5NLuJzn1xvxxrUeXI6A2WFpGEBLbHjwpx5WQG9A+2scECQQDvdn9NE75HPTVPxBqsEd2z10TKkl9CZxu10Qby3iQQmWLEJ9LNmy3acvKrE3gMiYNWb6xHPKiIqOR1as7L24aTAkEAtyvQOlCvr5kAjVqrEKXalj0Tzewjweuxc0pskvArTI2Oo070h65GpoIKLc9jf+UA69cRtquwP93aZKtW06U8dQJAF2Y44ks/mK5+eyDqik3koCI08qaC8HYq2wVl7G2QkJ6sbAaILtcvD92ToOvyGyeE0flvmDZxMYlvaZnaQ0lcSQJBAKZU6umJi3/xeEbkJqMfeLclD27XGEFoPeNrmdx0q10Azp4NfJAY+Z8KRyQCR2BEG+oNitBOZ+YXF9KCpH3cdmECQHEigJhYg+ykOvr1aiZUMFT72HU0jnmQe2FVekuG+LJUt2Tm7GtMjTFoGpf0JwrVuZN39fOYAlo+nTixgeW7X8Y=")
                .publicKey("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB")
                .testEventListener();

        ClientRepresentation app = ClientBuilder.create()
                .id(KeycloakModelUtils.generateId())
                .clientId("test-device")
                .secret("secret")
                .attribute(OAuth2DeviceConfig.OAUTH2_DEVICE_AUTHORIZATION_GRANT_ENABLED, "true")
                .build();
        realm.client(app);

        ClientRepresentation appPublic = ClientBuilder.create().id(KeycloakModelUtils.generateId()).publicClient()
            .clientId(DEVICE_APP_PUBLIC).attribute(OAuth2DeviceConfig.OAUTH2_DEVICE_AUTHORIZATION_GRANT_ENABLED, "true")
            .build();
        realm.client(appPublic);

        ClientRepresentation appPublicCustomConsent = ClientBuilder.create().id(KeycloakModelUtils.generateId()).publicClient()
                .clientId(DEVICE_APP_PUBLIC_CUSTOM_CONSENT).attribute(OAuth2DeviceConfig.OAUTH2_DEVICE_AUTHORIZATION_GRANT_ENABLED, "true")
                .consentRequired(true)
                .attribute(ClientScopeModel.DISPLAY_ON_CONSENT_SCREEN, "true")
                .attribute(ClientScopeModel.CONSENT_SCREEN_TEXT, "This is the custom consent screen text.")
                .build();
        realm.client(appPublicCustomConsent);

        userId = KeycloakModelUtils.generateId();
        UserRepresentation user = UserBuilder.create()
                .id(userId)
                .username("device-login")
                .email("device-login@localhost")
                .password("password")
                .build();
        realm.user(user);

        testRealms.add(realm.build());
    }

    @Before
    public void resetConfig() {
        RealmRepresentation realm = getAdminClient().realm(REALM_NAME).toRepresentation();
        realm.setOAuth2DeviceCodeLifespan(60);
        realm.setOAuth2DevicePollingInterval(5);
        getAdminClient().realm(REALM_NAME).update(realm);
    }

    @Test
    public void testConfidentialClient() throws Exception {
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        // Verify user code from verification page using browser
        openVerificationPage(response.getVerificationUri());
        verificationPage.assertCurrent();
        verificationPage.submit(response.getUserCode());

        loginPage.assertCurrent();

        // Do Login
        oauth.fillLoginForm("device-login", "password");

        // Consent
        grantPage.assertCurrent();
        grantPage.assertGrants(OAuthGrantPage.PROFILE_CONSENT_TEXT, OAuthGrantPage.EMAIL_CONSENT_TEXT, OAuthGrantPage.ROLES_CONSENT_TEXT);
        grantPage.accept();

        verificationPage.assertApprovedPage();

        // Token request from device
        OAuthClient.AccessTokenResponse tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

        Assert.assertEquals(200, tokenResponse.getStatusCode());

        String tokenString = tokenResponse.getAccessToken();
        assertNotNull(tokenString);
        AccessToken token = oauth.verifyToken(tokenString);

        assertNotNull(token);
    }

    @Test
    public void testPublicClient() throws Exception {
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP_PUBLIC);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP_PUBLIC, null);

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        openVerificationPage(response.getVerificationUriComplete());

        // Do Login
        oauth.fillLoginForm("device-login", "password");

        // Consent
        grantPage.accept();

        // Token request from device
        OAuthClient.AccessTokenResponse tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP_PUBLIC, null, response.getDeviceCode());

        Assert.assertEquals(200, tokenResponse.getStatusCode());

        String tokenString = tokenResponse.getAccessToken();
        assertNotNull(tokenString);
        AccessToken token = oauth.verifyToken(tokenString);

        assertNotNull(token);
    }

    @Test
    public void testPublicClientCustomConsent() throws Exception {
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP_PUBLIC_CUSTOM_CONSENT);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP_PUBLIC_CUSTOM_CONSENT, null);

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        openVerificationPage(response.getVerificationUriComplete());

        // Do Login
        oauth.fillLoginForm("device-login", "password");

        // Consent
        Assert.assertTrue(grantPage.getDisplayedGrants().contains("This is the custom consent screen text."));
        grantPage.accept();

        // Token request from device
        OAuthClient.AccessTokenResponse tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP_PUBLIC_CUSTOM_CONSENT, null, response.getDeviceCode());

        Assert.assertEquals(200, tokenResponse.getStatusCode());

        String tokenString = tokenResponse.getAccessToken();
        assertNotNull(tokenString);
        AccessToken token = oauth.verifyToken(tokenString);

        assertNotNull(token);
    }

    @Test
    public void testNoRefreshToken() throws Exception {
        ClientResource client = ApiUtil.findClientByClientId(adminClient.realm(REALM_NAME), DEVICE_APP);
        ClientRepresentation clientRepresentation = client.toRepresentation();
        clientRepresentation.getAttributes().put(OIDCConfigAttributes.USE_REFRESH_TOKEN, "false");
        client.update(clientRepresentation);
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        // Verify user code from verification page using browser
        openVerificationPage(response.getVerificationUri());
        verificationPage.submit(response.getUserCode());

        // Do Login
        oauth.fillLoginForm("device-login", "password");

        // Consent
        grantPage.accept();

        // Token request from device
        OAuthClient.AccessTokenResponse tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret",
            response.getDeviceCode());

        Assert.assertEquals(200, tokenResponse.getStatusCode());

        assertNotNull(tokenResponse.getAccessToken());
        assertNull(tokenResponse.getRefreshToken());

        clientRepresentation.getAttributes().put(OIDCConfigAttributes.USE_REFRESH_TOKEN, "true");
        client.update(clientRepresentation);
    }

    @Test
    public void testConsentCancel() throws Exception {
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        openVerificationPage(response.getVerificationUriComplete());
        loginPage.assertCurrent();

        // Do Login
        oauth.fillLoginForm("device-login", "password");

        // Consent
        grantPage.assertCurrent();
        grantPage.assertGrants(OAuthGrantPage.PROFILE_CONSENT_TEXT, OAuthGrantPage.EMAIL_CONSENT_TEXT, OAuthGrantPage.ROLES_CONSENT_TEXT);
        grantPage.cancel();

        verificationPage.assertDeniedPage();

        OAuthClient.AccessTokenResponse tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

        Assert.assertEquals(400, tokenResponse.getStatusCode());
        Assert.assertEquals("access_denied", tokenResponse.getError());
    }

    @Test
    public void testInvalidUserCode() throws Exception {
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        openVerificationPage(response.getVerificationUri());
        verificationPage.submit("x");

        verificationPage.assertInvalidUserCodePage();
    }

    @Test
    public void testExpiredUserCodeTest() throws Exception {
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        try {
            setTimeOffset(610);
            openVerificationPage(response.getVerificationUriComplete());
        } finally {
            resetTimeOffset();
        }

        verificationPage.assertExpiredUserCodePage();
    }

    @Test
    public void testInvalidDeviceCode() throws Exception {
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        openVerificationPage(response.getVerificationUriComplete());
        loginPage.assertCurrent();

        // Do Login
        oauth.fillLoginForm("device-login", "password");

        // Consent
        grantPage.assertCurrent();
        grantPage.assertGrants(OAuthGrantPage.PROFILE_CONSENT_TEXT, OAuthGrantPage.EMAIL_CONSENT_TEXT, OAuthGrantPage.ROLES_CONSENT_TEXT);
        grantPage.accept();

        // Token request from device
        OAuthClient.AccessTokenResponse tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", "x");

        Assert.assertEquals(400, tokenResponse.getStatusCode());
        Assert.assertEquals("invalid_grant", tokenResponse.getError());
    }

    @Test
    public void testSuccessVerificationUriComplete() throws Exception {
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        openVerificationPage(response.getVerificationUriComplete());
        loginPage.assertCurrent();

        // Do Login
        oauth.fillLoginForm("device-login", "password");

        // Consent
        grantPage.assertCurrent();
        grantPage.assertGrants(OAuthGrantPage.PROFILE_CONSENT_TEXT, OAuthGrantPage.EMAIL_CONSENT_TEXT, OAuthGrantPage.ROLES_CONSENT_TEXT);
        grantPage.accept();

        verificationPage.assertApprovedPage();

        // Token request from device
        OAuthClient.AccessTokenResponse tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

        Assert.assertEquals(200, tokenResponse.getStatusCode());
    }

    @Test
    public void testExpiredDeviceCode() throws Exception {
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        try {
            setTimeOffset(610);
            // Token request from device
            OAuthClient.AccessTokenResponse tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret",
                response.getDeviceCode());

            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("expired_token", tokenResponse.getError());
        } finally {
            resetTimeOffset();
        }
    }

    @Test
    public void testDeviceCodeLifespanPerClient() throws Exception {
        ClientResource client = ApiUtil.findClientByClientId(adminClient.realm(REALM_NAME), DEVICE_APP);
        ClientRepresentation clientRepresentation = client.toRepresentation();
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        clientRepresentation.getAttributes().put(OAuth2DeviceConfig.OAUTH2_DEVICE_CODE_LIFESPAN_PER_CLIENT, "120");
        clientRepresentation.getAttributes().put(OAuth2DeviceConfig.OAUTH2_DEVICE_POLLING_INTERVAL_PER_CLIENT, "600000");
        client.update(clientRepresentation);

        response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");
        Assert.assertEquals(120, response.getExpiresIn());
        OAuthClient.AccessTokenResponse tokenResponse;

        try {
            setTimeOffset(100);
            // Token request from device
            tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("authorization_pending", tokenResponse.getError());

            setTimeOffset(125);
            // Token request from device
            tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("expired_token", tokenResponse.getError());
        } finally {
            resetTimeOffset();
        }

        clientRepresentation.getAttributes().put(OAuth2DeviceConfig.OAUTH2_DEVICE_CODE_LIFESPAN_PER_CLIENT, "");
        clientRepresentation.getAttributes().put(OAuth2DeviceConfig.OAUTH2_DEVICE_POLLING_INTERVAL_PER_CLIENT, "");
        client.update(clientRepresentation);
    }

    @Test
    public void testDevicePollingIntervalPerClient() throws Exception {
        getTestingClient().testing().setTestingInfinispanTimeService();
        ClientResource client = ApiUtil.findClientByClientId(adminClient.realm(REALM_NAME), DEVICE_APP);
        ClientRepresentation clientRepresentation = client.toRepresentation();
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        clientRepresentation.getAttributes().put(OAuth2DeviceConfig.OAUTH2_DEVICE_POLLING_INTERVAL_PER_CLIENT, "10");
        client.update(clientRepresentation);

        response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");
        Assert.assertEquals(10, response.getInterval());

        try {
            // Token request from device
            OAuthClient.AccessTokenResponse tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret",
                response.getDeviceCode());

            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("authorization_pending", tokenResponse.getError());

            // Token request from device
            tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("slow_down", tokenResponse.getError());

            setTimeOffset(7);

            // Token request from device
            tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("slow_down", tokenResponse.getError());

            setTimeOffset(10);

            // Token request from device
            tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("authorization_pending", tokenResponse.getError());
        } finally {
            getTestingClient().testing().revertTestingInfinispanTimeService();
            clientRepresentation.getAttributes().put(OAuth2DeviceConfig.OAUTH2_DEVICE_POLLING_INTERVAL_PER_CLIENT, "");
            client.update(clientRepresentation);
        }
    }

    @Test
    public void testPooling() throws Exception {
        getTestingClient().testing().setTestingInfinispanTimeService();

        try {
            RealmRepresentation realm = getAdminClient().realm(REALM_NAME).toRepresentation();
            realm.setOAuth2DeviceCodeLifespan(600);
            getAdminClient().realm(REALM_NAME).update(realm);
            // Device Authorization Request from device
            oauth.realm(REALM_NAME);
            oauth.clientId(DEVICE_APP);
            OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

            Assert.assertEquals(600, response.getExpiresIn());
            Assert.assertEquals(5, response.getInterval());

            // Polling token request from device
            OAuthClient.AccessTokenResponse tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            // Not approved yet
            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("authorization_pending", tokenResponse.getError());

            // Polling again without waiting
            tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            // Slow down
            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("slow_down", tokenResponse.getError());

            // Wait the interval
            setTimeOffset(5);

            // Polling again
            tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            // Not approved yet
            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("authorization_pending", tokenResponse.getError());

            // Change the interval setting of the realm from 5 seconds to 10 seconds.
            realm.setOAuth2DevicePollingInterval(10);
            getAdminClient().realm(REALM_NAME).update(realm);

            // Checking the new interval is applied
            response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

            Assert.assertEquals(600, response.getExpiresIn());
            Assert.assertEquals(10, response.getInterval());

            // Polling token request from device
            tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            // Not approved yet
            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("authorization_pending", tokenResponse.getError());

            // Wait
            setTimeOffset(10);

            // Polling again without waiting
            tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            // Slow down
            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("slow_down", tokenResponse.getError());

            // Wait
            setTimeOffset(15);

            // Polling again
            tokenResponse = oauth.doDeviceTokenRequest(DEVICE_APP, "secret", response.getDeviceCode());

            // Not approved yet
            Assert.assertEquals(400, tokenResponse.getStatusCode());
            Assert.assertEquals("authorization_pending", tokenResponse.getError());
        } finally {
            getTestingClient().testing().revertTestingInfinispanTimeService();
        }
    }

    @Test
    public void testUpdateConfig() {
        RealmResource realm = getAdminClient().realm(REALM_NAME);
        RealmRepresentation rep = realm.toRepresentation();

        rep.setOAuth2DevicePollingInterval(DEFAULT_OAUTH2_DEVICE_POLLING_INTERVAL);
        rep.setOAuth2DeviceCodeLifespan(DEFAULT_OAUTH2_DEVICE_CODE_LIFESPAN);

        realm.update(rep);
        rep = realm.toRepresentation();

        Assert.assertEquals(DEFAULT_OAUTH2_DEVICE_POLLING_INTERVAL, rep.getOAuth2DevicePollingInterval().intValue());
        Assert.assertEquals(DEFAULT_OAUTH2_DEVICE_CODE_LIFESPAN, rep.getOAuth2DeviceCodeLifespan().intValue());

        rep.setOAuth2DevicePollingInterval(10);
        rep.setOAuth2DeviceCodeLifespan(15);

        realm.update(rep);
        rep = realm.toRepresentation();

        Assert.assertEquals(10, rep.getOAuth2DevicePollingInterval().intValue());
        Assert.assertEquals(15, rep.getOAuth2DeviceCodeLifespan().intValue());
    }

    // KEYCLOAK-19700
    @Test
    public void testConsentCancelCannotBeReused() throws Exception {
        // Device Authorization Request from device
        oauth.realm(REALM_NAME);
        oauth.clientId(DEVICE_APP);
        OAuthClient.DeviceAuthorizationResponse response = oauth.doDeviceAuthorizationRequest(DEVICE_APP, "secret");

        Assert.assertEquals(200, response.getStatusCode());
        assertNotNull(response.getDeviceCode());
        assertNotNull(response.getUserCode());
        assertNotNull(response.getVerificationUri());
        assertNotNull(response.getVerificationUriComplete());
        Assert.assertEquals(60, response.getExpiresIn());
        Assert.assertEquals(5, response.getInterval());

        openVerificationPage(response.getVerificationUriComplete());
        loginPage.assertCurrent();

        // Do Login
        oauth.fillLoginForm("device-login", "password");

        // Consent
        grantPage.assertCurrent();
        grantPage.cancel();

        verificationPage.assertDeniedPage();

        openVerificationPage(response.getVerificationUriComplete());

        verificationPage.assertInvalidUserCodePage();
    }

    private void openVerificationPage(String verificationUri) {
        driver.navigate().to(verificationUri);
    }
}