text:
// -----------------------------------------------------------------------
// <copyright file="AddInstrumentFredViewModel.cs" company="">
// Copyright 2017 Alexander Soffronow Pagonidis
// </copyright>
// -----------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using MahApps.Metro.Controls.Dialogs;
using NLog;
using QDMS;
using ReactiveUI;

namespace QDMSServer.ViewModels
{
    public class AddInstrumentFredViewModel : ReactiveObject
    {
        private Logger _logger = LogManager.GetCurrentClassLogger();
        private readonly IDataClient _client;
        private readonly IDialogCoordinator _dialogCoordinator;
        private string _status;
        private Datasource _thisDS;
        private string _symbol;
        private const string ApiKey = "f8d71bdcf1d7153e157e0baef35f67db";

        public string Status
        {
            get => _status;
            set => this.RaiseAndSetIfChanged(ref _status, value);
        }

        public string Symbol
        {
            get => _symbol;
            set => this.RaiseAndSetIfChanged(ref _symbol, value);
        }

        public ReactiveCommand<string, Unit> Search { get; }

        public ReactiveList<FredUtils.FredSeries> Series { get; }
        public List<Instrument> AddedInstruments { get; set; } = new List<Instrument>();

        public AddInstrumentFredViewModel(IDataClient client, IDialogCoordinator dialogCoordinator)
        {
            _client = client;
            _dialogCoordinator = dialogCoordinator;
            Series = new ReactiveList<FredUtils.FredSeries>();

            //Create commands
            Load = ReactiveCommand.CreateFromTask(async _ =>
            {
                var dsResult = await _client.GetDatasources().ConfigureAwait(true);
                if (dsResult.WasSuccessful)
                {
                    _thisDS = dsResult.Result.FirstOrDefault(x => x.Name == "FRED");
                }
                else
                {
                    _logger.Error("Could not find FRED datasource");
                }
            });

            var canSearch = this.WhenAnyValue(x => x.Symbol).Select(x => !string.IsNullOrEmpty(x));
            Search = ReactiveCommand.CreateFromTask<string>(async symbol =>
            {
                Series.Clear();
                Status = "Searching...";
                try
                {
                    var foundSeries = await FredUtils.FindSeries(Symbol, ApiKey).ConfigureAwait(true);
                    foreach (var i in foundSeries)
                    {
                        Series.Add(i);
                    }

                    Status = foundSeries.Count() + " contracts found";
                }
                catch(Exception ex)
                {
                    await _dialogCoordinator.ShowMessageAsync(this, "Error", ex.Message).ConfigureAwait(true);
                }
            }, canSearch);

            Add = ReactiveCommand.CreateFromTask<IList>(async selectedInstruments =>
            {
                int count = 0;

                foreach (FredUtils.FredSeries series in selectedInstruments)
                {
                    var newInstrument = FredUtils.SeriesToInstrument(series);
                    newInstrument.Datasource = _thisDS;
                    newInstrument.DatasourceID = _thisDS.ID;

                    var result = await _client.AddInstrument(newInstrument).ConfigureAwait(true);
                    if (await result.DisplayErrors(this, _dialogCoordinator).ConfigureAwait(true))
                    {
                        continue;
                    }

                    count++;
                    AddedInstruments.Add(result.Result);
                }

                Status = string.Format("{0}/{1} instruments added.", count, selectedInstruments.Count);
            });

        }

        public ReactiveCommand<Unit, Unit> Load { get; set; }

        public ReactiveCommand<IList, Unit> Add { get; set; }
    }
}


text:
package rlVizLib.messaging.environment;

import java.util.StringTokenizer;
import java.util.Vector;

import rlVizLib.messaging.AbstractMessage;
import rlVizLib.messaging.AbstractResponse;
import rlVizLib.messaging.GenericMessage;
import rlVizLib.messaging.MessageUser;
import rlVizLib.messaging.MessageValueType;
import rlVizLib.messaging.NotAnRLVizMessageException;

public class EnvRangeResponse extends AbstractResponse{
	private Vector<Double> mins=null;
	private Vector<Double> maxs=null;

	public EnvRangeResponse(Vector<Double> mins, Vector<Double> maxs){
		this.mins=mins;
		this.maxs=maxs;
	}

	public EnvRangeResponse(String responseMessage) throws NotAnRLVizMessageException {

		GenericMessage theGenericResponse = new GenericMessage(responseMessage);

		String thePayLoadString=theGenericResponse.getPayload();

		StringTokenizer obsTokenizer = new StringTokenizer(thePayLoadString, ":");

		String numValuesToken=obsTokenizer.nextToken();
		int numValues=Integer.parseInt(numValuesToken);

		mins=new Vector<Double>();
		maxs=new Vector<Double>();

		for(int i=0;i<numValues;i++){
			mins.add(Double.parseDouble(obsTokenizer.nextToken()));
			maxs.add(Double.parseDouble(obsTokenizer.nextToken()));
		}

	}

	public String toString() {
		String theResponse="EnvRangeResponse: " + mins.size()+" variables, they are:";
		for(int i=0;i<mins.size();i++){
			theResponse+=" ("+mins.get(i)+","+maxs.get(i)+") ";
		}
		// TODO Auto-generated method stub
		return theResponse;
	}

	public Vector<Double> getMins() {
		return mins;
	}

	public Vector<Double> getMaxs() {
		return maxs;
	}

	@Override
	public String makeStringResponse() {

		String thePayLoadString=mins.size()+":";

		for(int i=0;i<mins.size();i++){
			thePayLoadString+=mins.get(i)+":"+maxs.get(i)+":";
		}

		String theResponse=AbstractMessage.makeMessage(
				MessageUser.kBenchmark.id(),
				MessageUser.kEnv.id(),
				EnvMessageType.kEnvResponse.id(),
				MessageValueType.kStringList.id(),
				thePayLoadString);

		return theResponse;

	}
};

redpajama_set_name: RedPajamaGithub


text:
/* app/ui/lightbox/single */

define(
	[
		'jquery',
		'app/ui/lightbox/common',
		'colorbox'
	],

	function ( $, LightboxCommon ) {

		var LightboxSingle;

		return {

			init: function () {
				LightboxSingle = this;
				LightboxCommon.init(true);
				var config = {
					transition: 'none',
					maxWidth: '90%',
					title: LightboxCommon.setTitle,
					onLoad: LightboxCommon.onLoadProcessing,
					onComplete: LightboxCommon.onCompleteProcessing,
					photo: true
				};
				$( '.no-touch .js-lightbox-single' ).find( 'a' ).not( '.figure-caption' ).colorbox( config );
			},

			open: function () {
				$( this ).trigger( 'click' );
			}
		};

	}
);


