text:
package com.thoughtworks.go.server.service;

import com.thoughtworks.go.config.CaseInsensitiveString;
import com.thoughtworks.go.config.CruiseConfig;
import com.thoughtworks.go.config.PipelineConfig;
import com.thoughtworks.go.config.exceptions.EntityType;
import com.thoughtworks.go.domain.PipelinePauseInfo;
import com.thoughtworks.go.i18n.LocalizedMessage;
import com.thoughtworks.go.server.dao.PipelineSqlMapDao;
import com.thoughtworks.go.server.domain.PipelinePauseChangeListener;
import com.thoughtworks.go.server.domain.Username;
import com.thoughtworks.go.server.newsecurity.utils.SessionUtils;
import com.thoughtworks.go.server.service.result.DefaultLocalizedOperationResult;
import com.thoughtworks.go.server.service.result.LocalizedOperationResult;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

import static com.thoughtworks.go.serverhealth.HealthStateScope.forPipeline;
import static com.thoughtworks.go.serverhealth.HealthStateType.forbiddenForPipeline;
import static com.thoughtworks.go.serverhealth.HealthStateType.general;

@Service
public class PipelinePauseService {

    private PipelineSqlMapDao pipelineSqlMapDao;
    private final GoConfigService goConfigService;
    private final SecurityService securityService;

    private static final Logger LOGGER = LoggerFactory.getLogger(PipelinePauseService.class);
    private List<PipelinePauseChangeListener> listeners = new ArrayList<>();

    @Autowired
    public PipelinePauseService(PipelineSqlMapDao pipelineSqlMapDao, GoConfigService goConfigService, SecurityService securityService) {
        this.pipelineSqlMapDao = pipelineSqlMapDao;
        this.goConfigService = goConfigService;
        this.securityService = securityService;
    }

    public void pause(String pipelineName, String pauseCause, Username userName) {
        pause(pipelineName, pauseCause, userName, new DefaultLocalizedOperationResult());
    }

    public void pause(String pipelineName, String pauseCause, Username pausedBy, LocalizedOperationResult result) {
        String pauseByUserName = pausedBy == null ? "" : pausedBy.getUsername().toString();
        if (pipelineDoesNotExist(pipelineName, result) || notAuthorized(pipelineName, pauseByUserName, result)) {
            return;
        }
        if (StringUtils.isBlank(pauseCause)) {
            pauseCause = "";
        }
        if (isPipelinePaused(pipelineName)) {
            result.conflict("Failed to pause pipeline '" +pipelineName + "'. Pipeline '" +pipelineName + "' is already paused.");
            return;
        }
        try {
            pausePipeline(pipelineName, pauseCause, pausedBy);
            result.setMessage("Pipeline '" + pipelineName + "' paused successfully.");
        } catch (Exception e) {
            LOGGER.error("[Pipeline Pause] Failed to pause pipeline", e);
            result.internalServerError("Server error occured. Check log for details.");
        }
    }

    private boolean isPipelinePaused(String pipelineName) {
        return pipelineSqlMapDao.pauseState(pipelineName).isPaused();
    }

    public void unpause(String pipelineName) {
        unpause(pipelineName, SessionUtils.currentUsername(), new DefaultLocalizedOperationResult());
    }

    public void unpause(String pipelineName, Username unpausedBy, LocalizedOperationResult result) {
        String unpauseByUserName = unpausedBy == null ? "" : unpausedBy.getUsername().toString();
        if (pipelineDoesNotExist(pipelineName, result) || notAuthorized(pipelineName, unpauseByUserName, result)) {
            return;
        }
        if (!isPipelinePaused(pipelineName)) {
            result.conflict("Failed to unpause pipeline '" + pipelineName + "'. Pipeline '" + pipelineName + "' is already unpaused.");
            return;
        }
        try {
            unpausePipeline(pipelineName, unpausedBy);
            result.setMessage("Pipeline '" + pipelineName + "' unpaused successfully.");
        } catch (Exception e) {
            LOGGER.error("[Pipeline Unpause] Failed to unpause pipeline", e);
            result.internalServerError("Server error occured. Check log for details.");
        }
    }

    public void registerListener(PipelinePauseChangeListener pipelinePauseChangeListener) {
        listeners.add(pipelinePauseChangeListener);
    }

    public PipelinePauseInfo pipelinePauseInfo(String pipelineName) {
        PipelinePauseInfo pipelinePauseInfo = pipelineSqlMapDao.pauseState(pipelineName);
        return pipelinePauseInfo == null ? PipelinePauseInfo.notPaused() : pipelinePauseInfo;
    }

    public boolean isPaused(String pipelineName) {
        return pipelinePauseInfo(pipelineName).isPaused();
    }

    private void pausePipeline(String pipelineName, String pauseCause, Username pauseBy) {
        String mutexPipelineName = mutexForPausePipeline(pipelineName);
        synchronized (mutexPipelineName) {
            String sanitizedPauseCause = pauseCause.substring(0, Math.min(255, pauseCause.length()));
            String pauseByDisplayName = pauseBy.getDisplayName();
            String sanitizedPauseBy = pauseByDisplayName.substring(0, Math.min(255, pauseByDisplayName.length()));
            pipelineSqlMapDao.pause(pipelineName, sanitizedPauseCause, sanitizedPauseBy);
            LOGGER.info("[Pipeline Pause] Pipeline [{}] is paused by [{}] because [{}]", pipelineName, pauseBy, pauseCause);
            notifyListeners(PipelinePauseChangeListener.Event.pause(pipelineName, pauseBy));
        }
    }

    private boolean notAuthorized(String pipelineName, String pauseBy, LocalizedOperationResult result) {
        CruiseConfig cruiseConfig = goConfigService.getCurrentConfig();
        PipelineConfig pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
        if (securityService.hasOperatePermissionForGroup(new CaseInsensitiveString(pauseBy), cruiseConfig.findGroupOfPipeline(pipelineConfig).getGroup())) {
            return false;
        }
        result.forbidden(LocalizedMessage.forbiddenToEditPipeline(pipelineName), forbiddenForPipeline(pipelineName));
        return true;
    }

    private boolean pipelineDoesNotExist(String pipelineName, LocalizedOperationResult result) {
        CruiseConfig cruiseConfig = goConfigService.getCurrentConfig();
        if (cruiseConfig.hasPipelineNamed(new CaseInsensitiveString(pipelineName))) {
            return false;
        }
        result.notFound(EntityType.Pipeline.notFoundMessage(pipelineName), general(forPipeline(pipelineName)));
        return true;
    }

    private void unpausePipeline(String pipelineName, Username unpausedBy) {
        String mutextPipelineName = mutexForPausePipeline(pipelineName);
        synchronized (mutextPipelineName) {
            pipelineSqlMapDao.unpause(pipelineName);
            LOGGER.info("[Pipeline Unpause] Pipeline [{}] is unpaused by [{}]", pipelineName, unpausedBy);
            notifyListeners(PipelinePauseChangeListener.Event.unPause(pipelineName, unpausedBy));
        }
    }

    /*
     * Mutex shared between PipelinePauseService and PipelineService. This is to avoid constraint violation when
     * updateCounter() and pause() are trying to insert pipeline row if one doesn't exist
     */
    public static String mutexForPausePipeline(String pipelineName) {
        return (PipelineSqlMapDao.class.getName() + "_mutexForPausePipeline_" + pipelineName).intern();
    }

    private void notifyListeners(PipelinePauseChangeListener.Event event) {
        for (PipelinePauseChangeListener listener : listeners) {
            try {
                LOGGER.debug("START  Notifying listener ({}) of event: {}", listener, event);

                listener.pauseStatusChanged(event);

                LOGGER.debug("FINISH Notifying listener ({}) of event: {}", listener, event);
            } catch (Exception e) {
                LOGGER.warn("Failed to notify listener ({}) of event: {}", listener, event);
            }
        }
    }
}


text:
'use strict';

var fs = require('fs'),
    path = require('path');

module.exports = function(grunt) {

  grunt.registerMultiTask('directory_to_json', 'Generate a JSON file to reflect the directory structure', function() {
    var rootDirectory = (this.data.root_directory !== undefined)? this.data.root_directory : '',
      sort_by = (this.data.sort_by !== undefined) ? this.data.sort_by : false,
      sort_dir = (this.data.sort_dir !== undefined) ? this.data.sort_dir : 'asc',
      include_nonfile = (this.data.include_nonfile !== undefined) ? this.data.include_nonfile : false;

    this.files.forEach(function(fileGroup) {

      var directoryStructure = {
        files: []
      };

      fileGroup.src.forEach(function(file){
        grunt.log.writeln('Processing File "' + file + '".');
        if (include_nonfile || grunt.file.isFile(file) )
        {
          var fileStructure = {},
              filestats = fs.statSync(file);
          fileStructure.path = rootDirectory + file;
          fileStructure.title = getTitle(file);
          fileStructure.is_file = grunt.file.isFile(file);
          fileStructure.modified = filestats.mtime;

          directoryStructure.files.push(fileStructure);
        }
      });
      var sort_function = null;
      if (sort_by == 'date')
      {
          sort_function = function(a,b){return a.modified-b.modified};
      } else if (sort_by =='title')
      {
          sort_function = function(a,b){return a.title-b.title};
      } else if (sort_by =='path')
      {
          sort_function = function(a,b){return a.path-b.path};
      }

      directoryStructure.files.sort(sort_function);
      if (sort_dir =='desc')
      {
        directoryStructure.files.reverse();
      }
      grunt.file.write(fileGroup.dest, JSON.stringify(directoryStructure, null, '\t'));

      grunt.log.writeln('File "' + fileGroup.dest + '" created.');
    });
  });

  function getTitle(fullPath) {
    var filepath = path.dirname(fullPath);
    if (!grunt.file.isFile(fullPath))
    {
      return filepath;
    }
    var type = path.extname(fullPath),
        filename = path.basename(fullPath, type),
        fileContents = grunt.file.read(fullPath),
        title = null;

    if (type == '.html')
    {
      title = fileContents.match(/<title>(.*)<\/title>/i);
      if (title === null)
      {
        //Perhaps it is a swig template masquarading as an .html
        type = '.swig';
      }

    }
    if (type == '.swig')
    {
      title = fileContents.match(/{% block title %}(.*){% endblock %}/i);
    }
    if (title === null)
    {
      title = filename;
    }else {
      title = title[1];
    }
    return title;
  }
};

redpajama_set_name: RedPajamaGithub


text:
from base import ADT

Maybe, Just, Nothing = ADT('Maybe', 'Just', ('just', 'a'),
                                    'Nothing',
                                    value=True)


text:
/****************************************************************************
 * Included Files
 ****************************************************************************/

#include <nuttx/config.h>

#include <sys/mman.h>

#include <stdlib.h>
#include <debug.h>

#include <nuttx/kmalloc.h>
#include <nuttx/binfmt/nxflat.h>

#include "libnxflat.h"

/****************************************************************************
 * Pre-Processor Definitions
 ****************************************************************************/

/****************************************************************************
 * Private Constant Data
 ****************************************************************************/

/****************************************************************************
 * Private Functions
 ****************************************************************************/

/****************************************************************************
 * Public Functions
 ****************************************************************************/