text:
ReactKT aims to ease front end developpement using :
* [Kotlin](https://kotlinlang.org) language from JetBrains
* [ReactJS](https://facebook.github.io/react/) view building library
* [Material Design Lite](http://www.getmdl.io) as UI Component library

# Why ?

Mainly because I don't know Kotlin, nor React, nor Material Design. So, it's fun :)

# Status

*I DO NOT RECOMMAND TO USE THIS PROJECT IN PRODUCTION* _(yet...)_

I publish this as an initial & prototyping work. I'm currently unsatisfied by a lot of thing (API design, level of type safety)

Feedback and contribution are welcomes.

# How to test

There is another _Todo app_ in `sampleprojects/demo-core`.

Clone the repository. Launch `gradlew webdist`, then open `sampleprojects/demo-core/build/webdist/index.html` in your favorite browser.


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Sistotrema taurinum Pers.

### Remarks
null


text:
package org.elasticsearch.cluster.block;

import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.elasticsearch.cluster.AbstractDiffable;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.MetaDataIndexStateService;
import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.rest.RestStatus;

import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;

import static java.util.Collections.emptySet;
import static java.util.Collections.unmodifiableSet;
import static java.util.stream.Collectors.toSet;
import static java.util.stream.Stream.concat;

/**
 * Represents current cluster level blocks to block dirty operations done against the cluster.
 */
public class ClusterBlocks extends AbstractDiffable<ClusterBlocks> {
    public static final ClusterBlocks EMPTY_CLUSTER_BLOCK = new ClusterBlocks(emptySet(), ImmutableOpenMap.of());

    public static final ClusterBlocks PROTO = EMPTY_CLUSTER_BLOCK;

    private final Set<ClusterBlock> global;

    private final ImmutableOpenMap<String, Set<ClusterBlock>> indicesBlocks;

    private final ImmutableLevelHolder[] levelHolders;

    ClusterBlocks(Set<ClusterBlock> global, ImmutableOpenMap<String, Set<ClusterBlock>> indicesBlocks) {
        this.global = global;
        this.indicesBlocks = indicesBlocks;

        levelHolders = new ImmutableLevelHolder[ClusterBlockLevel.values().length];
        for (final ClusterBlockLevel level : ClusterBlockLevel.values()) {
            Predicate<ClusterBlock> containsLevel = block -> block.contains(level);
            Set<ClusterBlock> newGlobal = unmodifiableSet(global.stream()
                    .filter(containsLevel)
                    .collect(toSet()));

            ImmutableOpenMap.Builder<String, Set<ClusterBlock>> indicesBuilder = ImmutableOpenMap.builder();
            for (ObjectObjectCursor<String, Set<ClusterBlock>> entry : indicesBlocks) {
                indicesBuilder.put(entry.key, unmodifiableSet(entry.value.stream()
                        .filter(containsLevel)
                        .collect(toSet())));
            }

            levelHolders[level.id()] = new ImmutableLevelHolder(newGlobal, indicesBuilder.build());
        }
    }

    public Set<ClusterBlock> global() {
        return global;
    }

    public ImmutableOpenMap<String, Set<ClusterBlock>> indices() {
        return indicesBlocks;
    }

    public Set<ClusterBlock> global(ClusterBlockLevel level) {
        return levelHolders[level.id()].global();
    }

    public ImmutableOpenMap<String, Set<ClusterBlock>> indices(ClusterBlockLevel level) {
        return levelHolders[level.id()].indices();
    }

    private Set<ClusterBlock> blocksForIndex(ClusterBlockLevel level, String index) {
        return indices(level).getOrDefault(index, emptySet());
    }

    /**
     * Returns <tt>true</tt> if one of the global blocks as its disable state persistence flag set.
     */
    public boolean disableStatePersistence() {
        for (ClusterBlock clusterBlock : global) {
            if (clusterBlock.disableStatePersistence()) {
                return true;
            }
        }
        return false;
    }

    public boolean hasGlobalBlock(ClusterBlock block) {
        return global.contains(block);
    }

    public boolean hasGlobalBlock(int blockId) {
        for (ClusterBlock clusterBlock : global) {
            if (clusterBlock.id() == blockId) {
                return true;
            }
        }
        return false;
    }

    public boolean hasGlobalBlock(ClusterBlockLevel level) {
        return global(level).size() > 0;
    }

    /**
     * Is there a global block with the provided status?
     */
    public boolean hasGlobalBlock(RestStatus status) {
        for (ClusterBlock clusterBlock : global) {
            if (clusterBlock.status().equals(status)) {
                return true;
            }
        }
        return false;
    }

    public boolean hasIndexBlock(String index, ClusterBlock block) {
        return indicesBlocks.containsKey(index) && indicesBlocks.get(index).contains(block);
    }

    public void globalBlockedRaiseException(ClusterBlockLevel level) throws ClusterBlockException {
        ClusterBlockException blockException = globalBlockedException(level);
        if (blockException != null) {
            throw blockException;
        }
    }

    public ClusterBlockException globalBlockedException(ClusterBlockLevel level) {
        if (global(level).isEmpty()) {
            return null;
        }
        return new ClusterBlockException(global(level));
    }

    public void indexBlockedRaiseException(ClusterBlockLevel level, String index) throws ClusterBlockException {
        ClusterBlockException blockException = indexBlockedException(level, index);
        if (blockException != null) {
            throw blockException;
        }
    }

    public ClusterBlockException indexBlockedException(ClusterBlockLevel level, String index) {
        if (!indexBlocked(level, index)) {
            return null;
        }
        Stream<ClusterBlock> blocks = concat(
                global(level).stream(),
                blocksForIndex(level, index).stream());
        return new ClusterBlockException(unmodifiableSet(blocks.collect(toSet())));
    }

    public boolean indexBlocked(ClusterBlockLevel level, String index) {
        if (!global(level).isEmpty()) {
            return true;
        }
        return !blocksForIndex(level, index).isEmpty();
    }

    public ClusterBlockException indicesBlockedException(ClusterBlockLevel level, String[] indices) {
        boolean indexIsBlocked = false;
        for (String index : indices) {
            if (indexBlocked(level, index)) {
                indexIsBlocked = true;
            }
        }
        if (!indexIsBlocked) {
            return null;
        }
        Function<String, Stream<ClusterBlock>> blocksForIndexAtLevel = index -> blocksForIndex(level, index).stream();
        Stream<ClusterBlock> blocks = concat(
                global(level).stream(),
                Stream.of(indices).flatMap(blocksForIndexAtLevel));
        return new ClusterBlockException(unmodifiableSet(blocks.collect(toSet())));
    }

    public String prettyPrint() {
        if (global.isEmpty() && indices().isEmpty()) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        sb.append("blocks: \n");
        if (global.isEmpty() == false) {
            sb.append("   _global_:\n");
            for (ClusterBlock block : global) {
                sb.append("      ").append(block);
            }
        }
        for (ObjectObjectCursor<String, Set<ClusterBlock>> entry : indices()) {
            sb.append("   ").append(entry.key).append(":\n");
            for (ClusterBlock block : entry.value) {
                sb.append("      ").append(block);
            }
        }
        sb.append("\n");
        return sb.toString();
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        writeBlockSet(global, out);
        out.writeVInt(indicesBlocks.size());
        for (ObjectObjectCursor<String, Set<ClusterBlock>> entry : indicesBlocks) {
            out.writeString(entry.key);
            writeBlockSet(entry.value, out);
        }
    }

    private static void writeBlockSet(Set<ClusterBlock> blocks, StreamOutput out) throws IOException {
        out.writeVInt(blocks.size());
        for (ClusterBlock block : blocks) {
            block.writeTo(out);
        }
    }

    @Override
    public ClusterBlocks readFrom(StreamInput in) throws IOException {
        Set<ClusterBlock> global = readBlockSet(in);
        int size = in.readVInt();
        ImmutableOpenMap.Builder<String, Set<ClusterBlock>> indicesBuilder = ImmutableOpenMap.builder(size);
        for (int j = 0; j < size; j++) {
            indicesBuilder.put(in.readString().intern(), readBlockSet(in));
        }
        return new ClusterBlocks(global, indicesBuilder.build());
    }

    private static Set<ClusterBlock> readBlockSet(StreamInput in) throws IOException {
        int totalBlocks = in.readVInt();
        Set<ClusterBlock> blocks = new HashSet<>(totalBlocks);
        for (int i = 0; i < totalBlocks;i++) {
            blocks.add(ClusterBlock.readClusterBlock(in));
        }
        return unmodifiableSet(blocks);
    }

    static class ImmutableLevelHolder {

        static final ImmutableLevelHolder EMPTY = new ImmutableLevelHolder(emptySet(), ImmutableOpenMap.of());

        private final Set<ClusterBlock> global;
        private final ImmutableOpenMap<String, Set<ClusterBlock>> indices;

        ImmutableLevelHolder(Set<ClusterBlock> global, ImmutableOpenMap<String, Set<ClusterBlock>> indices) {
            this.global = global;
            this.indices = indices;
        }

        public Set<ClusterBlock> global() {
            return global;
        }

        public ImmutableOpenMap<String, Set<ClusterBlock>> indices() {
            return indices;
        }
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {

        private Set<ClusterBlock> global = new HashSet<>();

        private Map<String, Set<ClusterBlock>> indices = new HashMap<>();

        public Builder() {
        }

        public Builder blocks(ClusterBlocks blocks) {
            global.addAll(blocks.global());
            for (ObjectObjectCursor<String, Set<ClusterBlock>> entry : blocks.indices()) {
                if (!indices.containsKey(entry.key)) {
                    indices.put(entry.key, new HashSet<>());
                }
                indices.get(entry.key).addAll(entry.value);
            }
            return this;
        }

        public Builder addBlocks(IndexMetaData indexMetaData) {
            if (indexMetaData.getState() == IndexMetaData.State.CLOSE) {
                addIndexBlock(indexMetaData.getIndex().getName(), MetaDataIndexStateService.INDEX_CLOSED_BLOCK);
            }
            if (IndexMetaData.INDEX_READ_ONLY_SETTING.get(indexMetaData.getSettings())) {
                addIndexBlock(indexMetaData.getIndex().getName(), IndexMetaData.INDEX_READ_ONLY_BLOCK);
            }
            if (IndexMetaData.INDEX_BLOCKS_READ_SETTING.get(indexMetaData.getSettings())) {
                addIndexBlock(indexMetaData.getIndex().getName(), IndexMetaData.INDEX_READ_BLOCK);
            }
            if (IndexMetaData.INDEX_BLOCKS_WRITE_SETTING.get(indexMetaData.getSettings())) {
                addIndexBlock(indexMetaData.getIndex().getName(), IndexMetaData.INDEX_WRITE_BLOCK);
            }
            if (IndexMetaData.INDEX_BLOCKS_METADATA_SETTING.get(indexMetaData.getSettings())) {
                addIndexBlock(indexMetaData.getIndex().getName(), IndexMetaData.INDEX_METADATA_BLOCK);
            }
            return this;
        }

        public Builder updateBlocks(IndexMetaData indexMetaData) {
            removeIndexBlock(indexMetaData.getIndex().getName(), MetaDataIndexStateService.INDEX_CLOSED_BLOCK);
            removeIndexBlock(indexMetaData.getIndex().getName(), IndexMetaData.INDEX_READ_ONLY_BLOCK);
            removeIndexBlock(indexMetaData.getIndex().getName(), IndexMetaData.INDEX_READ_BLOCK);
            removeIndexBlock(indexMetaData.getIndex().getName(), IndexMetaData.INDEX_WRITE_BLOCK);
            removeIndexBlock(indexMetaData.getIndex().getName(), IndexMetaData.INDEX_METADATA_BLOCK);
            return addBlocks(indexMetaData);
        }

        public Builder addGlobalBlock(ClusterBlock block) {
            global.add(block);
            return this;
        }

        public Builder removeGlobalBlock(ClusterBlock block) {
            global.remove(block);
            return this;
        }

        public Builder removeGlobalBlock(int blockId) {
            global.removeIf(block -> block.id() == blockId);
            return this;
        }

        public Builder addIndexBlock(String index, ClusterBlock block) {
            if (!indices.containsKey(index)) {
                indices.put(index, new HashSet<>());
            }
            indices.get(index).add(block);
            return this;
        }

        public Builder removeIndexBlocks(String index) {
            if (!indices.containsKey(index)) {
                return this;
            }
            indices.remove(index);
            return this;
        }

        public Builder removeIndexBlock(String index, ClusterBlock block) {
            if (!indices.containsKey(index)) {
                return this;
            }
            indices.get(index).remove(block);
            if (indices.get(index).isEmpty()) {
                indices.remove(index);
            }
            return this;
        }

        public ClusterBlocks build() {
            // We copy the block sets here in case of the builder is modified after build is called
            ImmutableOpenMap.Builder<String, Set<ClusterBlock>> indicesBuilder = ImmutableOpenMap.builder(indices.size());
            for (Map.Entry<String, Set<ClusterBlock>> entry : indices.entrySet()) {
                indicesBuilder.put(entry.getKey(), unmodifiableSet(new HashSet<>(entry.getValue())));
            }
            return new ClusterBlocks(unmodifiableSet(new HashSet<>(global)), indicesBuilder.build());
        }

        public static ClusterBlocks readClusterBlocks(StreamInput in) throws IOException {
            return PROTO.readFrom(in);
        }
    }
}


text:
package armautomanage

import (
	"context"
	"errors"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
	armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
	"net/http"
	"net/url"
	"strings"
)

// ConfigurationProfileHCIAssignmentsClient contains the methods for the ConfigurationProfileHCIAssignments group.
// Don't use this type directly, use NewConfigurationProfileHCIAssignmentsClient() instead.
type ConfigurationProfileHCIAssignmentsClient struct {
	host           string
	subscriptionID string
	pl             runtime.Pipeline
}

// NewConfigurationProfileHCIAssignmentsClient creates a new instance of ConfigurationProfileHCIAssignmentsClient with the specified values.
// subscriptionID - The ID of the target subscription.
// credential - used to authorize requests. Usually a credential from azidentity.
// options - pass nil to accept the default values.
func NewConfigurationProfileHCIAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationProfileHCIAssignmentsClient, error) {
	if options == nil {
		options = &arm.ClientOptions{}
	}
	ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint
	if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok {
		ep = c.Endpoint
	}
	pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options)
	if err != nil {
		return nil, err
	}
	client := &ConfigurationProfileHCIAssignmentsClient{
		subscriptionID: subscriptionID,
		host:           ep,
		pl:             pl,
	}
	return client, nil
}

// CreateOrUpdate - Creates an association between a AzureStackHCI cluster and Automanage configuration profile
// If the operation fails it returns an *azcore.ResponseError type.
// Generated from API version 2022-05-04
// resourceGroupName - The name of the resource group. The name is case insensitive.
// clusterName - The name of the Arc machine.
// configurationProfileAssignmentName - Name of the configuration profile assignment. Only default is supported.
// parameters - Parameters supplied to the create or update configuration profile assignment.
// options - ConfigurationProfileHCIAssignmentsClientCreateOrUpdateOptions contains the optional parameters for the ConfigurationProfileHCIAssignmentsClient.CreateOrUpdate
// method.
func (client *ConfigurationProfileHCIAssignmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string, parameters ConfigurationProfileAssignment, options *ConfigurationProfileHCIAssignmentsClientCreateOrUpdateOptions) (ConfigurationProfileHCIAssignmentsClientCreateOrUpdateResponse, error) {
	req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, configurationProfileAssignmentName, parameters, options)
	if err != nil {
		return ConfigurationProfileHCIAssignmentsClientCreateOrUpdateResponse{}, err
	}
	resp, err := client.pl.Do(req)
	if err != nil {
		return ConfigurationProfileHCIAssignmentsClientCreateOrUpdateResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) {
		return ConfigurationProfileHCIAssignmentsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp)
	}
	return client.createOrUpdateHandleResponse(resp)
}