/****************************************************************************
 * Name: nxflat_unload
 *
 * Description:
 *   This function unloads the object from memory. This essentially undoes
 *   the actions of nxflat_load.  It is called only under certain error
 *   conditions after the the module has been loaded but not yet started.
 *
 * Returned Value:
 *   0 (OK) is returned on success and a negated errno is returned on
 *   failure.
 *
 ****************************************************************************/

int nxflat_unload(struct nxflat_loadinfo_s *loadinfo)
{
  /* Release the memory segments */
  /* Release the I-Space mmap'ed file */

  if (loadinfo->ispace)
    {
      munmap((void*)loadinfo->ispace, loadinfo->isize);
      loadinfo->ispace = 0;
    }

  /* Release the D-Space address environment */

  nxflat_addrenv_free(loadinfo);
  return OK;
}


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

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Default TreeView</title>

<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="../../build/treeview/assets/skins/sam/treeview.css" />

Default TreeView

In this simple example you see the default presentation for the TreeView Control.  Click on labels or on the expand/collapse icons for each node to interact with the TreeView Control.


text:
package logger

import (
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"os"
	"testing"
	"time"

	"github.com/rs/zerolog"
	"github.com/stretchr/testify/assert"
)

func TestHandler2xx(t *testing.T) {
	tmpfile, err := ioutil.TempFile("", "einfo")
	assert.NoError(t, err)
	defer os.Remove(tmpfile.Name())
	defer tmpfile.Close()

	logger := zerolog.New(tmpfile).With().Logger()

	req := httptest.NewRequest(http.MethodGet, "http://foo.com/health", nil)

	req = req.WithContext(logger.WithContext(req.Context()))

	Handler(req, http.StatusOK, 45, 2*time.Millisecond)

	actual, err := os.ReadFile(tmpfile.Name())
	assert.NoError(t, err)

	assert.Equal(t, "{\"level\":\"info\",\"method\":\"GET\",\"url\":\"http://foo.com/health\",\"status\":200,\"size\":45,\"duration\":2,\"message\":\"GET /health\"}\n", string(actual))
}

func TestHandler3xx(t *testing.T) {
	tmpfile, err := ioutil.TempFile("", "einfo")
	assert.NoError(t, err)
	defer os.Remove(tmpfile.Name())
	defer tmpfile.Close()

	logger := zerolog.New(tmpfile).With().Logger()

	req := httptest.NewRequest(http.MethodGet, "http://foo.com/health", nil)

	req = req.WithContext(logger.WithContext(req.Context()))

	Handler(req, http.StatusPermanentRedirect, 45, 2*time.Millisecond)

	actual, err := os.ReadFile(tmpfile.Name())
	assert.NoError(t, err)

	assert.Equal(t, "{\"level\":\"info\",\"method\":\"GET\",\"url\":\"http://foo.com/health\",\"status\":308,\"size\":45,\"duration\":2,\"message\":\"GET /health\"}\n", string(actual))
}

func TestHandler4xx(t *testing.T) {
	tmpfile, err := ioutil.TempFile("", "einfo")
	assert.NoError(t, err)
	defer os.Remove(tmpfile.Name())
	defer tmpfile.Close()

	logger := zerolog.New(tmpfile).With().Logger()

	req := httptest.NewRequest(http.MethodGet, "http://foo.com/health", nil)

	req = req.WithContext(logger.WithContext(req.Context()))

	Handler(req, http.StatusNotFound, 45, 2*time.Millisecond)

	actual, err := os.ReadFile(tmpfile.Name())
	assert.NoError(t, err)

	assert.Equal(t, "{\"level\":\"warn\",\"method\":\"GET\",\"url\":\"http://foo.com/health\",\"status\":404,\"size\":45,\"duration\":2,\"message\":\"GET /health\"}\n", string(actual))
}

func TestHandler5xx(t *testing.T) {
	tmpfile, err := ioutil.TempFile("", "einfo")
	assert.NoError(t, err)
	defer os.Remove(tmpfile.Name())
	defer tmpfile.Close()

	logger := zerolog.New(tmpfile).With().Logger()

	req := httptest.NewRequest(http.MethodGet, "http://foo.com/health", nil)

	req = req.WithContext(logger.WithContext(req.Context()))

	Handler(req, http.StatusInternalServerError, 45, 2*time.Millisecond)

	actual, err := os.ReadFile(tmpfile.Name())
	assert.NoError(t, err)

	assert.Equal(t, "{\"level\":\"error\",\"method\":\"GET\",\"url\":\"http://foo.com/health\",\"status\":500,\"size\":45,\"duration\":2,\"message\":\"GET /health\"}\n", string(actual))
}


text:
package org.mybatis.guice.transactional;

import javax.transaction.Transaction;

public class TransactionToken {
	private Transaction activeTransaction;
	private Transaction suspendedTransaction;
	private TransactionAttribute transactionAttribute;
	private boolean isCompletionAllowed;

	public TransactionToken(Transaction activeTransaction, Transaction suspendedTransaction,
			TransactionAttribute transactionAttribute) {
		this(activeTransaction, suspendedTransaction, transactionAttribute, false);
	}

	TransactionToken(Transaction activeTransaction, Transaction suspendedTransaction,
			TransactionAttribute transactionAttribute, boolean isCompletionAllowed) {
		this.activeTransaction = activeTransaction;
		this.suspendedTransaction = suspendedTransaction;
		this.transactionAttribute = transactionAttribute;
		this.isCompletionAllowed = isCompletionAllowed;
	}

	public Transaction getActiveTransaction() {
		return activeTransaction;
	}

	public void setActiveTransaction(Transaction activeTransaction) {
		this.activeTransaction = activeTransaction;
	}

	public Transaction getSuspendedTransaction() {
		return suspendedTransaction;
	}

	public void setSuspendedTransaction(Transaction suspendedTransaction) {
		this.suspendedTransaction = suspendedTransaction;
	}

	public TransactionAttribute getTransactionAttribute() {
		return transactionAttribute;
	}

	public void setTransactionStrategy(TransactionAttribute transactionAttribute) {
		this.transactionAttribute = transactionAttribute;
	}

	public boolean isCompletionAllowed() {
		return isCompletionAllowed;
	}

	public void setCompletionAllowed(boolean isCompletionAllowed) {
		this.isCompletionAllowed = isCompletionAllowed;
	}
}


text:
package org.springframework.boot.autoconfigure.jms.activemq;

import javax.jms.ConnectionFactory;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.pool.PooledConnectionFactory;
import org.junit.Test;

import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mockingDetails;

/**
 * Tests for {@link ActiveMQAutoConfiguration}.
 *
 * @author Andy Wilkinson
 * @author Aurélien Leboulanger
 * @author Stephane Nicoll
 */
public class ActiveMQAutoConfigurationTests {

	private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
			.withConfiguration(AutoConfigurations.of(ActiveMQAutoConfiguration.class,
					JmsAutoConfiguration.class));

	@Test
	public void brokerIsEmbeddedByDefault() {
		this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
				.run((context) -> {
					assertThat(context).getBean(ConnectionFactory.class)
							.isInstanceOf(ActiveMQConnectionFactory.class);
					assertThat(context.getBean(ActiveMQConnectionFactory.class)
							.getBrokerURL())
									.isEqualTo("vm://localhost?broker.persistent=false");
				});
	}

	@Test
	public void configurationBacksOffWhenCustomConnectionFactoryExists() {
		this.contextRunner
				.withUserConfiguration(CustomConnectionFactoryConfiguration.class)
				.run((context) -> assertThat(
						mockingDetails(context.getBean(ConnectionFactory.class)).isMock())
								.isTrue());
	}

	@Test
	public void defaultConnectionFactoryIsApplied() {
		this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
				.withPropertyValues("spring.activemq.pool.enabled=false")
				.run((context) -> {
					assertThat(context.getBeansOfType(ActiveMQConnectionFactory.class))
							.hasSize(1);
					ActiveMQConnectionFactory connectionFactory = context
							.getBean(ActiveMQConnectionFactory.class);
					ActiveMQConnectionFactory defaultFactory = new ActiveMQConnectionFactory(
							"vm://localhost?broker.persistent=false");
					assertThat(connectionFactory.getUserName())
							.isEqualTo(defaultFactory.getUserName());
					assertThat(connectionFactory.getPassword())
							.isEqualTo(defaultFactory.getPassword());
					assertThat(connectionFactory.getCloseTimeout())
							.isEqualTo(defaultFactory.getCloseTimeout());
					assertThat(connectionFactory.isNonBlockingRedelivery())
							.isEqualTo(defaultFactory.isNonBlockingRedelivery());
					assertThat(connectionFactory.getSendTimeout())
							.isEqualTo(defaultFactory.getSendTimeout());
					assertThat(connectionFactory.isTrustAllPackages())
							.isEqualTo(defaultFactory.isTrustAllPackages());
					assertThat(connectionFactory.getTrustedPackages())
							.containsExactly(StringUtils
									.toStringArray(defaultFactory.getTrustedPackages()));
				});
	}

	@Test
	public void customConnectionFactoryIsApplied() {
		this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
				.withPropertyValues("spring.activemq.pool.enabled=false",
						"spring.activemq.brokerUrl=vm://localhost?useJmx=false&broker.persistent=false",
						"spring.activemq.user=foo", "spring.activemq.password=bar",
						"spring.activemq.closeTimeout=500",
						"spring.activemq.nonBlockingRedelivery=true",
						"spring.activemq.sendTimeout=1000",
						"spring.activemq.packages.trust-all=false",
						"spring.activemq.packages.trusted=com.example.acme")
				.run((context) -> {
					assertThat(context.getBeansOfType(ActiveMQConnectionFactory.class))
							.hasSize(1);
					ActiveMQConnectionFactory connectionFactory = context
							.getBean(ActiveMQConnectionFactory.class);
					assertThat(connectionFactory.getUserName()).isEqualTo("foo");
					assertThat(connectionFactory.getPassword()).isEqualTo("bar");
					assertThat(connectionFactory.getCloseTimeout()).isEqualTo(500);
					assertThat(connectionFactory.isNonBlockingRedelivery()).isTrue();
					assertThat(connectionFactory.getSendTimeout()).isEqualTo(1000);
					assertThat(connectionFactory.isTrustAllPackages()).isFalse();
					assertThat(connectionFactory.getTrustedPackages())
							.containsExactly("com.example.acme");
				});
	}

	@Test
	public void defaultPooledConnectionFactoryIsApplied() {
		this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
				.withPropertyValues("spring.activemq.pool.enabled=true")
				.run((context) -> {
					assertThat(context.getBeansOfType(PooledConnectionFactory.class))
							.hasSize(1);
					PooledConnectionFactory connectionFactory = context
							.getBean(PooledConnectionFactory.class);
					PooledConnectionFactory defaultFactory = new PooledConnectionFactory();
					assertThat(connectionFactory.isBlockIfSessionPoolIsFull())
							.isEqualTo(defaultFactory.isBlockIfSessionPoolIsFull());
					assertThat(connectionFactory.getBlockIfSessionPoolIsFullTimeout())
							.isEqualTo(
									defaultFactory.getBlockIfSessionPoolIsFullTimeout());
					assertThat(connectionFactory.isCreateConnectionOnStartup())
							.isEqualTo(defaultFactory.isCreateConnectionOnStartup());
					assertThat(connectionFactory.getExpiryTimeout())
							.isEqualTo(defaultFactory.getExpiryTimeout());
					assertThat(connectionFactory.getIdleTimeout())
							.isEqualTo(defaultFactory.getIdleTimeout());
					assertThat(connectionFactory.getMaxConnections())
							.isEqualTo(defaultFactory.getMaxConnections());
					assertThat(connectionFactory.getMaximumActiveSessionPerConnection())
							.isEqualTo(defaultFactory
									.getMaximumActiveSessionPerConnection());
					assertThat(connectionFactory.isReconnectOnException())
							.isEqualTo(defaultFactory.isReconnectOnException());
					assertThat(connectionFactory.getTimeBetweenExpirationCheckMillis())
							.isEqualTo(
									defaultFactory.getTimeBetweenExpirationCheckMillis());
					assertThat(connectionFactory.isUseAnonymousProducers())
							.isEqualTo(defaultFactory.isUseAnonymousProducers());
				});
	}