// createOrUpdateCreateRequest creates the CreateOrUpdate request.
func (client *ConfigurationProfileHCIAssignmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string, parameters ConfigurationProfileAssignment, options *ConfigurationProfileHCIAssignmentsClientCreateOrUpdateOptions) (*policy.Request, error) {
	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}"
	if client.subscriptionID == "" {
		return nil, errors.New("parameter client.subscriptionID cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
	if resourceGroupName == "" {
		return nil, errors.New("parameter resourceGroupName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
	if clusterName == "" {
		return nil, errors.New("parameter clusterName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
	if configurationProfileAssignmentName == "" {
		return nil, errors.New("parameter configurationProfileAssignmentName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{configurationProfileAssignmentName}", url.PathEscape(configurationProfileAssignmentName))
	req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath))
	if err != nil {
		return nil, err
	}
	reqQP := req.Raw().URL.Query()
	reqQP.Set("api-version", "2022-05-04")
	req.Raw().URL.RawQuery = reqQP.Encode()
	req.Raw().Header["Accept"] = []string{"application/json"}
	return req, runtime.MarshalAsJSON(req, parameters)
}

// createOrUpdateHandleResponse handles the CreateOrUpdate response.
func (client *ConfigurationProfileHCIAssignmentsClient) createOrUpdateHandleResponse(resp *http.Response) (ConfigurationProfileHCIAssignmentsClientCreateOrUpdateResponse, error) {
	result := ConfigurationProfileHCIAssignmentsClientCreateOrUpdateResponse{}
	if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationProfileAssignment); err != nil {
		return ConfigurationProfileHCIAssignmentsClientCreateOrUpdateResponse{}, err
	}
	return result, nil
}

// Delete - Delete a configuration profile assignment
// If the operation fails it returns an *azcore.ResponseError type.
// Generated from API version 2022-05-04
// resourceGroupName - The name of the resource group. The name is case insensitive.
// clusterName - The name of the Arc machine.
// configurationProfileAssignmentName - Name of the configuration profile assignment
// options - ConfigurationProfileHCIAssignmentsClientDeleteOptions contains the optional parameters for the ConfigurationProfileHCIAssignmentsClient.Delete
// method.
func (client *ConfigurationProfileHCIAssignmentsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string, options *ConfigurationProfileHCIAssignmentsClientDeleteOptions) (ConfigurationProfileHCIAssignmentsClientDeleteResponse, error) {
	req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, configurationProfileAssignmentName, options)
	if err != nil {
		return ConfigurationProfileHCIAssignmentsClientDeleteResponse{}, err
	}
	resp, err := client.pl.Do(req)
	if err != nil {
		return ConfigurationProfileHCIAssignmentsClientDeleteResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) {
		return ConfigurationProfileHCIAssignmentsClientDeleteResponse{}, runtime.NewResponseError(resp)
	}
	return ConfigurationProfileHCIAssignmentsClientDeleteResponse{}, nil
}

// deleteCreateRequest creates the Delete request.
func (client *ConfigurationProfileHCIAssignmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string, options *ConfigurationProfileHCIAssignmentsClientDeleteOptions) (*policy.Request, error) {
	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}"
	if client.subscriptionID == "" {
		return nil, errors.New("parameter client.subscriptionID cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
	if resourceGroupName == "" {
		return nil, errors.New("parameter resourceGroupName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
	if clusterName == "" {
		return nil, errors.New("parameter clusterName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
	if configurationProfileAssignmentName == "" {
		return nil, errors.New("parameter configurationProfileAssignmentName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{configurationProfileAssignmentName}", url.PathEscape(configurationProfileAssignmentName))
	req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))
	if err != nil {
		return nil, err
	}
	reqQP := req.Raw().URL.Query()
	reqQP.Set("api-version", "2022-05-04")
	req.Raw().URL.RawQuery = reqQP.Encode()
	req.Raw().Header["Accept"] = []string{"application/json"}
	return req, nil
}

// Get - Get information about a configuration profile assignment
// If the operation fails it returns an *azcore.ResponseError type.
// Generated from API version 2022-05-04
// resourceGroupName - The name of the resource group. The name is case insensitive.
// clusterName - The name of the Arc machine.
// configurationProfileAssignmentName - The configuration profile assignment name.
// options - ConfigurationProfileHCIAssignmentsClientGetOptions contains the optional parameters for the ConfigurationProfileHCIAssignmentsClient.Get
// method.
func (client *ConfigurationProfileHCIAssignmentsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string, options *ConfigurationProfileHCIAssignmentsClientGetOptions) (ConfigurationProfileHCIAssignmentsClientGetResponse, error) {
	req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, configurationProfileAssignmentName, options)
	if err != nil {
		return ConfigurationProfileHCIAssignmentsClientGetResponse{}, err
	}
	resp, err := client.pl.Do(req)
	if err != nil {
		return ConfigurationProfileHCIAssignmentsClientGetResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return ConfigurationProfileHCIAssignmentsClientGetResponse{}, runtime.NewResponseError(resp)
	}
	return client.getHandleResponse(resp)
}

// getCreateRequest creates the Get request.
func (client *ConfigurationProfileHCIAssignmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string, options *ConfigurationProfileHCIAssignmentsClientGetOptions) (*policy.Request, error) {
	urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}"
	if resourceGroupName == "" {
		return nil, errors.New("parameter resourceGroupName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
	if client.subscriptionID == "" {
		return nil, errors.New("parameter client.subscriptionID cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
	if clusterName == "" {
		return nil, errors.New("parameter clusterName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName))
	if configurationProfileAssignmentName == "" {
		return nil, errors.New("parameter configurationProfileAssignmentName cannot be empty")
	}
	urlPath = strings.ReplaceAll(urlPath, "{configurationProfileAssignmentName}", url.PathEscape(configurationProfileAssignmentName))
	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))
	if err != nil {
		return nil, err
	}
	reqQP := req.Raw().URL.Query()
	reqQP.Set("api-version", "2022-05-04")
	req.Raw().URL.RawQuery = reqQP.Encode()
	req.Raw().Header["Accept"] = []string{"application/json"}
	return req, nil
}

// getHandleResponse handles the Get response.
func (client *ConfigurationProfileHCIAssignmentsClient) getHandleResponse(resp *http.Response) (ConfigurationProfileHCIAssignmentsClientGetResponse, error) {
	result := ConfigurationProfileHCIAssignmentsClientGetResponse{}
	if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationProfileAssignment); err != nil {
		return ConfigurationProfileHCIAssignmentsClientGetResponse{}, err
	}
	return result, nil
}


text:
<?php
namespace RjakesTest\FmPdo;

use PHPUnit_Framework_TestCase;
use Rjakes\FmPdo\Error;
use Rjakes\FmPdo\FmPdo;
use stdClass;

class FmPdoTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var FmPdo
     */
    private $fmPdo;

    public function setUp()
    {

        $dbConfig = array(
            'dsn'      => 'sqlite::memory:',
            'username' => null,
            'password' => null,
        );
        $this->fmPdo = new FmPdo($dbConfig);
    }

    public function testVersion()
    {
        $this->assertRegexp('/[0-9]+\.[0-9]+\.[0-9]+/', $this->fmPdo->getAPIVersion());
    }

    public function testIsErrorFalse()
    {
        $this->assertFalse($this->fmPdo->isError(new stdClass()));
    }

    public function testIsErrorTrue()
    {
        $this->assertTrue($this->fmPdo->isError(new Error()));
    }

    public function testGetProperty()
    {
        $this->fmPdo->test1 = 'TEST';
        $this->assertEquals('TEST', $this->fmPdo->getProperty('test1'));
        $this->assertNull($this->fmPdo->getProperty('test2'));
    }

    public function testGetConnection()
    {
        $this->assertInstanceOf('\PDO', $this->fmPdo->getConnection());
        $this->assertInstanceOf('\Rjakes\FmPdo\Connect', $this->fmPdo->getConnection());
    }

    public function testErrorGetRecordByIDError()
    {
        $pdoStub = $this->getMockBuilder('\RjakesTest\FmPdo\MockPdo')
            ->getMock();

        $pdoStub->expects($this->any())
            ->method('prepare')
            ->will($this->returnValue(null));

        $this->fmPdo->setConnection($pdoStub);
        $this->assertInstanceOf('\Rjakes\FmPdo\Error', $this->fmPdo->getRecordByID('error', 1));
    }

    public function testGetRecordByID()
    {
        //Query Stubbing
        $queryStub = $this->getMock('MockPdoStatement', array('execute', 'fetch'));

        $queryStub->expects($this->once())
            ->method('execute')
            ->will($this->returnSelf());

        $queryStub->expects($this->once())
            ->method('fetch')
            ->will($this->returnValue(array('id' => 1, 'username' => 'baptiste')));

        //PDO stubbing
        $pdoStub = $this->getMock('\RjakesTest\FmPdo\MockPdo', array('prepare'));

        $pdoStub->expects($this->once())
            ->method('prepare')
            ->with($this->equalTo("SELECT * FROM users WHERE id='1' LIMIT 1;"))
            ->will($this->returnValue($queryStub));

        $this->fmPdo->setConnection($pdoStub);

        $this->assertInstanceOf('\Rjakes\FmPdo\Record', $this->fmPdo->getRecordByID('users', 1));
    }
}


text:
var settings = require('settings/root'),
    db = require('db'),
    replication = require('replication'),
    users = require('users'),
    utils = require('duality/utils'),
    duality = require('duality/core'),
    session = require('session'),
    async = require('async'),
    _ = require('underscore')._;

exports['database creation/deletion'] = function (test)
{
    test.expect(6);
    var database_name = 'kanso_testsuite_database';

    db.createDatabase(database_name, function (err_c, rv_c) {
        if (err_c) {
            test.done(err_c);
        }
        test.equal(err_c, undefined, 'Created database successfully');
        test.notEqual(rv_c, undefined, 'Return value is defined');
        test.equal(rv_c.ok, true, 'createDatabase returns okay');

        db.deleteDatabase(database_name, function (err_d, rv_d) {
            if (err_d) {
                test.done(err_d);
            }
            test.equal(err_d, undefined, 'Deleted database successfully');
            test.notEqual(rv_d, undefined, 'Return value is defined');
            test.equal(rv_d.ok, true, 'deleteDatabase returns okay');
            test.done();
        });
    });
};

exports['options.db for saveDoc/getDoc/removeDoc, async'] = function (test)
{
    test.expect(16);
    var database_name = 'kanso_testsuite_options';

    async.waterfall([
        function (callback) {
            db.createDatabase(database_name, function (err, rv) {
                if (err) {
                    test.done(err);
                }
                test.equal(err, undefined, 'createDatabase has no error');
                test.notEqual(rv, undefined, 'createDatabase returns a value');
                test.equal(rv.ok, true, 'createDatabase returns okay');
                callback();
            });
        },
        function (callback) {
            db.use(database_name).saveDoc({ test: true }, function (err, rv) {
                test.notEqual(rv, undefined, 'New test document #1 created');
                test.notEqual(rv.id, undefined, 'New test document #1 has id');
                callback(null, rv);
            });
        },
        function (doc1, callback) {
            db.use(database_name).saveDoc({ test: true }, function (err, rv) {
                test.notEqual(rv, undefined, 'New test document #2 created');
                test.notEqual(rv.id, undefined, 'New test document #2 has id');
                callback(null, doc1, rv);
            });
        },
        function (doc1, doc2, callback) {
            db.use(database_name).getDoc(doc1.id, {}, function (err, rv) {
                test.notEqual(rv, undefined, 'Test document #1 found');
                test.notEqual(rv._rev, undefined, 'Test document #1 has rev');
                callback(null, doc1, doc2);
            });
        },
        function (doc1, doc2, callback) {
            db.use('/' + database_name).getDoc(doc2.id, {}, function (err, rv) {
                test.notEqual(rv, undefined, 'Test document #2 found');
                test.notEqual(rv._rev, undefined, 'Test document #2 has rev');
                callback(null, doc1, doc2);
            });
        },
        function (doc1, doc2, callback) {
            db.use('/' + database_name).removeDoc(
                { _id: doc1.id, _rev: doc1.rev },
                function (err, rv) {
                    if (err) {
                        test.done(err);
                    }
                    test.notEqual(rv.ok, undefined, 'Test document #1 removed');
                    callback(null, doc2);
                }
            );
        },
        function (doc2, callback) {
            db.use(database_name).removeDoc(
                { _id: doc2.id, _rev: doc2.rev },
                function (err, rv) {
                    if (err) {
                        test.done(err);
                    }
                    test.notEqual(rv.ok, undefined, 'Test document #2 removed');
                    callback();
                }
            );
        },
        function (callback) {
            db.deleteDatabase('/' + database_name, function (err, rv) {
                if (err) {
                    test.done(err);
                }
                test.equal(err, undefined, 'deleteDatabase has no error');
                test.notEqual(rv, undefined, 'deleteDatabase returns a value');
                test.equal(rv.ok, true, 'deleteDatabase returns okay');
                callback();
            });
        }
    ], function () {
        test.done();
    });
};

/* A deeply-nested version; no async.js dependency */
exports['simple replication, no async'] = function (test)
{
    test.expect(16);

    /* Create databases */
    db.createDatabase('kanso_testsuite_source', function (e1, r1) {
        if (e1) {
            test.done(e1);
        }
        test.equal(e1, undefined, 'first createDatabase has no error');
        test.notEqual(r1, undefined, 'first createDatabase returns a value');
        test.equal(r1.ok, true, 'first createDatabase returns okay');

        db.createDatabase('kanso_testsuite_target', function (e2, r2) {
            if (e2) {
                test.done(e2);
            }
            test.equal(e2, undefined, 'second createDatabase has no error');
            test.notEqual(r2, undefined, 'second createDatabase returns a value');
            test.equal(r2.ok, true, 'second createDatabase returns okay');

            /* Start replication job */
            replication.start(
                { source: 'kanso_testsuite_source',
                    target: 'kanso_testsuite_target',
                    create_target: false, continuous: false },

                function (err_start, rv_start) {
                    test.equal(err_start, undefined, 'No error starting replication');
                    test.notEqual(rv_start.id, undefined, 'Replication job ID defined');

                    /* Stop replication: Should retry by default */
                    replication.stop(
                        { _id: rv_start.id, _rev: rv_start.rev },

                        function (err_stop, rv_stop) {
                            if (err_stop) {
                                test.done(err_stop);
                            }
                            test.equal(err_stop, undefined, 'No error while stopping replication');
                            test.equal(rv_stop.ok, true, 'stopReplication returns');

                            /* Delete databases */
                            db.deleteDatabase('kanso_testsuite_source', function (e3, r3) {
                                if (e3) {
                                    test.done(e3);
                                }
                                test.equal(e3, undefined, 'first deleteDatabase has no error');
                                test.notEqual(r3, undefined, 'first deleteDatabase returns a value');
                                test.equal(r3.ok, true, 'first deleteDatabase returns okay');

                                db.deleteDatabase('kanso_testsuite_target', function (e4, r4) {
                                    if (e4) {
                                        test.done(e4);
                                    }
                                    test.equal(e4, undefined, 'second deleteDatabase has no error');
                                    test.notEqual(r4, undefined, 'second deleteDatabase returns a value');
                                    test.equal(r4.ok, true, 'second deleteDatabase returns okay');
                                    test.done();
                                });
                            });
                        }
                    );
                }
            );
        });
    });
};

/* Same as above, but using async.js */
exports['simple replication, async'] = function (test)
{
    test.expect(12);

    async.waterfall([
        function (callback) {
            db.createDatabase('kanso_testsuite_source', function (err, rv) {
                if (err) {
                    test.done(err);
                }
                test.equal(err, undefined, 'first createDatabase has no error');
                test.notEqual(rv, undefined, 'first createDatabase returns a value');
                test.equal(rv.ok, true, 'first createDatabase returns okay');
                callback();
            });
        },
        function (callback) {
            db.createDatabase('kanso_testsuite_target', function (err, rv) {
                if (err) {
                    test.done(err);
                }
                test.equal(err, undefined, 'second createDatabase has no error');
                test.notEqual(rv, undefined, 'second createDatabase returns a value');
                test.equal(rv.ok, true, 'second createDatabase returns okay');
                callback();
            });
        },
        function (callback) {
            replication.start(
                { source: 'kanso_testsuite_source',
                    target: 'kanso_testsuite_target',
                    create_target: false, continuous: false },

                function (err, rv) {
                    test.equal(err, undefined, 'No error starting replication');
                    test.notEqual(rv.id, undefined, 'Replication job ID is defined');
                    callback(null, rv);
                }
            );
        },
        function (doc, callback) {
            replication.stop(
                { _id: doc.id, _rev: doc.rev },

                function (err_stop, rv_stop) {
                    if (err_stop) {
                        test.done(err_stop);
                    }
                    test.equal(err_stop, undefined, 'No error stopping replication');
                    test.equal(rv_stop.ok, true, 'stopReplication returns okay');
                    callback();
                }
            );
        },
        function (callback) {
            db.deleteDatabase('kanso_testsuite_target', function (err, rv) {
                if (err) {
                    test.done(err);
                }
                test.equal(rv.ok, true, 'first deleteDatabase returns okay');
                callback();
            });
        },
        function (callback) {
            db.deleteDatabase('kanso_testsuite_source', function (err, rv) {
                if (err) {
                    test.done(err);
                }
                test.equal(rv.ok, true, 'second deleteDatabase returns okay');
                callback();
            });
        }
    ], function () {
        test.done();
    });

};

exports['complex replication, async'] = function (test)
{
    var num_docs = 10;
    var all_created_docs = [];
    var kanso_database = (utils.getBaseURL().slice(1).split('/'))[0];

    test.expect((num_docs * 6) + 34);

    async.waterfall([
        function (callback) {
            db.createDatabase('kanso_testsuite_target1', function (err, rv) {
                if (err) {
                    test.done(err);
                }
                test.equal(err, undefined, 'first createDatabase has no error');
                test.notEqual(rv, undefined, 'first createDatabase returns a value');
                test.equal(rv.ok, true, 'first createDatabase returns okay');
                callback();
            });
        },
        function (callback) {
            db.createDatabase('kanso_testsuite_target2', function (err, rv) {
                if (err) {
                    test.done(err);
                }
                test.equal(err, undefined, 'second createDatabase has no error');
                test.notEqual(rv, undefined, 'second createDatabase returns a value');
                test.equal(rv.ok, true, 'second createDatabase returns okay');
                callback();
            });
        },
        function (callback) {

            /* Function generator:
                    Generates steps to be used inside of async.waterfall. */

            var make_create_doc_fn = function (i) {
                return function (next_fn) {
                    var example_doc = {
                        i: i,
                        test: true,
                        data: 'abcdefghijklmnopqrstuvwxyz'
                    };
                    db.use(settings.name).saveDoc(example_doc, function (err, rv) {
                        test.notEqual(rv, undefined, 'New document is defined');
                        test.notEqual(rv.id, undefined, 'ID for new document is defined');
                        all_created_docs[i] = rv;
                        next_fn();
                    });
                };
            };

            /* Create 100 test documents */
            var create_fn_list = [];

            for (var i = 0; i < num_docs; ++i) {
                create_fn_list[i] = make_create_doc_fn(i);
            }

            async.waterfall(create_fn_list, function () {
                callback();
            });
        },
        function (callback) {
            replication.start(
                { source: kanso_database,
                    target: 'kanso_testsuite_target1',
                    create_target: false, continuous: false },

                function (err, rv) {
                    test.equal(err, undefined, 'No error starting replication');
                    test.notEqual(rv, undefined, 'Replication job returns a value');
                    test.notEqual(rv.id, undefined, 'Replication job ID is defined');
                    callback(null, rv);
                }
            );
        },
        function (doc1, callback) {
            replication.start(
                { source: kanso_database,
                    target: 'kanso_testsuite_target2',
                    create_target: false, continuous: false },

                function (err, rv) {
                    test.equal(err, undefined, 'No error starting replication');
                    test.notEqual(rv, undefined, 'Replication job returns a value');
                    test.notEqual(rv.id, undefined, 'Replication job ID is defined');
                    callback(null, doc1, rv);
                }
            );
        },

        function (doc1, doc2, callback) {
            replication.get(
                doc1.id,
                function (err, rv) {
                    test.equal(err, undefined, 'No error getting replication #1');
                    test.notEqual(rv, undefined, 'Replication job #1 has a value');
                    test.notEqual(rv._id, undefined, 'getReplication #1 has id');
                    test.notEqual(rv._rev, undefined, 'getReplication #1 has rev');
                    callback(null, doc1, doc2);
                }
            );
        },
        function (doc1, doc2, callback) {
            replication.get(
                doc2.id,
                function (err, rv) {
                    test.equal(err, undefined, 'No error getting replication #2');
                    test.notEqual(rv, undefined, 'Replication job #2 has a value');
                    test.notEqual(rv._id, undefined, 'getReplication #2 has id');
                    test.notEqual(rv._rev, undefined, 'getReplication #2 has rev');
                    callback(null, doc1, doc2);
                }
            );
        },
        function (doc1, doc2, callback) {
            replication.wait(doc1, function (err1) {
                test.equal(err1, undefined, 'waitReplication #1 encoutered no error');

                replication.wait(doc2, function (err2) {
                    test.equal(err2, undefined, 'waitReplication #2 encoutered no error');

                    /* Function generator:
                            Generates steps to be used inside of async.waterfall.
                            Each step is itself a two-step waterfall. Probably confusing. */

                    var make_verify_doc_fn = function (i) {
                        return function (next_fn) {
                            var id = all_created_docs[i].id;
                            async.waterfall([
                                function (nxt) {
                                    db.use('kanso_testsuite_target1').getDoc(
                                        id, {}, function (err, rv) {
                                            test.notEqual(rv, undefined, 'Test document #1 exists');
                                            test.notEqual(rv._rev, undefined, 'Test document #1 has rev');
                                            nxt();
                                        }
                                    );
                                },
                                function (nxt) {
                                    db.use('kanso_testsuite_target2').getDoc(
                                        id, {}, function (err, rv) {
                                            test.notEqual(rv, undefined, 'Test document #2 exists');
                                            test.notEqual(rv._rev, undefined, 'Test document #2 has rev');
                                            nxt();
                                        }
                                    );
                                }
                            ],
                            function () {
                                next_fn();
                            });
                        };
                    };

                    /* Verify 100 previously-crated documents */
                    var verify_fn_list = [];

                    for (var i = 0; i < num_docs; ++i) {
                        verify_fn_list[i] = make_verify_doc_fn(i);
                    }

                    async.waterfall(verify_fn_list, function () {
                        callback(null, doc1, doc2);
                    });
                });
            });
        },
        function (doc1, doc2, callback) {
            replication.stop(
                { _id: doc1.id, _rev: doc1.rev },

                function (err, rv) {
                    if (err) {
                        test.done(err);
                    }
                    test.equal(err, undefined, 'No error stopping replication #1');
                    test.notEqual(rv, undefined, 'stopReplication #1 returns value');
                    test.equal(rv.ok, true, 'stopReplication #1 returns okay');
                    callback(null, doc1, doc2);
                }
            );
        },
        function (doc1, doc2, callback) {
            replication.stop(
                { _id: doc2.id, _rev: doc2.rev },

                function (err, rv) {
                    if (err) {
                        test.done(err);
                    }
                    test.equal(err, undefined, 'No error stopping replication #2');
                    test.notEqual(rv, undefined, 'stopReplication #2 returns value');
                    test.equal(rv.ok, true, 'stopReplication #2 returns okay');
                    callback();
                }
            );
        },
        function (callback) {
            db.deleteDatabase('kanso_testsuite_target2', function (err, rv) {
                if (err) {
                    test.done(err);
                }
                test.equal(err, undefined, 'first deleteDatabase has no error');
                test.notEqual(rv, undefined, 'first deleteDatabase returns a value');
                test.equal(rv.ok, true, 'first deleteDatabase returns okay');
                callback();
            });
        },
        function (callback) {
            db.deleteDatabase('kanso_testsuite_target1', function (err, rv) {
                if (err) {
                    test.done(err);
                }
                test.equal(err, undefined, 'second deleteDatabase has no error');
                test.notEqual(rv, undefined, 'second deleteDatabase returns a value');
                test.equal(rv.ok, true, 'second deleteDatabase returns okay');
                callback();
            });
        }
    ], function () {
        test.done();
    });

};

exports['bulk docs - simple'] = function (test)
{
    test.expect(7);
    var appdb = db.use(duality.getDBURL());
    var max = 1024;

    async.waterfall([
        function (callback) {
            var docs = [];
            for (var i = 0; i < max; ++i) {
                docs.push({
                    offset: i,
                    test: true,
                    type: 'example'
                });
            }
            appdb.bulkSave(docs, { transactional: true }, function (err, rv) {
                test.equal(err, undefined, 'bulkSave has no error');
                test.notEqual(rv, undefined, 'bulkSave returns a value');
                test.equal(rv.length, max, 'bulkSave yields an array');
                callback(null, rv);
            });
        },
        function (ids, callback) {
            var fetch = _.map(ids, function (x) {
                return x.id;
            });
            appdb.bulkGet(fetch, { include_docs: true }, function (err, rv) {
                test.equal(err, undefined, 'bulkGet has no error');
                test.notEqual(rv, undefined, 'bulkGet returns a value');
                test.equal(rv.rows.length, ids.length, 'bulkGet yields an array');
                test.equal(
                    _.inject(rv.rows, function (a, x) {
                        a += x.doc.offset;
                        return a;
                    }, 0),
                    ((max - 1) * max) / 2,
                    "sum of bulkGet's return value is correct"
                );
                callback();
            });
        },
    ], function () {
        test.done();
    });
};

exports['bulk docs - range'] = function (test)
{
    test.expect(6);
    var appdb = db.use(duality.getDBURL());
    var s = 'abcdefghijklmnopqrstuvwxyz';

    async.waterfall([
        function (callback) {
            var docs = [];
            for (var i = 0, len = s.length; i < len; ++i) {
                docs.push({
                    _id: s[i],
                    test: true,
                    type: 'example'
                });
            }
            appdb.bulkSave(docs, function (err, rv) {
                test.equal(err, undefined, 'bulkSave has no error');
                test.notEqual(rv, undefined, 'bulkSave returns a value');
                test.equal(rv.length, s.length, 'bulkSave yields an array');
                callback();
            });
        },
        function (callback) {
            appdb.bulkGet(
                false,
                { startkey: s[10], endkey: s.slice(-1) }, function (err, rv) {
                test.equal(err, undefined, 'bulkGet has no error');
                test.notEqual(rv, undefined, 'bulkGet returns a value');
                test.equal(rv.rows.length, s.length - 10, 'bulkGet yields an array');
                callback();
            });
        }
    ], function () {
        test.done();
    });
};

/*
 * Where do we support useCache?
 *
exports['getDoc - cached'] = function (test)
{
    test.expect(15);
    var appdb = db.use(duality.getDBURL());

    var doc = { data: '1234567890' };
    var get_options = { useCache: true };
    var replacement_data = '0987654321';

    async.waterfall([
        function (callback) {
            appdb.saveDoc(doc, function (err, rv) {
                test.equal(err, undefined, 'saveDoc has no error');
                test.notEqual(rv, undefined, 'New document is defined');
                test.notEqual(rv.id, undefined, 'id for new document is defined');
                callback(null, rv.id);
            });
        },
        function (id, callback) {
            appdb.getDoc(id, get_options, function (err, rv) {
                test.equal(err, undefined, 'getDoc has no error');
                test.notEqual(rv, undefined, 'Document is defined');
                test.notEqual(rv._id, undefined, '_id for document is defined');
                test.equal(rv.data, doc.data, 'Document data is correct');
                callback(null, rv);
            });
        },
        function (rdoc, callback) {
            rdoc.data = replacement_data;
            appdb.saveDoc(rdoc, function (err, rv) {
                test.equal(err, undefined, 'saveDoc has no error');
                callback(null, rv.id);
            });
        },
        function (id, callback) {
            appdb.getDoc(id, get_options, function (err, rv) {
                test.equal(err, undefined, 'getDoc has no error');
                test.notEqual(rv, undefined, 'Document is defined');
                test.equal(rv.data, doc.data, 'Cached document data is correct');
                callback(null, id);
            });
        },
        function (id, callback) {
            get_options.flushCache = true;
            appdb.getDoc(id, get_options, function (err, rv) {
                test.equal(err, undefined, 'getDoc has no error');
                test.notEqual(rv, undefined, 'Document is defined');
                test.notEqual(rv._id, undefined, '_id for document is defined');
                test.equal(rv.data, replacement_data, 'Document data is correct');
                callback();
            });
        }
    ], function () {
        test.done();
    });
};
*/

exports['newUUID - simple'] = function (test)
{
    test.expect(9);
    //db.clear_request_cache();

    async.waterfall([
        function (callback) {
            db.newUUID(2, function (err, uuid) {
                test.equal(err, undefined, 'newUUID has no error');
                test.notEqual(uuid, undefined, 'UUID is defined');
                callback(null, uuid);
            });
        },
        function (prev_uuid, callback) {
            db.newUUID(2, function (err, uuid) {
                test.equal(err, undefined, 'newUUID has no error');
                test.notEqual(uuid, undefined, 'UUID is defined');
                test.notEqual(uuid, prev_uuid, 'UUID is non-repeating');
                callback(null, uuid, prev_uuid);
            });
        },
        function (prev_uuid, prev_prev_uuid, callback) {
            db.newUUID(2, function (err, uuid) {
                test.equal(err, undefined, 'newUUID re-request has no error');
                test.notEqual(uuid, undefined, 'result of re-request is defined');
                test.notEqual(uuid, prev_uuid, 'UUID is non-repeating');
                test.notEqual(uuid, prev_prev_uuid, 'UUID is non-repeating');
                callback();
            });
        }
    ], function () {
        test.done();
    });
};

/*
 * Caching stuff is broken, FIX.
 *
exports['newUUID - cache miss'] = function (test)
{
    var uuids = [];
    var uuid_count = 100;
    var ajax_request_count = 0;

    test.expect(2 * uuid_count + 5);
    //db.clear_request_cache();

    async.waterfall([
        function (callback) {
            $(document).bind('ajaxSend', function () {
                ajax_request_count += 1;
                console.log([ '** req', ajax_request_count ]);
            });
            callback();
        },
        function (callback) {
            var steps = [];
            var make_step = function (i) {
                return function (finished) {
                    db.newUUID(uuid_count, function (err, uuid) {
                        test.equal(err, undefined, 'newUUID has no error');
                        test.notEqual(uuid, undefined, 'UUID is defined');
                        uuids.push(uuid);
                        console.log([ i, uuid ]);
                        finished();
                    });
                }
            };
            for (var i = 0; i < uuid_count; ++i) {
                steps.push(make_step(i));
            }
            async.parallel(steps, function () {
                callback();
            });
        },
        function (callback) {
            test.equal(ajax_request_count, 1, 'Only one request');
            callback();
        },
        function (callback) {
            db.newUUID(uuid_count, function (err, uuid) {
                console.log(uuid);
                test.equal(err, undefined, 're-request has no error');
                test.notEqual(uuid, undefined, 're-request uuid is defined');
                uuids.push(uuid);
                callback();
            });
        },
        function (callback) {
            console.log(ajax_request_count);
            test.equal(
                ajax_request_count, 2,
                    'Cache requests additional uuids when needed'
            );
            test.equal(
                _.uniq(uuids).length, uuids.length,
                    'All document identifiers are unique'
            );
            callback();
        }

    ], function () {
        test.done();
    });
};

exports['newUUID - cache concurrency'] = function (test)
{
    test.expect(5);
    //db.clear_request_cache();

    var ajax_request_count = 0;

    async.waterfall([
        function (callback) {
            $(document).bind('ajaxSend', function () {
                ajax_request_count += 1;
            });
            callback();
        },
        function (callback) {
            async.parallel([
                function (finished) {
                    db.newUUID(2, function (err, uuid) {
                        test.equal(err, undefined, 'newUUID has no error');
                        test.notEqual(uuid, undefined, 'UUID is defined');
                        finished();
                    });
                },
                function (finished) {
                    db.newUUID(2, function (err, uuid) {
                        test.equal(err, undefined, 'newUUID has no error');
                        test.notEqual(uuid, undefined, 'UUID is defined');
                        finished();
                    });
                }
            ], function () {
                callback();
            });
        },
        function (callback) {
            test.equal(ajax_request_count, 1, 'Only one request');
            callback();
        }
    ], function () {
        test.done();
    });
};
*/


text:
package org.hibernate.cfg;

import java.io.Serializable;
import java.util.Map;
import java.util.Properties;

import org.hibernate.ConnectionReleaseMode;
import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.MultiTenancyStrategy;
import org.hibernate.NullPrecedence;
import org.hibernate.cache.internal.NoCachingRegionFactory;
import org.hibernate.cache.internal.RegionFactoryInitiator;
import org.hibernate.cache.internal.StandardQueryCacheFactory;
import org.hibernate.cache.spi.QueryCacheFactory;
import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.transaction.spi.TransactionFactory;
import org.hibernate.hql.spi.MultiTableBulkIdStrategy;
import org.hibernate.hql.spi.PersistentTableBulkIdStrategy;
import org.hibernate.hql.spi.QueryTranslatorFactory;
import org.hibernate.hql.spi.TemporaryTableBulkIdStrategy;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.loader.BatchFetchStyle;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.classloading.spi.ClassLoaderService;
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider;
import org.hibernate.service.jta.platform.spi.JtaPlatform;
import org.hibernate.tuple.entity.EntityTuplizerFactory;
import org.jboss.logging.Logger;

/**
 * Reads configuration properties and builds a {@link Settings} instance.
 *
 * @author Gavin King
 */
public class SettingsFactory implements Serializable {

	private static final long serialVersionUID = -1194386144994524825L;

	private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SettingsFactory.class.getName());

	public static final String DEF_CACHE_REG_FACTORY = NoCachingRegionFactory.class.getName();

	public SettingsFactory() {
	}

	public Settings buildSettings(Properties props, ServiceRegistry serviceRegistry) {
		final boolean debugEnabled =  LOG.isDebugEnabled();
		final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
		Settings settings = new Settings();

		//SessionFactory name:

		String sessionFactoryName = props.getProperty( AvailableSettings.SESSION_FACTORY_NAME );
		settings.setSessionFactoryName( sessionFactoryName );
		settings.setSessionFactoryNameAlsoJndiName(
				ConfigurationHelper.getBoolean( AvailableSettings.SESSION_FACTORY_NAME_IS_JNDI, props, true )
		);

		//JDBC and connection settings:

		//Interrogate JDBC metadata
		ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport();

		settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() );
		settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() );

		//use dialect default properties
		final Properties properties = new Properties();
		properties.putAll( jdbcServices.getDialect().getDefaultProperties() );
		properties.putAll( props );

		// Transaction settings:
		settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) );

		final MultiTableBulkIdStrategy multiTableBulkIdStrategy = getMultiTableBulkIdStrategy(
				properties,
				jdbcServices.getDialect(),
				serviceRegistry.getService( ClassLoaderService.class )
		);
		settings.setMultiTableBulkIdStrategy( multiTableBulkIdStrategy );

		boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(AvailableSettings.FLUSH_BEFORE_COMPLETION, properties);
		if ( debugEnabled ) {
			LOG.debugf( "Automatic flush during beforeCompletion(): %s", enabledDisabled(flushBeforeCompletion) );
		}
		settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion);

		boolean autoCloseSession = ConfigurationHelper.getBoolean(AvailableSettings.AUTO_CLOSE_SESSION, properties);
		if ( debugEnabled ) {
			LOG.debugf( "Automatic session close at end of transaction: %s", enabledDisabled(autoCloseSession) );
		}
		settings.setAutoCloseSessionEnabled(autoCloseSession);

		//JDBC and connection settings:

		int batchSize = ConfigurationHelper.getInt(AvailableSettings.STATEMENT_BATCH_SIZE, properties, 0);
		if ( !meta.supportsBatchUpdates() ) {
			batchSize = 0;
		}
		if ( batchSize > 0 && debugEnabled ) {
			LOG.debugf( "JDBC batch size: %s", batchSize );
		}
		settings.setJdbcBatchSize(batchSize);

		boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(AvailableSettings.BATCH_VERSIONED_DATA, properties, false);
		if ( batchSize > 0 && debugEnabled ) {
			LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled(jdbcBatchVersionedData) );
		}
		settings.setJdbcBatchVersionedData(jdbcBatchVersionedData);

		boolean useScrollableResultSets = ConfigurationHelper.getBoolean(
				AvailableSettings.USE_SCROLLABLE_RESULTSET,
				properties,
				meta.supportsScrollableResults()
		);
		if ( debugEnabled ) {
			LOG.debugf( "Scrollable result sets: %s", enabledDisabled(useScrollableResultSets) );
		}
		settings.setScrollableResultSetsEnabled(useScrollableResultSets);

		boolean wrapResultSets = ConfigurationHelper.getBoolean(AvailableSettings.WRAP_RESULT_SETS, properties, false);
		if ( debugEnabled ) {
			LOG.debugf( "Wrap result sets: %s", enabledDisabled(wrapResultSets) );
		}
		settings.setWrapResultSetsEnabled(wrapResultSets);

		boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(AvailableSettings.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys());
		if ( debugEnabled ) {
			LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled(useGetGeneratedKeys) );
		}
		settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);

		Integer statementFetchSize = ConfigurationHelper.getInteger(AvailableSettings.STATEMENT_FETCH_SIZE, properties);
		if ( statementFetchSize != null && debugEnabled ) {
			LOG.debugf( "JDBC result set fetch size: %s", statementFetchSize );
		}
		settings.setJdbcFetchSize(statementFetchSize);

		MultiTenancyStrategy multiTenancyStrategy = MultiTenancyStrategy.determineMultiTenancyStrategy( properties );
		if ( debugEnabled ) {
			LOG.debugf( "multi-tenancy strategy : %s", multiTenancyStrategy );
		}
		settings.setMultiTenancyStrategy( multiTenancyStrategy );

		String releaseModeName = ConfigurationHelper.getString( AvailableSettings.RELEASE_CONNECTIONS, properties, "auto" );
		if ( debugEnabled ) {
			LOG.debugf( "Connection release mode: %s", releaseModeName );
		}
		ConnectionReleaseMode releaseMode;
		if ( "auto".equals(releaseModeName) ) {
			releaseMode = serviceRegistry.getService( TransactionFactory.class ).getDefaultReleaseMode();
		}
		else {
			releaseMode = ConnectionReleaseMode.parse( releaseModeName );
			if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT ) {
				// we need to make sure the underlying JDBC connection access supports aggressive release...
				boolean supportsAgrressiveRelease = multiTenancyStrategy.requiresMultiTenantConnectionProvider()
						? serviceRegistry.getService( MultiTenantConnectionProvider.class ).supportsAggressiveRelease()
						: serviceRegistry.getService( ConnectionProvider.class ).supportsAggressiveRelease();
				if ( ! supportsAgrressiveRelease ) {
					LOG.unsupportedAfterStatement();
					releaseMode = ConnectionReleaseMode.AFTER_TRANSACTION;
				}
			}
		}
		settings.setConnectionReleaseMode( releaseMode );

		final BatchFetchStyle batchFetchStyle = BatchFetchStyle.interpret( properties.get( AvailableSettings.BATCH_FETCH_STYLE ) );
		LOG.debugf( "Using BatchFetchStyle : " + batchFetchStyle.name() );
		settings.setBatchFetchStyle( batchFetchStyle );

		//SQL Generation settings:

		String defaultSchema = properties.getProperty( AvailableSettings.DEFAULT_SCHEMA );
		String defaultCatalog = properties.getProperty( AvailableSettings.DEFAULT_CATALOG );
		if ( defaultSchema != null && debugEnabled ) {
			LOG.debugf( "Default schema: %s", defaultSchema );
		}
		if ( defaultCatalog != null && debugEnabled ) {
			LOG.debugf( "Default catalog: %s", defaultCatalog );
		}
		settings.setDefaultSchemaName( defaultSchema );
		settings.setDefaultCatalogName( defaultCatalog );

		Integer maxFetchDepth = ConfigurationHelper.getInteger( AvailableSettings.MAX_FETCH_DEPTH, properties );
		if ( maxFetchDepth != null ) {
			LOG.debugf( "Maximum outer join fetch depth: %s", maxFetchDepth );
		}
		settings.setMaximumFetchDepth( maxFetchDepth );

		int batchFetchSize = ConfigurationHelper.getInt(AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, properties, 1);
		if ( debugEnabled ) {
			LOG.debugf( "Default batch fetch size: %s", batchFetchSize );
		}
		settings.setDefaultBatchFetchSize( batchFetchSize );

		boolean comments = ConfigurationHelper.getBoolean( AvailableSettings.USE_SQL_COMMENTS, properties );
		if ( debugEnabled ) {
			LOG.debugf( "Generate SQL with comments: %s", enabledDisabled(comments) );
		}
		settings.setCommentsEnabled( comments );

		boolean orderUpdates = ConfigurationHelper.getBoolean( AvailableSettings.ORDER_UPDATES, properties );
		if ( debugEnabled ) {
			LOG.debugf( "Order SQL updates by primary key: %s", enabledDisabled(orderUpdates) );
		}
		settings.setOrderUpdatesEnabled( orderUpdates );

		boolean orderInserts = ConfigurationHelper.getBoolean(AvailableSettings.ORDER_INSERTS, properties);
		if ( debugEnabled ) {
			LOG.debugf( "Order SQL inserts for batching: %s", enabledDisabled(orderInserts) );
		}
		settings.setOrderInsertsEnabled( orderInserts );

		String defaultNullPrecedence = ConfigurationHelper.getString(
				AvailableSettings.DEFAULT_NULL_ORDERING, properties, "none", "first", "last"
		);
		if ( debugEnabled ) {
			LOG.debugf( "Default null ordering: %s", defaultNullPrecedence );
		}
		settings.setDefaultNullPrecedence( NullPrecedence.parse( defaultNullPrecedence ) );

		//Query parser settings:

		settings.setQueryTranslatorFactory( createQueryTranslatorFactory( properties, serviceRegistry ) );

		Map querySubstitutions = ConfigurationHelper.toMap( AvailableSettings.QUERY_SUBSTITUTIONS, " ,=;:\n\t\r\f", properties );
		if ( debugEnabled ) {
			LOG.debugf( "Query language substitutions: %s", querySubstitutions );
		}
		settings.setQuerySubstitutions( querySubstitutions );

		boolean jpaqlCompliance = ConfigurationHelper.getBoolean( AvailableSettings.JPAQL_STRICT_COMPLIANCE, properties, false );
		if ( debugEnabled ) {
			LOG.debugf( "JPA-QL strict compliance: %s", enabledDisabled(jpaqlCompliance) );
		}
		settings.setStrictJPAQLCompliance( jpaqlCompliance );

		// Second-level / query cache:

		boolean useSecondLevelCache = ConfigurationHelper.getBoolean( AvailableSettings.USE_SECOND_LEVEL_CACHE, properties, true );
		if ( debugEnabled ) {
			LOG.debugf( "Second-level cache: %s", enabledDisabled(useSecondLevelCache) );
		}
		settings.setSecondLevelCacheEnabled( useSecondLevelCache );

		boolean useQueryCache = ConfigurationHelper.getBoolean(AvailableSettings.USE_QUERY_CACHE, properties);
		if ( debugEnabled ) {
			LOG.debugf( "Query cache: %s", enabledDisabled(useQueryCache) );
		}
		settings.setQueryCacheEnabled( useQueryCache );
		if (useQueryCache) {
			settings.setQueryCacheFactory( createQueryCacheFactory( properties, serviceRegistry ) );
		}

		// The cache provider is needed when we either have second-level cache enabled
		// or query cache enabled.  Note that useSecondLevelCache is enabled by default
		settings.setRegionFactory( createRegionFactory( properties, ( useSecondLevelCache || useQueryCache ), serviceRegistry ) );

		boolean useMinimalPuts = ConfigurationHelper.getBoolean(
				AvailableSettings.USE_MINIMAL_PUTS, properties, settings.getRegionFactory().isMinimalPutsEnabledByDefault()
		);
		if ( debugEnabled ) {
			LOG.debugf( "Optimize cache for minimal puts: %s", enabledDisabled(useMinimalPuts) );
		}
		settings.setMinimalPutsEnabled( useMinimalPuts );

		String prefix = properties.getProperty( AvailableSettings.CACHE_REGION_PREFIX );
		if ( StringHelper.isEmpty(prefix) ) {
			prefix=null;
		}
		if ( prefix != null && debugEnabled ) {
			LOG.debugf( "Cache region prefix: %s", prefix );
		}
		settings.setCacheRegionPrefix( prefix );

		boolean useStructuredCacheEntries = ConfigurationHelper.getBoolean( AvailableSettings.USE_STRUCTURED_CACHE, properties, false );
		if ( debugEnabled ) {
			LOG.debugf( "Structured second-level cache entries: %s", enabledDisabled(useStructuredCacheEntries) );
		}
		settings.setStructuredCacheEntriesEnabled( useStructuredCacheEntries );

		boolean useDirectReferenceCacheEntries = ConfigurationHelper.getBoolean(
				AvailableSettings.USE_DIRECT_REFERENCE_CACHE_ENTRIES,
				properties,
				false
		);
		if ( debugEnabled ) {
			LOG.debugf( "Second-level cache direct-reference entries: %s", enabledDisabled(useDirectReferenceCacheEntries) );
		}
		settings.setDirectReferenceCacheEntriesEnabled( useDirectReferenceCacheEntries );

		//Statistics and logging:

		boolean useStatistics = ConfigurationHelper.getBoolean( AvailableSettings.GENERATE_STATISTICS, properties );
		if ( debugEnabled ) {
			LOG.debugf( "Statistics: %s", enabledDisabled(useStatistics) );
		}
		settings.setStatisticsEnabled( useStatistics );

		boolean useIdentifierRollback = ConfigurationHelper.getBoolean( AvailableSettings.USE_IDENTIFIER_ROLLBACK, properties );
		if ( debugEnabled ) {
			LOG.debugf( "Deleted entity synthetic identifier rollback: %s", enabledDisabled(useIdentifierRollback) );
		}
		settings.setIdentifierRollbackEnabled( useIdentifierRollback );

		//Schema export:

		String autoSchemaExport = properties.getProperty( AvailableSettings.HBM2DDL_AUTO );
		if ( "validate".equals(autoSchemaExport) ) {
			settings.setAutoValidateSchema( true );
		}
		else if ( "update".equals(autoSchemaExport) ) {
			settings.setAutoUpdateSchema( true );
		}
		else if ( "create".equals(autoSchemaExport) ) {
			settings.setAutoCreateSchema( true );
		}
		else if ( "create-drop".equals( autoSchemaExport ) ) {
			settings.setAutoCreateSchema( true );
			settings.setAutoDropSchema( true );
		}
		else if ( !StringHelper.isEmpty( autoSchemaExport ) ) {
			LOG.warn( "Unrecognized value for \"hibernate.hbm2ddl.auto\": " + autoSchemaExport );
		}
		settings.setImportFiles( properties.getProperty( AvailableSettings.HBM2DDL_IMPORT_FILES ) );

		EntityMode defaultEntityMode = EntityMode.parse( properties.getProperty( AvailableSettings.DEFAULT_ENTITY_MODE ) );
		if ( debugEnabled ) {
			LOG.debugf( "Default entity-mode: %s", defaultEntityMode );
		}
		settings.setDefaultEntityMode( defaultEntityMode );

		boolean namedQueryChecking = ConfigurationHelper.getBoolean( AvailableSettings.QUERY_STARTUP_CHECKING, properties, true );
		if ( debugEnabled ) {
			LOG.debugf( "Named query checking : %s", enabledDisabled(namedQueryChecking) );
		}
		settings.setNamedQueryStartupCheckingEnabled( namedQueryChecking );

		boolean checkNullability = ConfigurationHelper.getBoolean(AvailableSettings.CHECK_NULLABILITY, properties, true);
		if ( debugEnabled ) {
			LOG.debugf( "Check Nullability in Core (should be disabled when Bean Validation is on): %s", enabledDisabled(checkNullability) );
		}
		settings.setCheckNullability(checkNullability);

		// TODO: Does EntityTuplizerFactory really need to be configurable? revisit for HHH-6383
		settings.setEntityTuplizerFactory( new EntityTuplizerFactory() );

//		String provider = properties.getProperty( AvailableSettings.BYTECODE_PROVIDER );
//		log.info( "Bytecode provider name : " + provider );
//		BytecodeProvider bytecodeProvider = buildBytecodeProvider( provider );
//		settings.setBytecodeProvider( bytecodeProvider );

		boolean initializeLazyStateOutsideTransactionsEnabled = ConfigurationHelper.getBoolean(
				AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS,
				properties,
				false
		);
		if ( debugEnabled ) {
			LOG.debugf( "Allow initialization of lazy state outside session : : %s", enabledDisabled( initializeLazyStateOutsideTransactionsEnabled ) );
		}
		settings.setInitializeLazyStateOutsideTransactions( initializeLazyStateOutsideTransactionsEnabled );

		boolean jtaTrackByThread = ConfigurationHelper.getBoolean(
				AvailableSettings.JTA_TRACK_BY_THREAD,
				properties,
				true
		);
		if ( debugEnabled ) {
			LOG.debugf( "JTA Track by Thread: %s", enabledDisabled(jtaTrackByThread) );
		}
		settings.setJtaTrackByThread( jtaTrackByThread );

		return settings;

	}

	private MultiTableBulkIdStrategy getMultiTableBulkIdStrategy(
			Properties properties,
			Dialect dialect,
			ClassLoaderService classLoaderService) {
		final Object setting = properties.get( AvailableSettings.HQL_BULK_ID_STRATEGY );
		if ( setting != null ) {
			if ( MultiTableBulkIdStrategy.class.isInstance( setting ) ) {
				return (MultiTableBulkIdStrategy) setting;
			}
			final Class strategyClass;
			if ( Class.class.isInstance( setting ) ) {
				strategyClass = (Class) setting;
			}
			else {
				final String settingStr = setting.toString();
				if ( PersistentTableBulkIdStrategy.SHORT_NAME.equals( settingStr ) ) {
					return new PersistentTableBulkIdStrategy();
				}
				else if ( TemporaryTableBulkIdStrategy.SHORT_NAME.equals( settingStr ) ) {
					return TemporaryTableBulkIdStrategy.INSTANCE;
				}
				strategyClass = classLoaderService.classForName( settingStr );
			}
			try {
				return (MultiTableBulkIdStrategy) strategyClass.newInstance();
			}
			catch (Exception e) {
				throw new HibernateException( "Unable to interpret MultiTableBulkIdStrategy setting [" + setting + "]", e );
			}
		}
		else {
			return dialect.supportsTemporaryTables()
					? TemporaryTableBulkIdStrategy.INSTANCE
					: new PersistentTableBulkIdStrategy();
		}
	}