	@Test
	public void customPooledConnectionFactoryIsApplied() {
		this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
				.withPropertyValues("spring.activemq.pool.enabled=true",
						"spring.activemq.pool.blockIfFull=false",
						"spring.activemq.pool.blockIfFullTimeout=64",
						"spring.activemq.pool.createConnectionOnStartup=false",
						"spring.activemq.pool.expiryTimeout=4096",
						"spring.activemq.pool.idleTimeout=512",
						"spring.activemq.pool.maxConnections=256",
						"spring.activemq.pool.maximumActiveSessionPerConnection=1024",
						"spring.activemq.pool.reconnectOnException=false",
						"spring.activemq.pool.timeBetweenExpirationCheck=2048",
						"spring.activemq.pool.useAnonymousProducers=false")
				.run((context) -> {
					assertThat(context.getBeansOfType(PooledConnectionFactory.class))
							.hasSize(1);
					PooledConnectionFactory connectionFactory = context
							.getBean(PooledConnectionFactory.class);
					assertThat(connectionFactory.isBlockIfSessionPoolIsFull()).isFalse();
					assertThat(connectionFactory.getBlockIfSessionPoolIsFullTimeout())
							.isEqualTo(64);
					assertThat(connectionFactory.isCreateConnectionOnStartup()).isFalse();
					assertThat(connectionFactory.getExpiryTimeout()).isEqualTo(4096);
					assertThat(connectionFactory.getIdleTimeout()).isEqualTo(512);
					assertThat(connectionFactory.getMaxConnections()).isEqualTo(256);
					assertThat(connectionFactory.getMaximumActiveSessionPerConnection())
							.isEqualTo(1024);
					assertThat(connectionFactory.isReconnectOnException()).isFalse();
					assertThat(connectionFactory.getTimeBetweenExpirationCheckMillis())
							.isEqualTo(2048);
					assertThat(connectionFactory.isUseAnonymousProducers()).isFalse();
				});
	}

	@Test
	public void pooledConnectionFactoryConfiguration() {
		this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
				.withPropertyValues("spring.activemq.pool.enabled:true")
				.run((context) -> {
					ConnectionFactory factory = context.getBean(ConnectionFactory.class);
					assertThat(factory).isInstanceOf(PooledConnectionFactory.class);
					context.getSourceApplicationContext().close();
					assertThat(factory.createConnection()).isNull();
				});
	}

	@Configuration
	static class EmptyConfiguration {

	}

	@Configuration
	static class CustomConnectionFactoryConfiguration {

		@Bean
		public ConnectionFactory connectionFactory() {
			return mock(ConnectionFactory.class);
		}

	}

	@Configuration
	static class CustomizerConfiguration {

		@Bean
		public ActiveMQConnectionFactoryCustomizer activeMQConnectionFactoryCustomizer() {
			return (factory) -> {
				factory.setBrokerURL(
						"vm://localhost?useJmx=false&broker.persistent=false");
				factory.setUserName("foobar");
			};
		}

	}

}


text:
/**
 * AbstractStore is a superclass of {@link Ext.data.ProxyStore} and {@link Ext.data.ChainedStore}. It's never used directly,
 * but offers a set of methods used by both of those subclasses.
 *
 * We've left it here in the docs for reference purposes, but unless you need to make a whole new type of Store, what
 * you're probably looking for is {@link Ext.data.Store}.
 */