//	protected BytecodeProvider buildBytecodeProvider(String providerName) {
//		if ( "javassist".equals( providerName ) ) {
//			return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl();
//		}
//		else {
//            LOG.debug("Using javassist as bytecode provider by default");
//			return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl();
//		}
//	}

	private static String enabledDisabled(boolean value) {
		return value ? "enabled" : "disabled";
	}

	protected QueryCacheFactory createQueryCacheFactory(Properties properties, ServiceRegistry serviceRegistry) {
		String queryCacheFactoryClassName = ConfigurationHelper.getString(
				AvailableSettings.QUERY_CACHE_FACTORY, properties, StandardQueryCacheFactory.class.getName()
		);
		LOG.debugf( "Query cache factory: %s", queryCacheFactoryClassName );
		try {
			return (QueryCacheFactory) serviceRegistry.getService( ClassLoaderService.class )
					.classForName( queryCacheFactoryClassName )
					.newInstance();
		}
		catch (Exception e) {
			throw new HibernateException( "could not instantiate QueryCacheFactory: " + queryCacheFactoryClassName, e );
		}
	}

	private static RegionFactory createRegionFactory(Properties properties, boolean cachingEnabled, ServiceRegistry serviceRegistry) {
		String regionFactoryClassName = RegionFactoryInitiator.mapLegacyNames(
				ConfigurationHelper.getString(
						AvailableSettings.CACHE_REGION_FACTORY, properties, null
				)
		);
		if ( regionFactoryClassName == null || !cachingEnabled) {
			regionFactoryClassName = DEF_CACHE_REG_FACTORY;
		}
		LOG.debugf( "Cache region factory : %s", regionFactoryClassName );
		try {
			try {
				return (RegionFactory) serviceRegistry.getService( ClassLoaderService.class )
						.classForName( regionFactoryClassName )
						.getConstructor( Properties.class )
						.newInstance( properties );
			}
			catch ( NoSuchMethodException e ) {
				// no constructor accepting Properties found, try no arg constructor
				LOG.debugf(
						"%s did not provide constructor accepting java.util.Properties; attempting no-arg constructor.",
						regionFactoryClassName
				);
				return (RegionFactory) serviceRegistry.getService( ClassLoaderService.class )
						.classForName( regionFactoryClassName )
						.newInstance();
			}
		}
		catch ( Exception e ) {
			throw new HibernateException( "could not instantiate RegionFactory [" + regionFactoryClassName + "]", e );
		}
	}
	//todo remove this once we move to new metamodel
	public static RegionFactory createRegionFactory(Properties properties, boolean cachingEnabled) {
		// todo : REMOVE!  THIS IS TOTALLY A TEMPORARY HACK FOR org.hibernate.cfg.AnnotationBinder which will be going away
		String regionFactoryClassName = RegionFactoryInitiator.mapLegacyNames(
				ConfigurationHelper.getString(
						AvailableSettings.CACHE_REGION_FACTORY, properties, null
				)
		);
		if ( regionFactoryClassName == null ) {
			regionFactoryClassName = DEF_CACHE_REG_FACTORY;
		}
		LOG.debugf( "Cache region factory : %s", regionFactoryClassName );
		try {
			try {
				return (RegionFactory) org.hibernate.internal.util.ReflectHelper.classForName( regionFactoryClassName )
						.getConstructor( Properties.class )
						.newInstance( properties );
			}
			catch ( NoSuchMethodException e ) {
				// no constructor accepting Properties found, try no arg constructor
				LOG.debugf(
						"%s did not provide constructor accepting java.util.Properties; attempting no-arg constructor.",
						regionFactoryClassName
				);
				return (RegionFactory) org.hibernate.internal.util.ReflectHelper.classForName( regionFactoryClassName )
						.newInstance();
			}
		}
		catch ( Exception e ) {
			throw new HibernateException( "could not instantiate RegionFactory [" + regionFactoryClassName + "]", e );
		}
	}

	protected QueryTranslatorFactory createQueryTranslatorFactory(Properties properties, ServiceRegistry serviceRegistry) {
		String className = ConfigurationHelper.getString(
				AvailableSettings.QUERY_TRANSLATOR, properties, "org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory"
		);
		LOG.debugf( "Query translator: %s", className );
		try {
			return (QueryTranslatorFactory) serviceRegistry.getService( ClassLoaderService.class )
					.classForName( className )
					.newInstance();
		}
		catch ( Exception e ) {
			throw new HibernateException( "could not instantiate QueryTranslatorFactory: " + className, e );
		}
	}
}


text:
using System;

namespace Aliyun.OpenServices.Common.Utilities
{
    /// <summary>
    /// The Attribute to mark a field that corresponds a string.
    /// </summary>
    internal sealed class StringValueAttribute : System.Attribute
    {
        public string Value { get; private set; }

        public StringValueAttribute(string value)
        {
            this.Value = value;
        }
    }
}


text:
/**
 * Location Intelligence APIs
 * Incorporate our extensive geodata into everyday applications, business processes and workflows.
 *
 * OpenAPI spec version: 8.5.0
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package pb.locationintelligence.model;

import java.util.Objects;
import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import pb.locationintelligence.model.CrimeBoundary;

/**
 * GeoRiskBoundaries
 */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2020-04-16T15:55:12.092+05:30")
public class GeoRiskBoundaries   {
  @SerializedName("boundary")
  private List<CrimeBoundary> boundary = new ArrayList<CrimeBoundary>();

  public GeoRiskBoundaries boundary(List<CrimeBoundary> boundary) {
    this.boundary = boundary;
    return this;
  }

   /**
   * Get boundary
   * @return boundary
  **/
  @ApiModelProperty(example = "null", value = "")
  public List<CrimeBoundary> getBoundary() {
    return boundary;
  }

  public void setBoundary(List<CrimeBoundary> boundary) {
    this.boundary = boundary;
  }

  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    GeoRiskBoundaries geoRiskBoundaries = (GeoRiskBoundaries) o;
    return Objects.equals(this.boundary, geoRiskBoundaries.boundary);
  }

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

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class GeoRiskBoundaries {\n");

    sb.append("    boundary: ").append(toIndentedString(boundary)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }
}