Ext.define('Ext.data.AbstractStore', {
    mixins: [
        'Ext.mixin.Observable',
        'Ext.mixin.Factoryable'
    ],

    requires: [
        'Ext.util.Collection',
        'Ext.data.schema.Schema',
        'Ext.util.Filter'
    ],

    factoryConfig: {
        defaultType: 'store',
        type: 'store'
    },

    $configPrefixed: false,
    $configStrict: false,

    config: {
        autoFilter: true,

        autoSort: true,

        /**
         * @cfg {Object[]/Function[]} filters
         * Array of {@link Ext.util.Filter Filters} for this store. Can also be passed array of
         * functions which will be used as the {@link Ext.util.Filter#filterFn filterFn} config
         * for filters:
         *
         *     filters: [
         *         function(item) {
         *             return item.weight > 0;
         *         }
         *     ]
         *
         * To filter after the grid is loaded use the {@link Ext.data.Store#filterBy filterBy} function.
         */
        filters: undefined,

        /**
         * @cfg {Boolean} [autoDestroy]
         * When a Store is used by only one {@link Ext.view.View DataView}, and should only exist for the lifetime of that view, then
         * configure the autoDestroy flag as `true`. This causes the destruction of the view to trigger the destruction of its Store.
         */
        autoDestroy: undefined,

        /**
         * @cfg {String} storeId
         * Unique identifier for this store. If present, this Store will be registered with the {@link Ext.data.StoreManager},
         * making it easy to reuse elsewhere.
         *
         * Note that when store is instatiated by Controller, the storeId will be overridden by the name of the store.
         */
        storeId: null,

        /**
         * @cfg {Boolean} [statefulFilters=false]
         * Configure as `true` to have the filters saved when a client {@link Ext.grid.Panel grid} saves its state.
         */
        statefulFilters: false,

        /**
         * @cfg {Ext.util.Sorter[]/Object[]} sorters
         * The initial set of {@link Ext.util.Sorter Sorters}
         */
        sorters: undefined,

        /**
        * @cfg {Boolean} [remoteSort=false]
        * `true` if the sorting should be performed on the server side, false if it is local only.
        */
        remoteSort: false,

        /**
        * @cfg {Boolean} [remoteFilter=false]
        * `true` to defer any filtering operation to the server. If `false`, filtering is done locally on the client.
        */
        remoteFilter: false,

        /**
        * @cfg {String} groupField
        * The field by which to group data in the store. Internally, grouping is very similar to sorting - the
        * groupField and {@link #groupDir} are injected as the first sorter (see {@link #method-sort}). Stores support a single
        * level of grouping, and groups can be fetched via the {@link #getGroups} method.
        */
        groupField: undefined,

        /**
        * @cfg {String} groupDir
        * The direction in which sorting should be applied when grouping. Supported values are "ASC" and "DESC".
        */
        groupDir: 'ASC',

        /**
         * @cfg {Object/Ext.util.Grouper} grouper
         * The grouper by which to group the data store. May also be specified by the {@link #groupField} config, however
         * they should not be used together.
         */
        grouper: null,

        /**
        * @cfg {Number} pageSize
        * The number of records considered to form a 'page'. This is used to power the built-in
        * paging using the nextPage and previousPage functions when the grid is paged using a
        * {@link Ext.toolbar.Paging PagingToolbar} Defaults to 25.
        *
        * To disable paging, set the pageSize to `0`.
        */
        pageSize: 25
    },

    /**
     * @property {Number} currentPage
     * The page that the Store has most recently loaded (see {@link Ext.data.Store#loadPage loadPage})
     */
    currentPage: 1,

    /**
     * @property {Boolean} loading
     * `true` if the Store is currently loading via its Proxy.
     * @private
     */
    loading: false,

    /**
     * @property {Boolean} isDestroyed
     * True if the Store has already been destroyed. If this is true, the reference to Store should be deleted
     * as it will not function correctly any more.
     * @since 3.4.0
     */
    isDestroyed: false,

    /**
     * @property {Boolean} isStore
     * `true` in this class to identify an object as an instantiated Store, or subclass thereof.
     */
    isStore: true,

    /**
     * @property {Number} updating
     * A counter that is increased by `beginUpdate` and decreased by `endUpdate`. When
     * this transitions from 0 to 1 the `{@link #event-beginupdate beginupdate}` event is
     * fired. When it transitions back from 1 to 0 the `{@link #event-endupdate endupdate}`
     * event is fired.
     * @readonly
     * @since 5.0.0
     */
    updating: 0,

    //documented above
    constructor: function(config) {
        var me = this,
            storeId;

        /**
         * @event add
         * Fired when a Model instance has been added to this Store.
         *
         * @param {Ext.data.Store} store The store.
         * @param {Ext.data.Model[]} records The records that were added.
         * @param {Number} index The index at which the records were inserted.
         * @since 1.1.0
         */

        /**
         * @event remove
         * Fired when one or more records have been removed from this Store.
         *
         * **The signature for this event has changed in 5.0: **
         *
         * @param {Ext.data.Store} store The Store object
         * @param {Ext.data.Model[]} records The records that were removed. In previous
         * releases this was a single record, not an array.
         * @param {Number} index The index at which the records were removed.
         * @param {Boolean} isMove `true` if the child node is being removed so it can be
         * moved to another position in this Store.
         * @since 5.0.0
         */

        /**
         * @event update
         * Fires when a Model instance has been updated.
         * @param {Ext.data.Store} this
         * @param {Ext.data.Model} record The Model instance that was updated
         * @param {String} operation The update operation being performed. Value may be one of:
         *
         *     Ext.data.Model.EDIT
         *     Ext.data.Model.REJECT
         *     Ext.data.Model.COMMIT
         * @param {String[]} modifiedFieldNames Array of field names changed during edit.
         * @param {Object} details An object describing the change. See the
         * {@link Ext.util.Collection#event-itemchange itemchange event} of the store's backing collection
         * @since 1.1.0
         */

        /**
         * @event clear
         * Fired after the {@link Ext.data.Store#removeAll removeAll} method is called.
         * @param {Ext.data.Store} this
         * @since 1.1.0
         */

        /**
         * @event datachanged
         * Fires whenever records are added to or removed from the Store.
         *
         * To hook into modifications of records in this Store use the {@link #update} event.
         * @param {Ext.data.Store} this The data store
         * @since 1.1.0
         */

        /**
         * @event refresh
         * Fires when the data cache has changed in a bulk manner (e.g., it has been sorted, filtered, etc.) and a
         * widget that is using this Store as a Record cache should refresh its view.
         * @param {Ext.data.Store} this The data store
         */

        /**
         * @event beginupdate
         * Fires when the {@link #beginUpdate} method is called. Automatic synchronization as configured
         * by the {@link Ext.data.ProxyStore#autoSync autoSync} flag is deferred until the {@link #endUpdate} method is called, so multiple
         * mutations can be coalesced into one synchronization operation.
         */

        /**
         * @event endupdate
         * Fires when the {@link #endUpdate} method is called. Automatic synchronization as configured
         * by the {@link Ext.data.ProxyStore#autoSync autoSync} flag is deferred until the {@link #endUpdate} method is called, so multiple
         * mutations can be coalesced into one synchronization operation.
         */

        /**
         * @event beforesort
         * Fires before a store is sorted.
         *
         * For {@link #remoteSort remotely sorted} stores, this will be just before the load operation triggered by changing the
         * store's sorters.
         *
         * For locally sorted stores, this will be just before the data items in the store's backing collection are sorted.
         */

        /**
         * @event sort
         * Fires after a store is sorted.
         *
         * For {@link #remoteSort remotely sorted} stores, this will be upon the success of a load operation triggered by
         * changing the store's sorters.
         *
         * For locally sorted stores, this will be just after the data items in the store's backing collection are sorted.
         */
        me.isInitializing = true;
        me.mixins.observable.constructor.call(me, config);
        me.isInitializing = false;

        storeId = me.getStoreId();
        if (!storeId && (config && config.id)) {
            me.setStoreId(storeId = config.id);
        }

        if (storeId) {
            Ext.data.StoreManager.register(me);
        }
    },

    /**
     * Gets the number of records in store.
     *
     * If using paging, this may not be the total size of the dataset. If the data object
     * used by the Reader contains the dataset size, then the {@link Ext.data.ProxyStore#getTotalCount} function returns
     * the dataset size.  **Note**: see the Important note in {@link Ext.data.ProxyStore#method-load}.
     *
     * When store is filtered, it's the number of records matching the filter.
     *
     * @return {Number} The number of Records in the Store.
     */
    getCount: function() {
        return this.getData().getCount();
    },

    /**
     * Determines if the passed range is available in the page cache.
     * @private
     * @param {Number} start The start index
     * @param {Number} end The end index in the range
     */
    rangeCached: function(start, end) {
        return this.getData().getCount() >= Math.max(start, end);
    },

    /**
     * Checks if a record is in the current active data set.
     * @param {Ext.data.Model} record The record
     * @return {Boolean} `true` if the record is in the current active data set.
     * @method contains
     */

    /**
     * Finds the index of the first matching Record in this store by a specific field value.
     *
     * When store is filtered, finds records only within filter.
     *
     * **IMPORTANT
     *
     * If this store is {@link Ext.data.BufferedStore Buffered}, this can ONLY find records which happen to be cached in the page cache.
     * This will be parts of the dataset around the currently visible zone, or recently visited zones if the pages
     * have not yet been purged from the cache.**
     *
     * @param {String} property The name of the Record field to test.
     * @param {String/RegExp} value Either a string that the field value
     * should begin with, or a RegExp to test against the field.
     * @param {Number} [startIndex=0] The index to start searching at
     * @param {Boolean} [anyMatch=false] True to match any part of the string, not just the
     * beginning.
     * @param {Boolean} [caseSensitive=false] True for case sensitive comparison
     * @param {Boolean} [exactMatch=false] True to force exact match (^ and $ characters
     * added to the regex). Ignored if `anyMatch` is `true`.
     * @return {Number} The matched index or -1
     */
    find: function(property, value, startIndex, anyMatch, caseSensitive, exactMatch) {
        //             exactMatch
        //  anyMatch    F       T
        //      F       ^abc    ^abc$
        //      T       abc     abc
        //
        var startsWith = !anyMatch,
            endsWith = !!(startsWith && exactMatch);

        return this.getData().findIndex(property, value, startIndex, startsWith, endsWith,
                    !caseSensitive);
    },

    /**
     * Finds the first matching Record in this store by a specific field value.
     *
     * When store is filtered, finds records only within filter.
     *
     * **IMPORTANT
     *
     * If this store is {@link Ext.data.BufferedStore Buffered}, this can ONLY find records which happen to be cached in the page cache.
     * This will be parts of the dataset around the currently visible zone, or recently visited zones if the pages
     * have not yet been purged from the cache.**
     *
     * @param {String} fieldName The name of the Record field to test.
     * @param {String/RegExp} value Either a string that the field value
     * should begin with, or a RegExp to test against the field.
     * @param {Number} [startIndex=0] The index to start searching at
     * @param {Boolean} [anyMatch=false] True to match any part of the string, not just the
     * beginning.
     * @param {Boolean} [caseSensitive=false] True for case sensitive comparison
     * @param {Boolean} [exactMatch=false] True to force exact match (^ and $ characters
     * added to the regex). Ignored if `anyMatch` is `true`.
     * @return {Ext.data.Model} The matched record or null
     */
    findRecord: function() {
        var me = this,
            index = me.find.apply(me, arguments);
        return index !== -1 ? me.getAt(index) : null;
    },

    /**
     * Finds the index of the first matching Record in this store by a specific field value.
     *
     * When store is filtered, finds records only within filter.
     *
     * **IMPORTANT
     *
     * If this store is {@link Ext.data.BufferedStore Buffered}, this can ONLY find records which happen to be cached in the page cache.
     * This will be parts of the dataset around the currently visible zone, or recently visited zones if the pages
     * have not yet been purged from the cache.**
     *
     * @param {String} fieldName The name of the Record field to test.
     * @param {Object} value The value to match the field against.
     * @param {Number} [startIndex=0] The index to start searching at
     * @return {Number} The matched index or -1
     */
    findExact: function(property, value, start) {
        return this.getData().findIndexBy(function(rec) {
            return rec.isEqual(rec.get(property), value);
        }, this, start);
    },

    /**
     * Find the index of the first matching Record in this Store by a function.
     * If the function returns `true` it is considered a match.
     *
     * When store is filtered, finds records only within filter.
     *
     * **IMPORTANT
     *
     * If this store is {@link Ext.data.BufferedStore Buffered}, this can ONLY find records which happen to be cached in the page cache.
     * This will be parts of the dataset around the currently visible zone, or recently visited zones if the pages
     * have not yet been purged from the cache.**
     *
     * @param {Function} fn The function to be called. It will be passed the following parameters:
     *  @param {Ext.data.Model} fn.record The record to test for filtering. Access field values
     *  using {@link Ext.data.Model#get}.
     *  @param {Object} fn.id The ID of the Record passed.
     * @param {Object} [scope] The scope (this reference) in which the function is executed.
     * Defaults to this Store.
     * @param {Number} [startIndex=0] The index to start searching at
     * @return {Number} The matched index or -1
     */
    findBy: function(fn, scope, start) {
        return this.getData().findIndexBy(fn, scope, start);
    },

    /**
     * Get the Record at the specified index.
     *
     * The index is effected by filtering.
     *
     * @param {Number} index The index of the Record to find.
     * @return {Ext.data.Model} The Record at the passed index. Returns undefined if not found.
     */
    getAt: function(index) {
        return this.getData().getAt(index) || null;
    },

    /**
     * Gathers a range of Records between specified indices.
     *
     * This method is affected by filtering.
     *
     * @param {Number} start The starting index. Defaults to zero.
     * @param {Number} end The ending index. Defaults to the last record. The end index **is included**.
     * @return {Ext.data.Model[]} An array of records.
     */
    getRange: function(start, end, /* private - use by BufferedRenderer. It may be using a BufferedStore */ options) {
        // Collection's getRange is exclusive. Do NOT mutate the value: it is passed to the callback.
        var result = this.getData().getRange(start, Ext.isNumber(end) ? end + 1 : end);

        // BufferedRenderer requests a range with a callback to process that range.
        // Because it may be dealing with a buffered store and the range may not be available synchronously.
        if (options && options.callback) {
            options.callback.call(options.scope || this, result, start, end, options);
        }
        return result;
    },

    applyFilters: function (filters, filtersCollection) {
        if (!filtersCollection) {
            filtersCollection = this.createFiltersCollection();
        }

        filtersCollection.add(filters);

        return filtersCollection;
    },

    applySorters: function (sorters, sortersCollection) {
        if (!sortersCollection) {
            sortersCollection = this.createSortersCollection();
        }

        sortersCollection.add(sorters);

        return sortersCollection;
    },

    updateAutoFilter: function(autoFilter) {
        var data = this.getData();
        if (data.setAutoFilter) {
            // Not all store types have data objects that provide filtering (e.g.,
            // BufferedStores).
            data.setAutoFilter(autoFilter);
        }
    },

    updateAutoSort: function(autoSort) {
        var data = this.getData();
        if (data.setAutoSort) {
            // Not all store types have data objects that provide sorting (e.g.,
            // BufferedStores).
            data.setAutoSort(autoSort);
        }
    },

    filter: function(filters, value, supressEvent) {
        if (Ext.isString(filters)) {
            filters = {
                property: filters,
                value: value
            };
        }
        this.suppressNextFilter = !!supressEvent;
        this.getFilters().add(filters);
        this.suppressNextFilter = false;
    },

    /**
     * Removes an individual Filter from the current {@link #cfg-filters filter set} using the passed Filter/Filter id and
     * by default, applies the updated filter set to the Store's unfiltered dataset.
     *
     * @param {String/Ext.util.Filter} toRemove The id of a Filter to remove from the filter set, or a Filter instance to remove.
     * @param {Boolean} [suppressEvent] If `true` the filter is cleared silently.
     */
    removeFilter: function(filter, supressEvent) {
        var me = this,
            filters = me.getFilters();

        me.suppressNextFilter = !!supressEvent;
        if (filter instanceof Ext.util.Filter) {
            filters.remove(filter);
        } else {
            filters.removeByKey(filter);
        }
        me.suppressNextFilter = false;
    },

    updateRemoteSort: function (remote) {
        var me = this,
            sorters = me.getSorters(), // ensure applySorters is called
            data = me.getData();

        // If remoteSort is set, we react to the endUpdate of the sorters Collection by reloading.
        // If remoteSort is set, we do not need to listen for the data Collection's beforesort event.
        if (remote) {
            sorters.on('endupdate', me.onSorterEndUpdate, me);
            data.un('beforesort', me.onBeforeCollectionSort, me);
        }
        // If local sorting, we do not need to react to the endUpdate of the sorters Collection.
        // If local sorting, we listen for the data Collection's beforesort event to fire our beforesort event.
        else {
            sorters.un('endupdate', me.onSorterEndUpdate, me);
            data.on('beforesort', me.onBeforeCollectionSort, me);
        }
    },

    updateRemoteFilter: function (remote) {
        var me = this,
            filters = me.getFilters(); // ensure applyFilters is called

        if (remote) {
            filters.on('endupdate', me.onFilterEndUpdate, me);
        } else {
            filters.un('endupdate', me.onFilterEndUpdate, me);
        }
    },

    /**
     * Adds a new Filter to this Store's {@link #cfg-filters filter set} and
     * by default, applies the updated filter set to the Store's unfiltered dataset.
     * @param {Object[]/Ext.util.Filter[]} filters The set of filters to add to the current {@link #cfg-filters filter set}.
     * @param {Boolean} [suppressEvent] If `true` the filter is cleared silently.
     */
    addFilter: function(filters, supressEvent) {
        this.suppressNextFilter = !!supressEvent;
        this.getFilters().add(filters);
        this.suppressNextFilter = false;
    },

    /**
     * Filters by a function. The specified function will be called for each
     * Record in this Store. If the function returns `true` the Record is included,
     * otherwise it is filtered out.
     *
     * When store is filtered, most of the methods for accessing store data will be working only
     * within the set of filtered records. The notable exception is {@link #getById}.
     *
     * @param {Function} fn The function to be called. It will be passed the following parameters:
     *  @param {Ext.data.Model} fn.record The record to test for filtering. Access field values
     *  using {@link Ext.data.Model#get}.
     * @param {Object} [scope] The scope (this reference) in which the function is executed.
     * Defaults to this Store.
     */
    filterBy: function(fn, scope) {
        this.getFilters().add({
            filterFn: fn,
            scope: scope || this
        });
    },

    /**
     * Reverts to a view of the Record cache with no filtering applied.
     * @param {Boolean} [suppressEvent] If `true` the filter is cleared silently.
     *
     * For a locally filtered Store, this means that the filter collection is cleared without firing the
     * {@link #datachanged} event.
     *
     * For a remotely filtered Store, this means that the filter collection is cleared, but the store
     * is not reloaded from the server.
     */
    clearFilter: function(supressEvent) {
        var me = this,
            filters = me.getFilters(false);

        if (!filters || filters.getCount() === 0) {
            return;
        }
        me.suppressNextFilter = !!supressEvent;
        filters.removeAll();
        me.suppressNextFilter = false;
    },

    /**
     * Tests whether the store currently has any active filters.
     * @return {Boolean} `true` if the store is filtered.
     */
    isFiltered: function() {
        return this.getFilters().getCount() > 0;
    },

    /**
     * Tests whether the store currently has any active sorters.
     * @return {Boolean} `true` if the store is sorted.
     */
    isSorted: function() {
        return this.getSorters().getCount() > 0 || this.isGrouped();
    },

    addFieldTransform: function(sorter) {
        // Transform already specified, leave it
        if (sorter.getTransform()) {
            return;
        }

        var fieldName = sorter.getProperty(),
            Model = this.getModel(),
            field, sortType;

        if (Model) {
            field = Model.getField(fieldName);
            sortType = field ? field.getSortType() : null;
        }

        if (sortType && sortType !== Ext.identityFn)  {
            sorter.setTransform(sortType);
        }
    },

    /**
     * This method may be called to indicate the start of multiple changes to the store.
     *
     * Automatic synchronization as configured by the {@link Ext.data.ProxyStore#autoSync autoSync} flag is deferred
     * until the {@link #endUpdate} method is called, so multiple mutations can be coalesced
     * into one synchronization operation.
     *
     * Internally this method increments a counter that is decremented by `endUpdate`. It
     * is important, therefore, that if you call `beginUpdate` directly you match that
     * call with a call to `endUpdate` or you will prevent the collection from updating
     * properly.
     *
     * For example:
     *
     *      var store = Ext.StoreManager.lookup({
     *          //...
     *          autoSync: true
     *      });
     *
     *      store.beginUpdate();
     *
     *      record.set('fieldName', 'newValue');
     *
     *      store.add(item);
     *      // ...
     *
     *      store.insert(index, otherItem);
     *      //...
     *
     *      // Interested parties will listen for the endupdate event
     *      store.endUpdate();
     *
     * @since 5.0.0
     */
    beginUpdate: function() {
        if (!this.updating++) { // jshint ignore:line
            this.fireEvent('beginupdate');
        }
    },

    /**
     * This method is called after modifications are complete on a store. For details
     * see `{@link #beginUpdate}`.
     * @since 5.0.0
     */
    endUpdate: function() {
        if (this.updating && ! --this.updating) {
            this.fireEvent('endupdate');
            this.onEndUpdate();
        }
    },

    /**
     * @private
     * Returns the grouping, sorting and filtered state of this Store.
     */
    getState: function() {
        var me = this,
            sorters = [],
            filters = me.getFilters(),
            grouper = me.getGrouper(),
            filterState, hasState, result;

        // Create sorters config array.
        me.getSorters().each(function(s) {
            sorters[sorters.length] = s.getState();
            hasState = true;
        });

        // Because we do not provide a filter changing mechanism, only statify the filters if they opt in.
        // Otherwise filters would get "stuck".
        if (me.statefulFilters && me.saveStatefulFilters) {
            // If saveStatefulFilters is turned on then we know that the filter collection has changed since
            // page load. Initiate the filterState as an empty stack, which is meaningful in itself. If there
            // are any filter in the collection, persist them.
            hasState = true;
            filterState = [];
            filters.each(function (f) {
                filterState[filterState.length] = f.getState();
            });
        }

        if (grouper) {
            hasState = true;
        }

        // If there is any state to save, return it as an object
        if (hasState) {
            result = {};
            if (sorters.length) {
                result.sorters = sorters;
            }
            if (filterState) {
                result.filters = filterState;
            }
            if (grouper) {
                result.grouper = grouper.getState();
            }
        }
        return result;
    },

    /**
     * @private
     * Restores state to the passed state
     */
    applyState: function(state) {
        var me = this,
            sorters = me.getSorters(),
            filters = me.getFilters(),
            stateSorters = state.sorters,
            stateFilters = state.filters,
            stateGrouper = state.grouper;

        if (stateSorters) {
            sorters.replaceAll(stateSorters);
        }

        if (stateFilters) {
            // We found persisted filters so let's save stateful filters from this point forward.
            me.saveStatefulFilters = true;
            filters.replaceAll(stateFilters);
        }

        if (stateGrouper) {
            this.setGrouper(stateGrouper);
        }
    },

    /**
     * Get the Record with the specified id.
     *
     * This method is not affected by filtering, lookup will be performed from all records
     * inside the store, filtered or not.
     *
     * @param {Mixed} id The id of the Record to find.
     * @return {Ext.data.Model} The Record with the passed id. Returns null if not found.
     * @method getById
     */

    /**
     * Returns true if the store has a pending load task.
     * @return {Boolean} `true` if the store has a pending load task.
     * @private
     * @method
     */
    hasPendingLoad: Ext.emptyFn,

    /**
     * Returns `true` if the Store has been loaded.
     * @return {Boolean} `true` if the Store has been loaded.
     * @method
     */
    isLoaded: Ext.emptyFn,

    /**
     * Returns `true` if the Store is currently performing a load operation.
     * @return {Boolean} `true` if the Store is currently loading.
     * @method
     */
    isLoading: Ext.emptyFn,

    destroy: function() {
        var me = this;
        me.clearListeners();
        if (me.getStoreId()) {
            Ext.data.StoreManager.unregister(me);
        }
        me.onDestroy();
        me.callParent();
    },

    /**
     * Sorts the data in the Store by one or more of its properties. Example usage:
     *
     *     //sort by a single field
     *     myStore.sort('myField', 'DESC');
     *
     *     //sorting by multiple fields
     *     myStore.sort([
     *         {
     *             property : 'age',
     *             direction: 'ASC'
     *         },
     *         {
     *             property : 'name',
     *             direction: 'DESC'
     *         }
     *     ]);
     *
     * Internally, Store converts the passed arguments into an array of {@link Ext.util.Sorter} instances, and delegates
     * the actual sorting to its internal {@link Ext.util.MixedCollection}.
     *
     * When passing a single string argument to sort, Store maintains a ASC/DESC toggler per field, so this code:
     *
     *     store.sort('myField');
     *     store.sort('myField');
     *
     * Is equivalent to this code, because Store handles the toggling automatically:
     *
     *     store.sort('myField', 'ASC');
     *     store.sort('myField', 'DESC');
     *
     * @param {String/Ext.util.Sorter[]} [sorters] Either a string name of one of the fields in this Store's configured
     * {@link Ext.data.Model Model}, or an array of sorter configurations.
     * @param {String} [direction="ASC"] The overall direction to sort the data by.
     * @return {Ext.util.Sorter[]}
     */
    sort: function(field, direction, mode) {
        var me = this;

        if (arguments.length === 0) {
            if (me.getRemoteSort()) {
                me.attemptLoad();
            } else {
                me.forceLocalSort();
            }
        } else {
            me.getSorters().addSort(field, direction, mode);
        }
    },

    // This is attached to the data Collection's beforesort event only if not remoteSort
    // If remoteSort, the event is fired before the reload call in Ext.data.ProxyStore#load.
    onBeforeCollectionSort: function(store, sorters) {
        this.fireEvent('beforesort', this, sorters.getRange());
    },

    onSorterEndUpdate: function() {
        var me = this,
            sorters;

        // If we're in the middle of grouping, it will take care of loading
        if (me.settingGroups) {
            return;
        }

        sorters = me.getSorters().getRange();

        // Only load or sort if there are sorters
        if (sorters.length) {
            if (me.getRemoteSort()) {
                me.attemptLoad({
                    callback: function() {
                        me.fireEvent('sort', me, sorters);
                    }
                });
            } else {
                // Don't fire the event if we have no sorters
                me.fireEvent('datachanged', me);
                me.fireEvent('refresh', me);
                me.fireEvent('sort', me, sorters);
            }
        } else {
            // Sort event must fire when sorters collection is updated to empty.
            me.fireEvent('sort', me, sorters);
        }
    },

    onFilterEndUpdate: function() {
        var me = this,
            suppressNext = me.suppressNextFilter;

        if (me.getAutoFilter()) {
            if (me.getRemoteFilter()) {
                //<debug>
                me.getFilters().each(function(filter) {
                    if (filter.getInitialConfig().filterFn) {
                        Ext.Error.raise('Unable to use a filtering function in conjunction with remote filtering.');
                    }
                });
                //</debug>
                me.currentPage = 1;
                if (!suppressNext) {
                    me.attemptLoad();
                }
            } else {
                if (!suppressNext) {
                    me.fireEvent('datachanged', me);
                    me.fireEvent('refresh', me);
                }
            }
        }

        if (me.trackStateChanges) {
            // We just mutated the filter collection so let's save stateful filters from this point forward.
            me.saveStatefulFilters = true;
        }

        // This is not affected by suppressEvent.
        me.fireEvent('filterchange', me, me.getFilters().getRange());
    },

    updateGroupField: function(field) {
        if (field) {
            this.setGrouper({
                property: field,
                direction: this.getGroupDir()
            });
        } else {
            this.setGrouper(null);
        }
    },

    /**
     * @method getFilters
     * @hide
     */

    /**
     * @method setFilters
     * @hide
     */

    /**
     * @method getSorters
     * @hide
     */

    /**
     * @method setSorters
     * @hide
     */

    getGrouper: function() {
        return this.getData().getGrouper();
    },

    /**
     * Groups data inside the store.
     * @param {String/Object} grouper Either a string name of one of the fields in this Store's
     * configured {@link Ext.data.Model Model}, or an object, or a {@link Ext.util.Grouper grouper} configuration object.
     * @param {String} [direction] The overall direction to group the data by. Defaults to the value of {@link #groupDir}.
     */
    group: function(grouper, direction) {
        var me = this,
            change = grouper || me.getSorters().getCount() > 0;

        if (grouper && typeof grouper === 'string') {
            grouper = {
                property: grouper,
                direction: direction || me.getGroupDir()
            };
        }

        me.settingGroups = true;
        me.getData().setGrouper(grouper);
        delete me.settingGroups;
        if (me.isLoadBlocked()) {
            return;
        }

        if (change) {
            if (me.getRemoteSort()) {
                me.attemptLoad({
                    scope: me,
                    callback: me.fireGroupChange
                });
            } else {
                me.fireEvent('datachanged', me);
                me.fireEvent('refresh', me);
                me.fireGroupChange();
            }
        }
        // groupchange event must fire when group is cleared.
        // The Grouping feature forces a view refresh when changed to a null grouper
        else {
            me.fireGroupChange();
        }
    },

    fireGroupChange: function() {
        this.fireEvent('groupchange', this, this.getGrouper());
    },

    /**
     * Clear the store grouping
     */
    clearGrouping: function() {
        this.group(null);
    },

    getGroupField: function(){
        var grouper = this.getGrouper(),
            group = '';

        if (grouper) {
            group = grouper.getProperty();
        }
        return group;
    },

    /**
     * Tests whether the store currently has an active grouper.
     * @return {Boolean} `true` if the store is grouped.
     */
    isGrouped: function() {
        return !!this.getGrouper();
    },

    applyGrouper: function(grouper) {
        this.group(grouper);
        return this.getData().getGrouper();
    },

    /**
     * Returns an array containing the result of applying grouping to the records in this store.
     * See {@link #groupField}, {@link #groupDir}. Example for a store
     * containing records with a color field:
     *
     *     var myStore = Ext.create('Ext.data.Store', {
     *         groupField: 'color',
     *         groupDir  : 'DESC'
     *     });
     *
     *     myStore.getGroups(); // returns:
     *     [
     *         {
     *             name: 'yellow',
     *             children: [
     *                 // all records where the color field is 'yellow'
     *             ]
     *         },
     *         {
     *             name: 'red',
     *             children: [
     *                 // all records where the color field is 'red'
     *             ]
     *         }
     *     ]
     *
     * Group contents are effected by filtering.
     *
     * @return {Ext.util.GroupCollection} The grouped data
     */
    getGroups: function() {
        return this.getData().getGroups();
    },

    onEndUpdate: Ext.emptyFn,

    privates: {
        loadsSynchronously: Ext.privateFn
    },

    deprecated: {
        5: {
            methods: {
                destroyStore: function() {
                    this.destroy();
                }
            }
        }
    }

});