text:
#include "bash.h"
#include <string.h>
#include <assert.h>

#define VAR2KEY(var) (&(var)->name)
WRB_GENERATE(vars_tree, var, struct detect_str *, link, detect_str_cmp, VAR2KEY);

static const struct {
    struct detect_ctx_desc desc;
    enum bash_parser_tokentype start_tok;
} bash_ctxs[] = {
    // clang-format off
    [BASH_CTX_RCE] = {
        .desc = {.name = {CSTR_LEN("rce")}},
        .start_tok = TOK_START_RCE,
    },
    [BASH_CTX_IN_WORD] = {
        .desc = {.name = {CSTR_LEN("word")}},
        .start_tok = TOK_START_WORD,
    },
};
// clang-format on

static struct detect *
detect_bash_open(struct detect_parser *parser)
{
    struct detect *detect;
    unsigned i;

    detect = malloc(sizeof(*detect));
    detect_instance_init(detect, parser);
    detect->nctx = BASH_CTX_LAST;
    detect->ctxs = malloc(detect->nctx * sizeof(*detect->ctxs));

    for (i = 0; i < detect->nctx; i++) {
        struct bash_detect_ctx *ctx;

        ctx = calloc(1, sizeof(*ctx));
        ctx->base.desc = (struct detect_ctx_desc *)&bash_ctxs[i].desc;
        ctx->base.res = &ctx->res;
        detect_ctx_result_init(ctx->base.res);
        ctx->type = i;
        ctx->ctxnum = i;
        ctx->detect = detect;
        detect->ctxs[i] = (void *)ctx;
    }
    return (detect);
}