text:
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="300dp"
    android:src="@mipmap/ic_launcher"/>


text:
{% extends "includes/base.html" %}

{% block page_title %}Login{% endblock page_title %}

{% block content %}
{% if user.is_authenticated %}

K zobrazení této stránky musíte být přihlášeni!

            <button type="button" class="close" data-dismiss="modal">×</button>

 Login

            <form action="/accounts/auth/" method="post">{% csrf_token %}

                 Username
                <input data-toggle="tooltip" data-placement="right" title="enter your username" type="text" name="username" value="" id="username" placeholder="your username">

                 Password
                <input data-toggle="tooltip" data-placement="right" title="enter your password" type="password" name="password" value="" placeholder="your password" id="password">

                <input type="checkbox" value="" checked>Remember me

                <button type="submit" class="btn btn-success btn-block"> Login</button>
            </form>

            <button type="submit" class="btn btn-danger btn-default pull-left" data-dismiss="modal"> Cancel</button>

Not a member? Sign Up

{% else %}

{% if form.errors %}

Vaše uživatelké jméno a heslo není správné

{% endif %}

<form method="post" action="/accounts/auth/">{% csrf_token %}

Username: <input class="form-control" data-toggle="tooltip" data-placement="right" title="enter your username" type="text" name="username" value="" id="username" placeholder="your username">

Password: <input class="form-control" data-toggle="tooltip" data-placement="right" title="enter your password" type="password" name="password" value="" placeholder="your password" id="password">

	<input class="btn btn-primary" type="submit" value="login" />

</form>

{% endif %}
{% endblock %}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="(C) Copyright 2005" />
<meta name="DC.rights.owner" content="(C) Copyright 2005" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="concept" name="DC.Type" />
<meta name="DC.Title" content="ij SQL command behavior" />
<meta scheme="URI" name="DC.Relation" content="ctoolsijcomref23268.html" />
<meta scheme="URI" name="DC.Relation" content="rtoolsijcomref1003444.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="ctoolsijcomref15645" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="commonltr.css" type="text/css" rel="stylesheet" />
<title>ij SQL command behavior</title>

ij SQL command behavior

Any command other than those documented in the <samp class="codeph">ij</samp> command reference
are handed to the current connection to execute directly. The statement's
closing semicolon, used by <samp class="codeph">ij</samp> to determine that it has ended, is
not passed to the underlying connection. Only one statement at a time is passed
to the connection. If the underlying connection itself accepts semicolon-separated
statements (which Derby does not), they can be passed to the connection
using <samp class="codeph">ij</samp>'s Execute command to pass in a command string containing
semicolon-separated commands.

<samp class="codeph">ij</samp> uses the result of the JDBC execute request to determine
whether it should print a number-of-rows message or display a result set.

If a JDBC execute request causes an exception, it displays the SQLState, if any, and error message.

Setting the <samp class="codeph">ij</samp> property ij.showErrorCode to true displays the SQLException's error code (see ij properties reference).

The number-of-rows message for inserts, updates, and deletes conforms to
the JDBC specification for any SQL statement that does not have a result set.
DDL (data definition language) commands typically report "0 rows inserted/updated/deleted"
when they successfully complete.

To display a result set, <samp class="codeph">ij</samp> formats a banner based on the JDBC ResultSetMetaData information returned from getColumnLabel and getColumnWidth. Long columns
wrap the screen width, using multiple lines. An & character
denotes truncation (<samp class="codeph">ij</samp> limits displayed width of a column to 128
characters by default; see MaximumDisplayWidth command).

<samp class="codeph">ij</samp> displays rows as it fetches them. If the underlying DBMS
materializes rows only as they are requested, ij displays a partial result
followed by an error message if there is a error in fetching a row partway
through the result set.

<samp class="codeph">ij</samp> verifies that a connection exists before issuing statements
against it and does not execute SQL when no connection has yet been made.

There is no support in <samp class="codeph">ij</samp> for the JDBC feature multiple result
sets.

ij command example

Parent topic: ij commands


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- From: file:/I:/Users/linwei/workspace/ZzuNews/app/src/main/res/values/colors.xml -->
    <eat-comment/>
    <color name="action_back">#336666</color>
    <color name="action_menu_pressed">#333333</color>
    <color name="bg">#f1e3e4</color>
    <color name="black">#000000</color>
    <color name="body1">#FFFFFF</color>
    <color name="body2">#F9F9F9</color>
    <color name="center_menu_back">#292929</color>
    <color name="divider1">#DDDDDD</color>
    <color name="divider2">#EEEEEE</color>
    <color name="divider3">#FFFFFF</color>
    <color name="global_gray">#dddddd</color>
    <color name="gold">#000000</color>
    <color name="gray">#FFFFEE</color>
    <color name="guide_back">#FFFFFF</color>
    <color name="holo_blue_light">#ff33b5e5</color>
    <color name="loading">#99000000</color>
    <color name="menu1">#EEEEEE</color>
    <color name="menu2">#BBBBBB</color>
    <color name="menu_devider_color">#ff282a2b</color>
    <color name="menu_pressed_color">@color/menu_devider_color</color>
    <color name="none">#00000000</color>
    <color name="pull_refresh_textview">#000000</color>
    <color name="red">#FF0000</color>
    <color name="semitransparent">#4d000000</color>
    <color name="text">#333333</color>
    <color name="transparent">#00000000</color>
    <color name="wechat_green">#ff45c01a</color>
    <color name="white">#FFFFFF</color>
    <color name="widgeblue">#333333</color>
    <!-- From: file:/I:/Users/linwei/workspace/ZzuNews/app/src/main/res/values/dimens.xml -->
    <eat-comment/>
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
    <dimen name="navigation_drawer_width">240dp</dimen>
    <!-- From: file:/I:/Users/linwei/workspace/ZzuNews/app/src/main/res/values/strings.xml -->
    <eat-comment/>
    <string name="action_example">Example action</string>
    <string name="action_settings">Settings</string>
    <string name="app_name">郑大新闻通</string>
    <string name="navigation_drawer_close">Close navigation drawer</string>
    <string name="navigation_drawer_open">Open navigation drawer</string>
    <string name="title_section1">Section 1</string>
    <string name="title_section2">Section 2</string>
    <string name="title_section3">Section 3</string>
    <!-- From: file:/I:/Users/linwei/workspace/ZzuNews/app/src/main/res/values/styles.xml -->
    <eat-comment/>
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>
</resources>


text:
@class NSArray, NSString;

@protocol IDEDebugProcess <IDEDebugNavigableModel>
@property(copy, nonatomic) NSString *name;
- (NSString *)contentDelegateUIExtensionIdentifier;

@optional
@property(readonly, nonatomic) NSArray *loadedCodeModules;
@end


text:
//  UIView+Sidekick.h
//
// Copyright (c) 2013 Markus Kauppila <markus.kauppila@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to  use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <UIKit/UIKit.h>

@interface UIView (Sidekick)

/**
 Takes snapshot of the view (including all the subviews)
 @return The snapshot as `UIImage` or `nil` on failure.
 */
- (UIImage *)snapshot;

- (void)moveFrameBy:(CGPoint)movement;

@end


text:
package com.microsoft.azure.management.containerservice.v2019_04_01;

import java.util.Collection;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.microsoft.rest.ExpandableStringEnum;

/**
 * Defines values for NetworkPolicy.
 */
public final class NetworkPolicy extends ExpandableStringEnum<NetworkPolicy> {
    /** Static value calico for NetworkPolicy. */
    public static final NetworkPolicy CALICO = fromString("calico");

    /** Static value azure for NetworkPolicy. */
    public static final NetworkPolicy AZURE = fromString("azure");

    /**
     * Creates or finds a NetworkPolicy from its string representation.
     * @param name a name to look for
     * @return the corresponding NetworkPolicy
     */
    @JsonCreator
    public static NetworkPolicy fromString(String name) {
        return fromString(name, NetworkPolicy.class);
    }

    /**
     * @return known NetworkPolicy values
     */
    public static Collection<NetworkPolicy> values() {
        return values(NetworkPolicy.class);
    }
}


text:
#ifndef CallbackPromiseAdapter_h
#define CallbackPromiseAdapter_h

#include "bindings/core/v8/ScriptPromiseResolver.h"
#include "public/platform/WebCallbacks.h"
#include "wtf/PtrUtil.h"
#include "wtf/TypeTraits.h"
#include <memory>