static int
detect_bash_close(struct detect *detect)
{
    unsigned i;

    for (i = 0; i < detect->nctx; i++) {
        struct bash_detect_ctx *ctx = (void *)detect->ctxs[i];

        detect_ctx_result_deinit(ctx->base.res);
        if (ctx->pstate != NULL)
            bash_parser_pstate_delete(ctx->pstate);
        free(ctx);
    }
    if (detect->ctxs != NULL)
        free(detect->ctxs);
    free(detect);

    return (0);
}

static void
bash_lexer_init(struct bash_detect_lexer_ctx *lexer)
{
    memset(lexer, 0, sizeof(*lexer));
    detect_re2c_init(&lexer->re2c);
    lexer->state = -1;
    RB_INIT(&lexer->vars);

    struct var *var = calloc(1, sizeof(*var));
    var->name.str = "IFS";
    var->name.len = 3;
    var->val.str = " ";
    var->val.len = 1;
    RB_INSERT(vars_tree, &lexer->vars, var);
}

static void
bash_lexer_deinit(struct bash_detect_lexer_ctx *lexer)
{
    struct detect_parser_info *v, *v_tmp;

    WRB_FOREACH_PDFS (v, vars_tree, &lexer->vars, v_tmp) {
        free(v);
    }

    detect_buf_deinit(&lexer->buf);
    detect_buf_deinit(&lexer->var_name);
    detect_re2c_deinit(&lexer->re2c);
}

void
bash_token_data_destructor(void *token)
{
    struct bash_token_arg_data *data = token;

    if (!!(data->flags & BASH_VALUE_NEEDFREE) && data->value.str != NULL)
        free(data->value.str);
}

static int
detect_bash_push_token(struct bash_detect_ctx *ctx, int tok, void *tok_val)
{
    int rv;

    if (ctx->res.finished)
        return (0);

    rv = bash_parser_push_parse(ctx->pstate, tok, tok_val, ctx);
    if (rv == YYPUSH_MORE)
        rv = 0;
    else {
        ctx->res.finished = true;
        ctx->detect->nctx_finished++;
        /*
         * On parse error, ctx->res.parse_error is already set by
         * bash_parser_error().
         */
        if (ctx->detect->finish_cb != NULL)
            rv = ctx->detect->finish_cb(
                ctx->detect, ctx->ctxnum, ctx->detect->nctx - ctx->detect->nctx_finished,
                ctx->detect->finish_cb_arg);
        else
            rv = 0;
    }
    return (rv);
}

static int
detect_bash_start(struct detect *detect)
{
    unsigned i;

    for (i = 0; i < detect->nctx; i++) {
        struct bash_detect_ctx *ctx = (void *)detect->ctxs[i];

        if (ctx->res.finished)
            continue;
        ctx->pstate = bash_parser_pstate_new();
        ctx->last_read_token = '\n';
        ctx->token_before_that = 0;
        bash_lexer_init(&ctx->lexer);
        if (detect_bash_push_token(ctx, bash_ctxs[ctx->type].start_tok, NULL) != 0)
            break;
    }
    return (0);
}

static int
detect_bash_stop(struct detect *detect)
{
    unsigned i;

    for (i = 0; i < detect->nctx; i++) {
        struct bash_detect_ctx *ctx = (void *)detect->ctxs[i];

        if (ctx->pstate == NULL)
            continue;

        /* We have to finish bison state machine or memleaks will occur*/
        if (!ctx->res.finished)
            detect_bash_push_token(ctx, 0, NULL);

        bash_parser_pstate_delete(ctx->pstate);
        ctx->pstate = NULL;
        bash_lexer_deinit(&ctx->lexer);
        detect_ctx_result_deinit(&ctx->res);
    }
    return (0);
}

static int
bash_lexer_add_data(struct bash_detect_ctx *ctx, const void *data, size_t siz, bool fin)
{
    return (detect_re2c_add_data(&ctx->lexer.re2c, data, siz, fin));
}

static int
detect_bash_add_data(struct detect *detect, const void *data, size_t siz, bool fin)
{
    unsigned i;
    union BASH_PARSER_STYPE token_arg;
    int rv = 0;

    for (i = 0; i < detect->nctx; i++) {
        struct bash_detect_ctx *ctx = (void *)detect->ctxs[i];
        int token;

        if (ctx->res.finished)
            continue;
        bash_lexer_add_data(ctx, data, siz, fin);
        do {
            memset(&token_arg, 0, sizeof(token_arg));
            token = bash_get_token(ctx, &token_arg);

            if (token >= 0) {
                if ((rv = detect_bash_push_token(ctx, token, &token_arg)) != 0)
                    goto done;
            } else if (token != -EAGAIN) {
                /* fatal error */
                rv = -token;
                goto done;
            }
        } while (!ctx->res.finished && token != -EAGAIN);
    }

done:
    return (rv);
}

static int
bash_store_key(struct bash_detect_ctx *ctx, struct bash_token_arg_data *info)
{
    const static struct {
        struct detect_str name;
        uint32_t flag;
    } flagnames[] = {
        {.flag = BASH_KEY_INSTR, .name = {CSTR_LEN("INSTR")}},
    };
    unsigned i;

    for (i = 0; i < sizeof(flagnames) / sizeof(flagnames[0]); i++) {
        if (!(info->flags & flagnames[i].flag))
            continue;
        detect_ctx_result_store_token(&ctx->res, &flagnames[i].name, &info->value);
    }
    bash_token_data_destructor(info);
    return (0);
}

int
bash_store_data(struct bash_detect_ctx *ctx, struct bash_token_arg_data *info)
{
    switch (info->tok) {
    default:
        return (bash_store_key(ctx, info));
    }
}

struct detect_parser detect_parser_bash = {
    .name = {CSTR_LEN("bash")},
    .open = detect_bash_open,
    .close = detect_bash_close,
    .start = detect_bash_start,
    .stop = detect_bash_stop,
    .add_data = detect_bash_add_data,
};


text:
<!DOCTYPE html>

	<title>onSubmit() popup</title>

The Submit button below is will attempt to open a popupwindow. In interactive mode, click the button.

<form onSubmit="openWin();return false;">
	<input type="submit" id="submit">
</form>