namespace blink {

// CallbackPromiseAdapter is a WebCallbacks subclass and resolves / rejects the
// stored resolver when onSuccess / onError is called, respectively.
//
// Basically CallbackPromiseAdapter<S, T> is a subclass of
// WebCallbacks<S::WebType, T::WebType>. There are some exceptions:
//  - If S or T don't have WebType (e.g. S = bool), a default WebType holder
//    called trivial WebType holder is used. For example,
//    CallbackPromiseAdapter<bool, void> is a subclass of
//    WebCallbacks<bool, void>.
//  - If a WebType is std::unique_ptr<T>, its corresponding type parameter on
//    WebCallbacks is std::unique_ptr<T>, because WebCallbacks must be exposed to
//    Chromium.
//
// When onSuccess is called with a S::WebType value, the value is passed to
// S::take and the resolver is resolved with its return value. Ditto for
// onError.
//
// ScriptPromiseResolver::resolve / reject will not be called when the execution
// context is stopped.
//
// Example:
// class MyClass {
// public:
//     using WebType = std::unique_ptr<WebMyClass>;
//     static PassRefPtr<MyClass> take(ScriptPromiseResolver* resolver,
//         std::unique_ptr<WebMyClass> webInstance)
//     {
//         return MyClass::create(webInstance);
//     }
//     ...
// };
// class MyErrorClass {
// public:
//     using WebType = const WebMyErrorClass&;
//     static MyErrorClass take(ScriptPromiseResolver* resolver,
//         const WebErrorClass& webError)
//     {
//         return MyErrorClass(webError);
//     }
//     ...
// };
// std::unique_ptr<WebCallbacks<std::unique_ptr<WebMyClass>, const WebMyErrorClass&>>
//     callbacks = wrapUnique(new CallbackPromiseAdapter<MyClass, MyErrorClass>(
//     resolver));
// ...
//
// std::unique_ptr<WebCallbacks<bool, const WebMyErrorClass&>> callbacks2 =
//     wrapUnique(new CallbackPromiseAdapter<bool, MyErrorClass>(resolver));
// ...
//
//
// In order to implement the above exceptions, we have template classes below.
// OnSuccess and OnError provide onSuccess and onError implementation, and there
// are utility templates that provide
//  - std::unique_ptr - WebPassOwnPtr translation ([Web]PassType[Impl], adopt, pass),
//  - trivial WebType holder (TrivialWebTypeHolder).

namespace internal {

// This template is placed outside of CallbackPromiseAdapterInternal because
// explicit specialization is forbidden in a class scope.
template <typename T>
struct CallbackPromiseAdapterTrivialWebTypeHolder {
    using WebType = T;
    static T take(ScriptPromiseResolver*, const T& x) { return x; }
};
template <>
struct CallbackPromiseAdapterTrivialWebTypeHolder<void> {
    using WebType = void;
};

class CallbackPromiseAdapterInternal {
private:
    template <typename T> static T webTypeHolderMatcher(typename std::remove_reference<typename T::WebType>::type*);
    template <typename T> static CallbackPromiseAdapterTrivialWebTypeHolder<T> webTypeHolderMatcher(...);
    template <typename T> using WebTypeHolder = decltype(webTypeHolderMatcher<T>(nullptr));

    template <typename T> static T& adopt(T& x) { return x; }
    template <typename T> static std::unique_ptr<T> adopt(std::unique_ptr<T>& x) { return std::move(x); }
    template <typename T> static T pass(T& x) { return x; }
    template <typename T> static std::unique_ptr<T> pass(std::unique_ptr<T>& x) { return std::move(x); }

    template <typename S, typename T>
    class Base : public WebCallbacks<typename S::WebType, typename T::WebType> {
    public:
        explicit Base(ScriptPromiseResolver* resolver) : m_resolver(resolver) {}
        ScriptPromiseResolver* resolver() { return m_resolver; }

    private:
        Persistent<ScriptPromiseResolver> m_resolver;
    };

    template <typename S, typename T>
    class OnSuccess : public Base<S, T> {
    public:
        explicit OnSuccess(ScriptPromiseResolver* resolver) : Base<S, T>(resolver) {}
        void onSuccess(typename S::WebType r) override
        {
            typename S::WebType result(adopt(r));
            ScriptPromiseResolver* resolver = this->resolver();
            if (!resolver->getExecutionContext() || resolver->getExecutionContext()->activeDOMObjectsAreStopped())
                return;
            resolver->resolve(S::take(resolver, pass(result)));
        }
    };
    template <typename T>
    class OnSuccess<CallbackPromiseAdapterTrivialWebTypeHolder<void>, T> : public Base<CallbackPromiseAdapterTrivialWebTypeHolder<void>, T> {
    public:
        explicit OnSuccess(ScriptPromiseResolver* resolver) : Base<CallbackPromiseAdapterTrivialWebTypeHolder<void>, T>(resolver) {}
        void onSuccess() override
        {
            ScriptPromiseResolver* resolver = this->resolver();
            if (!resolver->getExecutionContext() || resolver->getExecutionContext()->activeDOMObjectsAreStopped())
                return;
            resolver->resolve();
        }
    };
    template <typename S, typename T>
    class OnError : public OnSuccess<S, T> {
    public:
        explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, T>(resolver) {}
        void onError(typename T::WebType e) override
        {
            typename T::WebType result(adopt(e));
            ScriptPromiseResolver* resolver = this->resolver();
            if (!resolver->getExecutionContext() || resolver->getExecutionContext()->activeDOMObjectsAreStopped())
                return;
            ScriptState::Scope scope(resolver->getScriptState());
            resolver->reject(T::take(resolver, pass(result)));
        }
    };
    template <typename S>
    class OnError<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>> : public OnSuccess<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>> {
    public:
        explicit OnError(ScriptPromiseResolver* resolver) : OnSuccess<S, CallbackPromiseAdapterTrivialWebTypeHolder<void>>(resolver) {}
        void onError() override
        {
            ScriptPromiseResolver* resolver = this->resolver();
            if (!resolver->getExecutionContext() || resolver->getExecutionContext()->activeDOMObjectsAreStopped())
                return;
            resolver->reject();
        }
    };

public:
    template <typename S, typename T>
    class CallbackPromiseAdapter final : public OnError<WebTypeHolder<S>, WebTypeHolder<T>> {
        WTF_MAKE_NONCOPYABLE(CallbackPromiseAdapter);
    public:
        explicit CallbackPromiseAdapter(ScriptPromiseResolver* resolver) : OnError<WebTypeHolder<S>, WebTypeHolder<T>>(resolver) {}
    };
};

} // namespace internal

template <typename S, typename T>
using CallbackPromiseAdapter = internal::CallbackPromiseAdapterInternal::CallbackPromiseAdapter<S, T>;

} // namespace blink

#endif


text:
"use strict";

import "./connection";
import "./auth";
import "./commands";
import "./init";
import "./join";
import "./more";
import "./msg";
import "./msg_preview";
import "./msg_special";
import "./names";
import "./network";
import "./nick";
import "./open";
import "./part";
import "./quit";
import "./sync_sort";
import "./topic";
import "./users";
import "./sign_out";
import "./sessions_list";
import "./configuration";
import "./changelog";
import "./setting";
import "./history_clear";
import "./mentions";


text:
package arrow

type BinaryType struct{}

func (t *BinaryType) ID() Type       { return BINARY }
func (t *BinaryType) Name() string   { return "binary" }
func (t *BinaryType) String() string { return "binary" }
func (t *BinaryType) binary()        {}

type StringType struct{}

func (t *StringType) ID() Type       { return STRING }
func (t *StringType) Name() string   { return "utf8" }
func (t *StringType) String() string { return "utf8" }
func (t *StringType) binary()        {}

var (
	BinaryTypes = struct {
		Binary BinaryDataType
		String BinaryDataType
	}{
		Binary: &BinaryType{},
		String: &StringType{},
	}
)


text:
class PushMerge

  def initialize(config, options)
    @config = config
    @options = options
  end

  def push!
    github = initialize_github
  end

  def initialize_github
    api_endpoint = config["host"] || "https://api.github.com"
    oauth_token = config["oauth"]

    Github.new do |config|
      config.endpoint = api_endpoint
      config.oauth_token = oauth_token
      config.adapter = :net_http
    end
  end

end


text:
package drive

import (
	"errors"
	"fmt"
	"io"
	"os"
	"path"
	"path/filepath"

	"github.com/cheggaaa/pb"
	"github.com/mattn/go-isatty"
	expirableCache "github.com/odeke-em/cache"
	"github.com/odeke-em/drive/config"
	"github.com/odeke-em/log"
)

var (
	ErrNoContext = errors.New("not in a drive context")
)

type Options struct {
	// Depth is the number of pages/ listing recursion depth
	Depth int
	// Exports contains the formats to export your Google Docs + Sheets to
	// e.g ["csv" "txt"]
	Exports []string
	// ExportsDir is the directory to put the exported Google Docs + Sheets.
	// If not provided, will export them to the same dir as the source files are
	ExportsDir string

	// ExportsDumpToSameDirectory when set, requests that all exports be put in the
	// same directory instead of in a directory that is prefixed first by the file name
	ExportsDumpToSameDirectory bool

	// Force once set always converts NoChange into an Addition
	Force bool
	// Hidden discovers hidden paths if set
	Hidden  bool
	Ignorer func(string) bool
	// IgnoreChecksum when set avoids the step
	// of comparing checksums as a final check.
	IgnoreChecksum bool
	// IgnoreConflict when set turns off the conflict resolution safety.
	IgnoreConflict bool
	// Allows listing of content in trash
	InTrash bool
	Meta    *map[string][]string
	Mount   *config.Mount
	// NoClobber when set prevents overwriting of stale content
	NoClobber bool
	// NoPrompt overwrites any prompt pauses
	NoPrompt bool
	Path     string
	// PageSize determines the number of results returned per API call
	PageSize  int64
	Recursive bool
	// Sources is a of list all paths that are
	// within the scope/path of the current gd context
	Sources []string
	// TypeMask contains the result of setting different type bits e.g
	// Folder to search only for folders etc.
	TypeMask int
	// Piped when set means to infer content to or from stdin
	Piped bool
	// Quiet when set toggles only logging of errors to stderrs as
	// well as reading from stdin in this case stdout is not logged to
	Quiet             bool
	StdoutIsTty       bool
	IgnoreNameClashes bool
	ExcludeCrudMask   CrudValue
	ExplicitlyExport  bool
	Md5sum            bool
	indexingOnly      bool
	Verbose           bool
	FixClashes        bool
	FixClashesMode    FixClashesMode
	Match             bool
	Starred           bool
	// BaseLocal when set, during a diff uses the local file
	// as the base otherwise remote is used as the base
	BaseLocal bool
	// Destination when set is the final logical location of the
	// constituents of an operation for example a push or pull.
	// See issue #612.
	Destination                  string
	RenameMode                   RenameMode
	ExponentialBackoffRetryCount int

	Encrypter func(io.Reader) (io.Reader, error)
	Decrypter func(io.Reader) (io.ReadCloser, error)

	// AllowURLLinkedFiles when set signifies that the user
	// depending on their OS, wants us to create for them
	// clickable files where applicable.
	// See issue #697.
	AllowURLLinkedFiles bool

	// Chunksize is the size per block of data uploaded.
	// If not set, the default value from googleapi.DefaultUploadChunkSize
	// is used instead.
	UploadChunkSize int
}

func (opts *Options) CryptoEnabled() bool {
	return opts.Decrypter != nil || opts.Encrypter != nil
}

type Commands struct {
	context *config.Context
	rem     *Remote
	opts    *Options
	rcOpts  *Options
	log     *log.Logger

	progress      *pb.ProgressBar
	mkdirAllCache *expirableCache.OperationCache
}

func (opts *Options) canPrompt() bool {
	if opts == nil || !opts.StdoutIsTty {
		return false
	}
	if opts.Quiet {
		return false
	}
	return !opts.NoPrompt
}

func (c *Commands) DebugPrintf(fmt_ string, args ...interface{}) {
	if !((Debug() || c.opts.Verbose) && c.opts.canPreview()) {
		return
	}
	FDebugPrintf(c.log, fmt_, args...)
}

func (opts *Options) canPreview() bool {
	if opts == nil || !opts.StdoutIsTty {
		return false
	}
	if opts.Quiet {
		return false
	}
	return true
}

func rcPathChecker(absDir string) (string, error) {
	p := rcPath(absDir)
	statInfo, err := os.Stat(p)
	if err != nil && !os.IsNotExist(err) {
		return "", err
	}

	if statInfo == nil {
		return "", os.ErrNotExist
	}
	return p, nil
}

func (opts *Options) rcPath() (string, error) {
	lastCurPath := ""
	for curPath := opts.Path; curPath != ""; curPath = path.Dir(curPath) {
		localRCP, err := rcPathChecker(curPath)
		if err == nil && localRCP != "" {
			return localRCP, nil
		}

		if false && err != nil && !os.IsNotExist(err) {
			return "", err
		}

		if lastCurPath == curPath { // Avoid getting a stalemate incase path.Dir cannot progress
			break
		}

		lastCurPath = curPath
	}

	return rcPathChecker(FsHomeDir)
}

func New(context *config.Context, opts *Options) *Commands {
	var rem *Remote
	var err error

	if context.GSAJWTConfig != nil {
		rem, err = NewRemoteContextFromServiceAccount(context.GSAJWTConfig)
	} else {
		rem, err = NewRemoteContext(context)
	}

	if err != nil {
		panic(fmt.Errorf("failed to initialize remoteContext: %v", err))
	}

	stdin, stdout, stderr := os.Stdin, os.Stdout, os.Stderr

	var logger *log.Logger = nil

	if opts == nil {
		logger = log.New(stdin, stdout, stderr)
	} else {
		if opts.Quiet {
			stdout = nil
		}

		if stdout != nil {
			opts.StdoutIsTty = isatty.IsTerminal(stdout.Fd())
		}

		if stdout == nil && opts.Piped {
			panic("piped requires stdout to be non-nil")
		}

		logger = log.New(stdin, stdout, stderr)

		// should always start with /
		opts.Path = path.Clean(path.Join("/", opts.Path))

		if !opts.Force {
			ignoresPath := filepath.Join(context.AbsPath, DriveIgnoreSuffix)
			ignorer, regErr := combineIgnores(ignoresPath)

			if regErr != nil {
				logger.LogErrf("combining ignores from path %s and internally: %v\n", ignoresPath, regErr)
			}

			opts.Ignorer = ignorer
		}
	}

	return &Commands{
		context:       context,
		rem:           rem,
		opts:          opts,
		log:           logger,
		mkdirAllCache: expirableCache.New(),
	}
}

func (g *Commands) taskStart(tasks int64) {
	if tasks > 0 && g.opts.canPreview() {
		g.progress = newProgressBar(tasks)
	}
}

func newProgressBar(total int64) *pb.ProgressBar {
	pbf := pb.New64(total)
	pbf.Start()
	return pbf
}

func (g *Commands) taskAdd(n int64) {
	if g.progress != nil {
		g.progress.Add64(n)
	}
}

func (g *Commands) taskFinish() {
	if g.progress != nil {
		g.progress.Finish()
	}
}


text:
package lfs

import (
	"bufio"
	"fmt"
	"strconv"
	"strings"

	"github.com/git-lfs/git-lfs/errors"
	"github.com/git-lfs/git-lfs/git"
)

// Status represents the status of a file that appears in the output of `git
// diff-index`.
//
// More information about each of its valid instances can be found:
// https://git-scm.com/docs/git-diff-index
type DiffIndexStatus rune

const (
	StatusAddition     DiffIndexStatus = 'A'
	StatusCopy         DiffIndexStatus = 'C'
	StatusDeletion     DiffIndexStatus = 'D'
	StatusModification DiffIndexStatus = 'M'
	StatusRename       DiffIndexStatus = 'R'
	StatusTypeChange   DiffIndexStatus = 'T'
	StatusUnmerged     DiffIndexStatus = 'U'
	StatusUnknown      DiffIndexStatus = 'X'
)

// String implements fmt.Stringer by returning a human-readable name for each
// status.
func (s DiffIndexStatus) String() string {
	switch s {
	case StatusAddition:
		return "addition"
	case StatusCopy:
		return "copy"
	case StatusDeletion:
		return "deletion"
	case StatusModification:
		return "modification"
	case StatusRename:
		return "rename"
	case StatusTypeChange:
		return "change"
	case StatusUnmerged:
		return "unmerged"
	case StatusUnknown:
		return "unknown"
	}
	return "<unknown>"
}

// Format implements fmt.Formatter. If printed as "%+d", "%+s", or "%+v", the
// status will be written out as an English word: i.e., "addition", "copy",
// "deletion", etc.
//
// If the '+' flag is not given, the shorthand will be used instead: 'A', 'C',
// and 'D', respectively.
//
// If any other format verb is given, this function will panic().
func (s DiffIndexStatus) Format(state fmt.State, c rune) {
	switch c {
	case 'd', 's', 'v':
		if state.Flag('+') {
			state.Write([]byte(s.String()))
		} else {
			state.Write([]byte{byte(rune(s))})
		}
	default:
		panic(fmt.Sprintf("cannot format %v for DiffIndexStatus", c))
	}
}

// DiffIndexEntry holds information about a single item in the results of a `git
// diff-index` command.
type DiffIndexEntry struct {
	// SrcMode is the file mode of the "src" file, stored as a string-based
	// octal.
	SrcMode string
	// DstMode is the file mode of the "dst" file, stored as a string-based
	// octal.
	DstMode string
	// SrcSha is the Git blob ID of the "src" file.
	SrcSha string
	// DstSha is the Git blob ID of the "dst" file.
	DstSha string
	// Status is the status of the file in the index.
	Status DiffIndexStatus
	// StatusScore is the optional "score" associated with a particular
	// status.
	StatusScore int
	// SrcName is the name of the file in its "src" state as it appears in
	// the index.
	SrcName string
	// DstName is the name of the file in its "dst" state as it appears in
	// the index.
	DstName string
}

// DiffIndexScanner scans the output of the `git diff-index` command.
type DiffIndexScanner struct {
	// next is the next entry scanned by the Scanner.
	next *DiffIndexEntry
	// err is any error that the Scanner encountered while scanning.
	err error

	// from is the underlying scanner, scanning the `git diff-index`
	// command's stdout.
	from *bufio.Scanner
}

// NewDiffIndexScanner initializes a new `DiffIndexScanner` scanning at the
// given ref, "ref".
//
// If "cache" is given, the DiffIndexScanner will scan for differences between
// the given ref and the index. If "cache" is _not_ given, DiffIndexScanner will
// scan for differences between the given ref and the currently checked out
// tree.
//
// If "refresh" is given, the DiffIndexScanner will refresh the index.  This is
// probably what you want in all cases except fsck, where invoking a filtering
// operation would be undesirable due to the possibility of corruption. It can
// also be disabled where another operation will have refreshed the index.
//
// If any error was encountered in starting the command or closing its `stdin`,
// that error will be returned immediately. Otherwise, a `*DiffIndexScanner`
// will be returned with a `nil` error.
func NewDiffIndexScanner(ref string, cached bool, refresh bool) (*DiffIndexScanner, error) {
	scanner, err := git.DiffIndex(ref, cached, refresh)
	if err != nil {
		return nil, err
	}
	return &DiffIndexScanner{
		from: scanner,
	}, nil
}

// Scan advances the scan line and yields either a new value for Entry(), or an
// Err(). It returns true or false, whether or not it can continue scanning for
// more entries.
func (s *DiffIndexScanner) Scan() bool {
	if !s.prepareScan() {
		return false
	}

	s.next, s.err = s.scan(s.from.Text())
	if s.err != nil {
		s.err = errors.Wrap(s.err, "scan")
	}

	return s.err == nil
}

// Entry returns the last entry that was Scan()'d by the DiffIndexScanner.
func (s *DiffIndexScanner) Entry() *DiffIndexEntry { return s.next }

// Entry returns the last error that was encountered by the DiffIndexScanner.
func (s *DiffIndexScanner) Err() error { return s.err }

// prepareScan clears out the results from the last Scan() loop, and advances
// the internal scanner to fetch a new line of Text().
func (s *DiffIndexScanner) prepareScan() bool {
	s.next, s.err = nil, nil
	if !s.from.Scan() {
		s.err = s.from.Err()
		return false
	}

	return true
}

// scan parses the given line and returns a `*DiffIndexEntry` or an error,
// depending on whether or not the parse was successful.
func (s *DiffIndexScanner) scan(line string) (*DiffIndexEntry, error) {
	// Format is:
	//   :100644 100644 c5b3d83a7542255ec7856487baa5e83d65b1624c 9e82ac1b514be060945392291b5b3108c22f6fe3 M foo.gif
	//   :<old mode> <new mode> <old sha1> <new sha1> <status>\t<file name>[\t<file name>]

	parts := strings.Split(line, "\t")
	if len(parts) < 2 {
		return nil, errors.Errorf("invalid line: %s", line)
	}

	desc := strings.Fields(parts[0])
	if len(desc) < 5 {
		return nil, errors.Errorf("invalid description: %s", parts[0])
	}

	entry := &DiffIndexEntry{
		SrcMode: strings.TrimPrefix(desc[0], ":"),
		DstMode: desc[1],
		SrcSha:  desc[2],
		DstSha:  desc[3],
		Status:  DiffIndexStatus(rune(desc[4][0])),
		SrcName: parts[1],
	}

	if score, err := strconv.Atoi(desc[4][1:]); err != nil {
		entry.StatusScore = score
	}

	if len(parts) > 2 {
		entry.DstName = parts[2]
	}

	return entry, nil
}


text:
namespace arangodb {
class SslServerFeature : public application_features::ApplicationFeature {
 public:
  static SslServerFeature* SSL;

 public:
  explicit SslServerFeature(application_features::ApplicationServer* server);

 public:
  void collectOptions(std::shared_ptr<options::ProgramOptions>) override;
  void prepare() override final;
  void unprepare() override final;

 public:
  virtual void verifySslOptions();

 public:
  virtual boost::asio::ssl::context createSslContext() const;

 protected:
  std::string _cafile;
  std::string _keyfile;
  bool _sessionCache;
  std::string _cipherList;
  uint64_t _sslProtocol;
  uint64_t _sslOptions;
  std::string _ecdhCurve;

 private:
  std::string stringifySslOptions(uint64_t opts) const;

 private:
  std::string _rctx;
};
}

#endif


text:
package org.softlang.template;

import org.softlang.company.Company;
import org.softlang.company.Department;
import org.softlang.company.Employee;

/**
 * Provide the template method "walk" for traversing over companies.
 * The "walk" method is configured with "visit" methods for all possible types.
 */
public class Walker {

	public void visit(Company c) {
	}

	public void visit(Department d) {
	}

	public void visit(Employee e) {
	}

	/**
	 * Provide the template method "walk" for traversing over companies.
	 */
	public final void walk(Company c) {
		visit(c);
		for (Department d : c.getDepts())
			walk(d);
	}

	private void walk(Department d) {
		visit(d);
		walk(d.getManager());
		for (Department s : d.getSubdepts())
			walk(s);
		for (Employee e : d.getEmployees())
			walk(e);
	}

	private void walk(Employee e) {
		visit(e);
	}
}