text:
using namespace std;
using namespace Tizen::ArtikCloud;

OrderExecutionReport_allOf::OrderExecutionReport_allOf()
{
	//__init();
}

OrderExecutionReport_allOf::~OrderExecutionReport_allOf()
{
	//__cleanup();
}

void
OrderExecutionReport_allOf::__init()
{
	//client_order_id_format_exchange = std::string();
	//exchange_order_id = std::string();
	//amount_open = double(0);
	//amount_filled = double(0);
	//avg_px = double(0);
	//status = new OrdStatus();
	//new std::list()std::list> status_history;
	//error_message = std::string();
	//new std::list()std::list> fills;
}

void
OrderExecutionReport_allOf::__cleanup()
{
	//if(client_order_id_format_exchange != NULL) {
	//
	//delete client_order_id_format_exchange;
	//client_order_id_format_exchange = NULL;
	//}
	//if(exchange_order_id != NULL) {
	//
	//delete exchange_order_id;
	//exchange_order_id = NULL;
	//}
	//if(amount_open != NULL) {
	//
	//delete amount_open;
	//amount_open = NULL;
	//}
	//if(amount_filled != NULL) {
	//
	//delete amount_filled;
	//amount_filled = NULL;
	//}
	//if(avg_px != NULL) {
	//
	//delete avg_px;
	//avg_px = NULL;
	//}
	//if(status != NULL) {
	//
	//delete status;
	//status = NULL;
	//}
	//if(status_history != NULL) {
	//status_history.RemoveAll(true);
	//delete status_history;
	//status_history = NULL;
	//}
	//if(error_message != NULL) {
	//
	//delete error_message;
	//error_message = NULL;
	//}
	//if(fills != NULL) {
	//fills.RemoveAll(true);
	//delete fills;
	//fills = NULL;
	//}
	//
}

void
OrderExecutionReport_allOf::fromJson(char* jsonStr)
{
	JsonObject *pJsonObject = json_node_get_object(json_from_string(jsonStr,NULL));
	JsonNode *node;
	const gchar *client_order_id_format_exchangeKey = "client_order_id_format_exchange";
	node = json_object_get_member(pJsonObject, client_order_id_format_exchangeKey);
	if (node !=NULL) {

		if (isprimitive("std::string")) {
			jsonToValue(&client_order_id_format_exchange, node, "std::string", "");
		} else {

		}
	}
	const gchar *exchange_order_idKey = "exchange_order_id";
	node = json_object_get_member(pJsonObject, exchange_order_idKey);
	if (node !=NULL) {

		if (isprimitive("std::string")) {
			jsonToValue(&exchange_order_id, node, "std::string", "");
		} else {

		}
	}
	const gchar *amount_openKey = "amount_open";
	node = json_object_get_member(pJsonObject, amount_openKey);
	if (node !=NULL) {

		if (isprimitive("long long")) {
			jsonToValue(&amount_open, node, "long long", "");
		} else {

			long long* obj = static_cast<long long*> (&amount_open);
			obj->fromJson(json_to_string(node, false));

		}
	}
	const gchar *amount_filledKey = "amount_filled";
	node = json_object_get_member(pJsonObject, amount_filledKey);
	if (node !=NULL) {

		if (isprimitive("long long")) {
			jsonToValue(&amount_filled, node, "long long", "");
		} else {

			long long* obj = static_cast<long long*> (&amount_filled);
			obj->fromJson(json_to_string(node, false));

		}
	}
	const gchar *avg_pxKey = "avg_px";
	node = json_object_get_member(pJsonObject, avg_pxKey);
	if (node !=NULL) {

		if (isprimitive("long long")) {
			jsonToValue(&avg_px, node, "long long", "");
		} else {

			long long* obj = static_cast<long long*> (&avg_px);
			obj->fromJson(json_to_string(node, false));

		}
	}
	const gchar *statusKey = "status";
	node = json_object_get_member(pJsonObject, statusKey);
	if (node !=NULL) {

		if (isprimitive("OrdStatus")) {
			jsonToValue(&status, node, "OrdStatus", "OrdStatus");
		} else {

			OrdStatus* obj = static_cast<OrdStatus*> (&status);
			obj->fromJson(json_to_string(node, false));

		}
	}
	const gchar *status_historyKey = "status_history";
	node = json_object_get_member(pJsonObject, status_historyKey);
	if (node !=NULL) {

		{
			JsonArray* arr = json_node_get_array(node);
			JsonNode*  temp_json;
			list<std::list> new_list;
			std::list inst;
			for (guint i=0;i<json_array_get_length(arr);i++) {
				temp_json = json_array_get_element(arr,i);
				if (isprimitive("std::list")) {
					jsonToValue(&inst, temp_json, "std::list", "");
				} else {

					inst.fromJson(json_to_string(temp_json, false));

				}
				new_list.push_back(inst);
			}
			status_history = new_list;
		}

	}
	const gchar *error_messageKey = "error_message";
	node = json_object_get_member(pJsonObject, error_messageKey);
	if (node !=NULL) {

		if (isprimitive("std::string")) {
			jsonToValue(&error_message, node, "std::string", "");
		} else {

		}
	}
	const gchar *fillsKey = "fills";
	node = json_object_get_member(pJsonObject, fillsKey);
	if (node !=NULL) {

		{
			JsonArray* arr = json_node_get_array(node);
			JsonNode*  temp_json;
			list<Fills> new_list;
			Fills inst;
			for (guint i=0;i<json_array_get_length(arr);i++) {
				temp_json = json_array_get_element(arr,i);
				if (isprimitive("Fills")) {
					jsonToValue(&inst, temp_json, "Fills", "");
				} else {

					inst.fromJson(json_to_string(temp_json, false));

				}
				new_list.push_back(inst);
			}
			fills = new_list;
		}

	}
}

OrderExecutionReport_allOf::OrderExecutionReport_allOf(char* json)
{
	this->fromJson(json);
}

char*
OrderExecutionReport_allOf::toJson()
{
	JsonObject *pJsonObject = json_object_new();
	JsonNode *node;
	if (isprimitive("std::string")) {
		std::string obj = getClientOrderIdFormatExchange();
		node = converttoJson(&obj, "std::string", "");
	}
	else {

	}
	const gchar *client_order_id_format_exchangeKey = "client_order_id_format_exchange";
	json_object_set_member(pJsonObject, client_order_id_format_exchangeKey, node);
	if (isprimitive("std::string")) {
		std::string obj = getExchangeOrderId();
		node = converttoJson(&obj, "std::string", "");
	}
	else {

	}
	const gchar *exchange_order_idKey = "exchange_order_id";
	json_object_set_member(pJsonObject, exchange_order_idKey, node);
	if (isprimitive("long long")) {
		long long obj = getAmountOpen();
		node = converttoJson(&obj, "long long", "");
	}
	else {

		long long obj = static_cast<long long> (getAmountOpen());
		GError *mygerror;
		mygerror = NULL;
		node = json_from_string(obj.toJson(), &mygerror);

	}
	const gchar *amount_openKey = "amount_open";
	json_object_set_member(pJsonObject, amount_openKey, node);
	if (isprimitive("long long")) {
		long long obj = getAmountFilled();
		node = converttoJson(&obj, "long long", "");
	}
	else {

		long long obj = static_cast<long long> (getAmountFilled());
		GError *mygerror;
		mygerror = NULL;
		node = json_from_string(obj.toJson(), &mygerror);

	}
	const gchar *amount_filledKey = "amount_filled";
	json_object_set_member(pJsonObject, amount_filledKey, node);
	if (isprimitive("long long")) {
		long long obj = getAvgPx();
		node = converttoJson(&obj, "long long", "");
	}
	else {

		long long obj = static_cast<long long> (getAvgPx());
		GError *mygerror;
		mygerror = NULL;
		node = json_from_string(obj.toJson(), &mygerror);

	}
	const gchar *avg_pxKey = "avg_px";
	json_object_set_member(pJsonObject, avg_pxKey, node);
	if (isprimitive("OrdStatus")) {
		OrdStatus obj = getStatus();
		node = converttoJson(&obj, "OrdStatus", "");
	}
	else {

		OrdStatus obj = static_cast<OrdStatus> (getStatus());
		GError *mygerror;
		mygerror = NULL;
		node = json_from_string(obj.toJson(), &mygerror);

	}
	const gchar *statusKey = "status";
	json_object_set_member(pJsonObject, statusKey, node);
	if (isprimitive("std::list")) {
		list<std::list> new_list = static_cast<list <std::list> > (getStatusHistory());
		node = converttoJson(&new_list, "std::list", "array");
	} else {
		node = json_node_alloc();
		list<std::list> new_list = static_cast<list <std::list> > (getStatusHistory());
		JsonArray* json_array = json_array_new();
		GError *mygerror;

		for (list<std::list>::iterator it = new_list.begin(); it != new_list.end(); it++) {
			mygerror = NULL;
			std::list obj = *it;
			JsonNode *node_temp = json_from_string(obj.toJson(), &mygerror);
			json_array_add_element(json_array, node_temp);
			g_clear_error(&mygerror);
		}
		json_node_init_array(node, json_array);
		json_array_unref(json_array);

	}

	const gchar *status_historyKey = "status_history";
	json_object_set_member(pJsonObject, status_historyKey, node);
	if (isprimitive("std::string")) {
		std::string obj = getErrorMessage();
		node = converttoJson(&obj, "std::string", "");
	}
	else {

	}
	const gchar *error_messageKey = "error_message";
	json_object_set_member(pJsonObject, error_messageKey, node);
	if (isprimitive("Fills")) {
		list<Fills> new_list = static_cast<list <Fills> > (getFills());
		node = converttoJson(&new_list, "Fills", "array");
	} else {
		node = json_node_alloc();
		list<Fills> new_list = static_cast<list <Fills> > (getFills());
		JsonArray* json_array = json_array_new();
		GError *mygerror;

		for (list<Fills>::iterator it = new_list.begin(); it != new_list.end(); it++) {
			mygerror = NULL;
			Fills obj = *it;
			JsonNode *node_temp = json_from_string(obj.toJson(), &mygerror);
			json_array_add_element(json_array, node_temp);
			g_clear_error(&mygerror);
		}
		json_node_init_array(node, json_array);
		json_array_unref(json_array);

	}

	const gchar *fillsKey = "fills";
	json_object_set_member(pJsonObject, fillsKey, node);
	node = json_node_alloc();
	json_node_init(node, JSON_NODE_OBJECT);
	json_node_take_object(node, pJsonObject);
	char * ret = json_to_string(node, false);
	json_node_free(node);
	return ret;
}

std::string
OrderExecutionReport_allOf::getClientOrderIdFormatExchange()
{
	return client_order_id_format_exchange;
}

void
OrderExecutionReport_allOf::setClientOrderIdFormatExchange(std::string  client_order_id_format_exchange)
{
	this->client_order_id_format_exchange = client_order_id_format_exchange;
}

std::string
OrderExecutionReport_allOf::getExchangeOrderId()
{
	return exchange_order_id;
}

void
OrderExecutionReport_allOf::setExchangeOrderId(std::string  exchange_order_id)
{
	this->exchange_order_id = exchange_order_id;
}

long long
OrderExecutionReport_allOf::getAmountOpen()
{
	return amount_open;
}

void
OrderExecutionReport_allOf::setAmountOpen(long long  amount_open)
{
	this->amount_open = amount_open;
}

long long
OrderExecutionReport_allOf::getAmountFilled()
{
	return amount_filled;
}

void
OrderExecutionReport_allOf::setAmountFilled(long long  amount_filled)
{
	this->amount_filled = amount_filled;
}

long long
OrderExecutionReport_allOf::getAvgPx()
{
	return avg_px;
}

void
OrderExecutionReport_allOf::setAvgPx(long long  avg_px)
{
	this->avg_px = avg_px;
}

OrdStatus
OrderExecutionReport_allOf::getStatus()
{
	return status;
}

void
OrderExecutionReport_allOf::setStatus(OrdStatus  status)
{
	this->status = status;
}

std::list<std::list>
OrderExecutionReport_allOf::getStatusHistory()
{
	return status_history;
}

void
OrderExecutionReport_allOf::setStatusHistory(std::list <std::list> status_history)
{
	this->status_history = status_history;
}

std::string
OrderExecutionReport_allOf::getErrorMessage()
{
	return error_message;
}

void
OrderExecutionReport_allOf::setErrorMessage(std::string  error_message)
{
	this->error_message = error_message;
}

std::list<Fills>
OrderExecutionReport_allOf::getFills()
{
	return fills;
}

void
OrderExecutionReport_allOf::setFills(std::list <Fills> fills)
{
	this->fills = fills;
}


text:
namespace DeviceHive.Data.EF.Migrations
{
    using System.Data.Entity.Migrations;

    public partial class _5 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "Network",
                c => new
                {
                    ID = c.Int(nullable: false, identity: true),
                    Name = c.String(nullable: false, maxLength: 128),
                    Description = c.String(maxLength: 128),
                })
                .PrimaryKey(t => t.ID)
                .Index(t => t.Name, unique: true);

            CreateTable(
                "EquipmentType",
                c => new
                {
                    ID = c.Int(nullable: false, identity: true),
                    Name = c.String(nullable: false, maxLength: 128),
                    Capabilities = c.String(),
                })
                .PrimaryKey(t => t.ID)
                .Index(t => t.Name, unique: true);

            CreateTable(
                "DeviceClass",
                c => new
                {
                    ID = c.Int(nullable: false, identity: true),
                    Name = c.String(nullable: false, maxLength: 128),
                    Version = c.String(maxLength: 32),
                })
                .PrimaryKey(t => t.ID)
                .Index(t => t.Name);

            CreateTable(
                "Equipment",
                c => new
                {
                    ID = c.Int(nullable: false, identity: true),
                    Name = c.String(nullable: false, maxLength: 128),
                    Code = c.String(nullable: false, maxLength: 128),
                    DeviceClassID = c.Int(nullable: false),
                    EquipmentTypeID = c.Int(nullable: false),
                })
                .PrimaryKey(t => t.ID)
                .ForeignKey("DeviceClass", t => t.DeviceClassID, cascadeDelete: true)
                .ForeignKey("EquipmentType", t => t.EquipmentTypeID)
                .Index(t => t.DeviceClassID)
                .Index(t => t.EquipmentTypeID);

            CreateTable(
                "Device",
                c => new
                {
                    ID = c.Int(nullable: false, identity: true),
                    GUID = c.Guid(nullable: false),
                    Name = c.String(nullable: false, maxLength: 128),
                    Status = c.String(maxLength: 128),
                    NetworkID = c.Int(nullable: false),
                    DeviceClassID = c.Int(nullable: false),
                })
                .PrimaryKey(t => t.ID)
                .ForeignKey("Network", t => t.NetworkID, cascadeDelete: true)
                .ForeignKey("DeviceClass", t => t.DeviceClassID, cascadeDelete: true)
                .Index(t => t.NetworkID)
                .Index(t => t.DeviceClassID)
                .Index(t => t.GUID, unique: true);

            CreateTable(
                "DeviceNotification",
                c => new
                {
                    ID = c.Int(nullable: false, identity: true),
                    Timestamp = c.DateTime(nullable: false, storeType: "datetime2"),
                    Notification = c.String(nullable: false, maxLength: 128),
                    Parameters = c.String(),
                    DeviceID = c.Int(nullable: false),
                })
                .PrimaryKey(t => t.ID)
                .ForeignKey("Device", t => t.DeviceID, cascadeDelete: true)
                .Index(t => new { t.DeviceID, t.Timestamp });

            CreateTable(
                "DeviceCommand",
                c => new
                {
                    ID = c.Int(nullable: false, identity: true),
                    Timestamp = c.DateTime(nullable: false, storeType: "datetime2"),
                    Command = c.String(nullable: false, maxLength: 128),
                    Parameters = c.String(),
                    Lifetime = c.Int(),
                    Flags = c.Int(),
                    Status = c.String(maxLength: 128),
                    Result = c.String(maxLength: 1024),
                    DeviceID = c.Int(nullable: false),
                })
                .PrimaryKey(t => t.ID)
                .ForeignKey("Device", t => t.DeviceID, cascadeDelete: true)
                .Index(t => new { t.DeviceID, t.Timestamp });

            CreateTable(
                "DeviceEquipment",
                c => new
                {
                    ID = c.Int(nullable: false, identity: true),
                    Code = c.String(nullable: false, maxLength: 128),
                    Timestamp = c.DateTime(nullable: false, storeType: "datetime2"),
                    Parameters = c.String(),
                    DeviceID = c.Int(nullable: false),
                })
                .PrimaryKey(t => t.ID)
                .ForeignKey("Device", t => t.DeviceID, cascadeDelete: true)
                .Index(t => new { t.DeviceID, t.Code }, unique: true);
        }

        public override void Down()
        {
            DropTable("Network");
            DropTable("EquipmentType");
            DropTable("DeviceClass");
            DropIndex("Equipment", new[] { "EquipmentTypeID" });
            DropIndex("Equipment", new[] { "DeviceClassID" });
            DropForeignKey("Equipment", "EquipmentTypeID", "EquipmentType");
            DropForeignKey("Equipment", "DeviceClassID", "DeviceClass");
            DropTable("Equipment");
            DropIndex("Device", new[] { "GUID" });
            DropIndex("Device", new[] { "DeviceClassID" });
            DropIndex("Device", new[] { "NetworkID" });
            DropForeignKey("Device", "DeviceClassID", "DeviceClass");
            DropForeignKey("Device", "NetworkID", "Network");
            DropTable("Device");
            DropIndex("DeviceNotification", new[] { "DeviceID", "Timestamp" });
            DropForeignKey("DeviceNotification", "DeviceID", "Device");
            DropTable("DeviceNotification");
            DropIndex("DeviceCommand", new[] { "DeviceID", "Timestamp" });
            DropForeignKey("DeviceCommand", "DeviceID", "Device");
            DropTable("DeviceCommand");
            DropIndex("DeviceEquipment", new[] { "DeviceID", "Code" });
            DropForeignKey("DeviceEquipment", "DeviceID", "Device");
            DropTable("DeviceEquipment");
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.hazelcast.client.impl.protocol.codec;

import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.impl.protocol.Generated;
import com.hazelcast.client.impl.protocol.codec.builtin.*;
import com.hazelcast.client.impl.protocol.codec.custom.*;

import javax.annotation.Nullable;

import static com.hazelcast.client.impl.protocol.ClientMessage.*;
import static com.hazelcast.client.impl.protocol.codec.builtin.FixedSizeTypesCodec.*;

/*
 * This file is auto-generated by the Hazelcast Client Protocol Code Generator.
 * To change this file, edit the templates or the protocol
 * definitions on the https://github.com/hazelcast/hazelcast-client-protocol
 * and regenerate it.
 */

/**
 * Fetches specified number of entries from the specified partition starting from specified table index.
 */
@Generated("60e0124c17f73786d6148f9112a6cf44")
public final class CacheIterateEntriesCodec {
    //hex: 0x131C00
    public static final int REQUEST_MESSAGE_TYPE = 1252352;
    //hex: 0x131C01
    public static final int RESPONSE_MESSAGE_TYPE = 1252353;
    private static final int REQUEST_BATCH_FIELD_OFFSET = PARTITION_ID_FIELD_OFFSET + INT_SIZE_IN_BYTES;
    private static final int REQUEST_INITIAL_FRAME_SIZE = REQUEST_BATCH_FIELD_OFFSET + INT_SIZE_IN_BYTES;
    private static final int RESPONSE_INITIAL_FRAME_SIZE = RESPONSE_BACKUP_ACKS_FIELD_OFFSET + BYTE_SIZE_IN_BYTES;

    private CacheIterateEntriesCodec() {
    }

    @edu.umd.cs.findbugs.annotations.SuppressFBWarnings({"URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"})
    public static class RequestParameters {

        /**
         * Name of the cache.
         */
        public java.lang.String name;

        /**
         * The index-size pairs that define the state of iteration
         */
        public java.util.List<java.util.Map.Entry<java.lang.Integer, java.lang.Integer>> iterationPointers;

        /**
         * The number of items to be batched
         */
        public int batch;
    }

    public static ClientMessage encodeRequest(java.lang.String name, java.util.Collection<java.util.Map.Entry<java.lang.Integer, java.lang.Integer>> iterationPointers, int batch) {
        ClientMessage clientMessage = ClientMessage.createForEncode();
        clientMessage.setRetryable(true);
        clientMessage.setOperationName("Cache.IterateEntries");
        ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);
        encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE);
        encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);
        encodeInt(initialFrame.content, REQUEST_BATCH_FIELD_OFFSET, batch);
        clientMessage.add(initialFrame);
        StringCodec.encode(clientMessage, name);
        EntryListIntegerIntegerCodec.encode(clientMessage, iterationPointers);
        return clientMessage;
    }

    public static CacheIterateEntriesCodec.RequestParameters decodeRequest(ClientMessage clientMessage) {
        ClientMessage.ForwardFrameIterator iterator = clientMessage.frameIterator();
        RequestParameters request = new RequestParameters();
        ClientMessage.Frame initialFrame = iterator.next();
        request.batch = decodeInt(initialFrame.content, REQUEST_BATCH_FIELD_OFFSET);
        request.name = StringCodec.decode(iterator);
        request.iterationPointers = EntryListIntegerIntegerCodec.decode(iterator);
        return request;
    }

    @edu.umd.cs.findbugs.annotations.SuppressFBWarnings({"URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"})
    public static class ResponseParameters {

        /**
         * The index-size pairs that define the state of iteration
         */
        public java.util.List<java.util.Map.Entry<java.lang.Integer, java.lang.Integer>> iterationPointers;

        /**
         * The entries fetched from the cache.
         */
        public java.util.List<java.util.Map.Entry<com.hazelcast.internal.serialization.Data, com.hazelcast.internal.serialization.Data>> entries;
    }

    public static ClientMessage encodeResponse(java.util.Collection<java.util.Map.Entry<java.lang.Integer, java.lang.Integer>> iterationPointers, java.util.Collection<java.util.Map.Entry<com.hazelcast.internal.serialization.Data, com.hazelcast.internal.serialization.Data>> entries) {
        ClientMessage clientMessage = ClientMessage.createForEncode();
        ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[RESPONSE_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);
        encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, RESPONSE_MESSAGE_TYPE);
        clientMessage.add(initialFrame);

        EntryListIntegerIntegerCodec.encode(clientMessage, iterationPointers);
        EntryListCodec.encode(clientMessage, entries, DataCodec::encode, DataCodec::encode);
        return clientMessage;
    }

    public static CacheIterateEntriesCodec.ResponseParameters decodeResponse(ClientMessage clientMessage) {
        ClientMessage.ForwardFrameIterator iterator = clientMessage.frameIterator();
        ResponseParameters response = new ResponseParameters();
        //empty initial frame
        iterator.next();
        response.iterationPointers = EntryListIntegerIntegerCodec.decode(iterator);
        response.entries = EntryListCodec.decode(iterator, DataCodec::decode, DataCodec::decode);
        return response;
    }

}


text:
package echowand.info;

import echowand.common.ClassEOJ;
import echowand.common.EPC;
import echowand.common.PropertyMap;
import echowand.util.Constraint;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.TreeSet;
import java.util.logging.Logger;

/**
 * ECHONETオブジェクト基本設定構築用クラス
 * @author Yoshiki Makino
 */
public class BasicObjectInfo implements ObjectInfo {
    private static final Logger logger = Logger.getLogger(DeviceObjectInfo.class.getName());
    private static final String className = DeviceObjectInfo.class.getName();

    private static class PropertyInfoComparator implements Comparator<PropertyInfo>, Serializable {
        @Override
        public int compare(PropertyInfo p1, PropertyInfo p2) {
            int c1 = (p1.epc.toByte() & 0x000000ff);
            int c2 = (p2.epc.toByte() & 0x000000ff);
            return c1 - c2;
        }
    }

    private ClassEOJ classEOJ;
    private TreeSet<PropertyInfo> props = new TreeSet<PropertyInfo>(new BasicObjectInfo.PropertyInfoComparator());
    private ArrayList<PropertyInfo> propList = null;
    private boolean needsUpdatePropertyMap = true;

    private synchronized void updatePropertyMapsInNeeds() {
        logger.entering(className, "updatePropertyMapsInNeeds");

        if (!needsUpdatePropertyMap) {
            logger.exiting(className, "updatePropertyMapsInNeeds");
            return;
        }

        needsUpdatePropertyMap = false;

        PropertyMap annoMap = new PropertyMap();
        PropertyMap setMap = new PropertyMap();
        PropertyMap getMap = new PropertyMap();
        int count = size();
        for (int i = 0; i < count; i++) {
            PropertyInfo info = getAtIndex(i);
            if (info.gettable) {
                getMap.set(info.epc);
            }
            if (info.settable) {
                setMap.set(info.epc);
            }
            if (info.observable) {
                annoMap.set(info.epc);
            }
        }

        PropertyInfo annoInfo = get(EPC.x9D);
        addWithoutUpdating(annoInfo.epc, annoInfo.gettable, annoInfo.settable, annoInfo.observable, annoMap.toBytes());
        PropertyInfo setInfo = get(EPC.x9E);
        addWithoutUpdating(setInfo.epc, setInfo.gettable, setInfo.settable, setInfo.observable, setMap.toBytes());
        PropertyInfo getInfo = get(EPC.x9F);
        addWithoutUpdating(getInfo.epc, getInfo.gettable, getInfo.settable, getInfo.observable, getMap.toBytes());

        makePropListOutdated();

        logger.exiting(className, "updatePropertyMapsInNeeds");
    }

    private synchronized void makeUpdatePropertyMapNeeded() {
        logger.entering(className, "makeUpdatePropertyMapNeeded");

        needsUpdatePropertyMap = true;

        logger.exiting(className, "makeUpdatePropertyMapNeeded");
    }

    /**
     * このBasicObjectInfoが表現しているECHONETオブジェクトのClassEOJを返す。
     * @return このBasicObjectInfoのClassEOJ
     */
    @Override
    public ClassEOJ getClassEOJ() {
        return classEOJ;
    }

    /**
     * このBasicObjectInfoが表現しているECHONETオブジェクトのClassEOJを設定する。
     * @param ceoj このBasicObjectInfoが表現するECHONETオブジェクトのClassEOJ
     */
    public final void setClassEOJ(ClassEOJ ceoj) {
        logger.entering(className, "setClassEOJ", ceoj);

        classEOJ = ceoj;

        logger.exiting(className, "setClassEOJ");
    }

    /**
     * このBasicObjectInfoが表現するECHONETオブジェクトにプロパティを追加する。
     * @param epc 追加するプロパティのEPC
     * @param gettable Setの可否
     * @param settable Getの可否
     * @param observable 通知の有無
     * @param size プロパティのデータサイズ
     * @return 追加が成功した場合にはtrue、失敗した場合にはfalse
     */
    public final boolean add(EPC epc, boolean gettable, boolean settable, boolean observable, int size) {
        return add(new PropertyInfo(epc, gettable, settable, observable, size));
    }

    /**
     * このBasicObjectInfoが表現するECHONETオブジェクトにプロパティを追加する。
     * @param epc 追加するプロパティのEPC
     * @param gettable Setの可否
     * @param settable Getの可否
     * @param observable 通知の有無
     * @param size プロパティのデータサイズ
     * @param constraint プロパティの制約
     * @return 追加が成功した場合にはtrue、失敗した場合にはfalse
     */
    public final boolean add(EPC epc, boolean gettable, boolean settable, boolean observable, int size, Constraint constraint) {
        return add(new PropertyInfo(epc, gettable, settable, observable, size, constraint));
    }

    /**
     * このBasicObjectInfoが表現するECHONETオブジェクトにプロパティを追加する。
     * @param epc 追加するプロパティのEPC
     * @param gettable Setの可否
     * @param settable Getの可否
     * @param observable 通知の有無
     * @param data プロパティのデータ
     * @return 追加が成功した場合にはtrue、失敗した場合にはfalse
     */
    public final boolean add(EPC epc, boolean gettable, boolean settable, boolean observable, byte[] data) {
        return add(new PropertyInfo(epc, gettable, settable, observable, data));
    }

    /**
     * このBasicObjectInfoが表現するECHONETオブジェクトにプロパティを追加する。
     * @param epc 追加するプロパティのEPC
     * @param gettable Setの可否
     * @param settable Getの可否
     * @param observable 通知の有無
     * @param constraint プロパティの制約
     * @param data プロパティのデータ
     * @return 追加が成功した場合にはtrue、失敗した場合にはfalse
     */
    public final boolean add(EPC epc, boolean gettable, boolean settable, boolean observable, byte[] data, Constraint constraint) {
        return add(new PropertyInfo(epc, gettable, settable, observable, data, constraint));
    }

    /**
     * このBasicObjectInfoが表現するECHONETオブジェクトにプロパティを追加する。
     * @param prop 追加するプロパティ
     * @return 追加が成功した場合にはtrue、失敗した場合にはfalse
     */
    public final boolean add(PropertyInfo prop) {
        logger.entering(className, "add", prop);

        boolean status = addWithoutUpdating(prop);
        makeUpdatePropertyMapNeeded();
        makePropListOutdated();

        logger.exiting(className, "add", status);
        return status;
    }

    /**
     * このBasicObjectInfoが表現するECHONETオブジェクトからプロパティを削除する。
     * @param epc 削除するプロパティのEPC
     * @return 削除が成功した場合にはtrue、失敗した場合にはfalse
     */
    public final boolean remove(EPC epc) {
        logger.entering(className, "remove", epc);

        boolean status = props.remove(get(epc));
        makeUpdatePropertyMapNeeded();
        makePropListOutdated();

        logger.exiting(className, "remove", status);
        return status;
    }

    private boolean addWithoutUpdating(EPC epc, boolean gettable, boolean settable, boolean observable, byte[] data) {
        return addWithoutUpdating(new PropertyInfo(epc, gettable, settable, observable, data));
    }

    private boolean addWithoutUpdating(PropertyInfo prop) {
        logger.entering(className, "addWithoutUpdating", prop);

        props.remove(prop);
        boolean status = props.add(prop);

        logger.exiting(className, "addWithoutUpdating", status);
        return status;
    }

    private void makePropListOutdated() {
        logger.entering(className, "makePropListOutdated");

        propList = null;

        logger.exiting(className, "makePropListOutdated");
    }

    /**
     * このBasicObjectInfoが表現するECHONETオブジェクトのプロパティのリストを返す。
     * @return プロパティのリスト
     */
    private ArrayList<PropertyInfo> getPropList() {
        logger.entering(className, "getPropList");

        if (propList == null) {
            propList = new ArrayList<PropertyInfo>(props);
        }

        logger.exiting(className, "getPropList", propList);
        return propList;
    }

    /**
     * このBasicObjectInfoが表現するECHONETオブジェクトのindex番目のプロパティを返す。
     * @param index プロパティのインデックス
     * @return index番目のプロパティ
     */
    @Override
    public PropertyInfo getAtIndex(int index) {
        logger.entering(className, "getAtIndex", index);

        updatePropertyMapsInNeeds();
        PropertyInfo propertyInfo = getPropList().get(index);

        logger.exiting(className, "getAtIndex", propertyInfo);
        return propertyInfo;
    }

    /**
     * このBasicObjectInfoが表現するECHONETオブジェクトの指定されたEPCに対応するプロパティを返す。
     * @param epc プロパティのEPC
     * @return 指定されたEPCに対応するプロパティ
     */
    @Override
    public PropertyInfo get(EPC epc) {
        logger.entering(className, "get", epc);

        updatePropertyMapsInNeeds();
        for (PropertyInfo prop : getPropList()) {
            if (prop.epc == epc) {
                logger.exiting(className, "get", prop);
                return prop;
            }
        }

        PropertyInfo propertyInfo = new PropertyInfo(epc, false, false, false, 0);
        logger.exiting(className, "get", propertyInfo);
        return propertyInfo;
    }

    /**
     * このBasicObjectInfoが表現するECHONETオブジェクトの全プロパティ設定数を返す。
     * @return 全プロパティ設定数
     */
    @Override
    public final int size() {
        return getPropList().size();
    }
}


text:
INSERT INTO KRIM_ROLE_T (ROLE_ID, OBJ_ID, VER_NBR, ROLE_NM, NMSPC_CD, DESC_TXT, KIM_TYP_ID, ACTV_IND, LAST_UPDT_DT)
VALUES (KRIM_ROLE_ID_BS_S.NEXTVAL, SYS_GUID(), 1, 'COI Approver', 'KC-COIDISCLOSURE', 'Role similar to COI Reviewer with some added limited admin functionality',
		(SELECT KIM_TYP_ID FROM KRIM_TYP_T WHERE NM = 'UnitHierarchy'), 'Y', SYSDATE)
/

INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, ROLE_ID, PERM_ID, ACTV_IND, OBJ_ID, VER_NBR)
    VALUES (KRIM_ROLE_PERM_ID_BS_S.NEXTVAL, KRIM_ROLE_ID_BS_S.CURRVAL, (SELECT PERM_ID FROM KRIM_PERM_T WHERE NM = 'Maintain Coi Disclosure Notes'), 'Y', SYS_GUID(), 1)
/

INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, ROLE_ID, PERM_ID, ACTV_IND, OBJ_ID, VER_NBR)
    VALUES (KRIM_ROLE_PERM_ID_BS_S.NEXTVAL, KRIM_ROLE_ID_BS_S.CURRVAL, (SELECT PERM_ID FROM KRIM_PERM_T WHERE NM = 'Maintain Coi Disclosure Attachments'), 'Y', SYS_GUID(), 1)
/

INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, ROLE_ID, PERM_ID, ACTV_IND, OBJ_ID, VER_NBR)
    VALUES (KRIM_ROLE_PERM_ID_BS_S.NEXTVAL, KRIM_ROLE_ID_BS_S.CURRVAL, (SELECT PERM_ID FROM KRIM_PERM_T WHERE NM = 'View Coi Disclosure Notes'), 'Y', SYS_GUID(), 1)
/

INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, ROLE_ID, PERM_ID, ACTV_IND, OBJ_ID, VER_NBR)
    VALUES (KRIM_ROLE_PERM_ID_BS_S.NEXTVAL, KRIM_ROLE_ID_BS_S.CURRVAL, (SELECT PERM_ID FROM KRIM_PERM_T WHERE NM = 'View Coi Disclosure Attachments'), 'Y', SYS_GUID(), 1)
/

INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, ROLE_ID, PERM_ID, ACTV_IND, OBJ_ID, VER_NBR)
    VALUES (KRIM_ROLE_PERM_ID_BS_S.NEXTVAL, KRIM_ROLE_ID_BS_S.CURRVAL, (SELECT PERM_ID FROM KRIM_PERM_T WHERE NM = 'View Coi Disclosure'), 'Y', SYS_GUID(), 1)
/

INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, ROLE_ID, PERM_ID, ACTV_IND, OBJ_ID, VER_NBR)
    VALUES (KRIM_ROLE_PERM_ID_BS_S.NEXTVAL, KRIM_ROLE_ID_BS_S.CURRVAL, (SELECT PERM_ID FROM KRIM_PERM_T WHERE NM = 'Coi Viewer'), 'Y', SYS_GUID(), 1)
/

INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, ROLE_ID, PERM_ID, ACTV_IND, OBJ_ID, VER_NBR)
    VALUES (KRIM_ROLE_PERM_ID_BS_S.NEXTVAL, KRIM_ROLE_ID_BS_S.CURRVAL, (SELECT PERM_ID FROM KRIM_PERM_T WHERE NM = 'Maintain Coi Reviewers'), 'Y', SYS_GUID(), 1)
/

INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, ROLE_ID, PERM_ID, ACTV_IND, OBJ_ID, VER_NBR)
    VALUES (KRIM_ROLE_PERM_ID_BS_S.NEXTVAL, KRIM_ROLE_ID_BS_S.CURRVAL, (SELECT PERM_ID FROM KRIM_PERM_T WHERE NM = 'Approve Coi Disclosure'), 'Y', SYS_GUID(), 1)
/

INSERT INTO KRIM_ROLE_PERM_T (ROLE_PERM_ID, ROLE_ID, PERM_ID, ACTV_IND, OBJ_ID, VER_NBR)
    VALUES (KRIM_ROLE_PERM_ID_BS_S.NEXTVAL, KRIM_ROLE_ID_BS_S.CURRVAL, (SELECT PERM_ID FROM KRIM_PERM_T WHERE NM = 'Perform Coi Disclosure Actions'), 'Y', SYS_GUID(), 1)
/

-- Map the Coi Approver role to the CoiReview responsibility
INSERT INTO KRIM_ROLE_RSP_T (ROLE_RSP_ID, OBJ_ID, VER_NBR, ROLE_ID, RSP_ID, ACTV_IND)
	VALUES (KRIM_ROLE_RSP_ID_BS_S.NEXTVAL, SYS_GUID(), '1', KRIM_ROLE_ID_BS_S.CURRVAL , (SELECT RSP_ID FROM KRIM_RSP_T WHERE NM = 'COIReview'), 'Y')
/

-- Insert action for the above role-responsibility mapping
INSERT INTO KRIM_ROLE_RSP_ACTN_T (ROLE_RSP_ACTN_ID, OBJ_ID, VER_NBR, ACTN_TYP_CD, PRIORITY_NBR, ACTN_PLCY_CD, ROLE_MBR_ID, ROLE_RSP_ID, FRC_ACTN)
	VALUES (KRIM_ROLE_RSP_ACTN_ID_BS_S.NEXTVAL, sys_guid(), '1', 'A', '1', 'F', '*', KRIM_ROLE_RSP_ID_BS_S.CURRVAL, 'Y')
/

-- delete the approve action mapped to the coi admin and coi review role-resp mapping
DELETE FROM KRIM_ROLE_RSP_ACTN_T
	WHERE ROLE_RSP_ID =
		(SELECT ROLE_RSP_ID FROM KRIM_ROLE_RSP_T
			WHERE RSP_ID =
				(SELECT RSP_ID FROM KRIM_RSP_T WHERE NM = 'COIReview' AND NMSPC_CD ='KC-WKFLW')
	 		AND ROLE_ID =
	 			(SELECT ROLE_ID FROM KRIM_ROLE_T WHERE ROLE_NM = 'COI Administrator'))
	AND ACTN_TYP_CD = 'A'
/

-- delete the coi admin and coi review role-resp mapping
DELETE FROM KRIM_ROLE_RSP_T
	WHERE RSP_ID =
		(SELECT RSP_ID FROM KRIM_RSP_T WHERE NM = 'COIReview' AND NMSPC_CD ='KC-WKFLW')
	AND ROLE_ID =
		(SELECT ROLE_ID FROM KRIM_ROLE_T WHERE ROLE_NM = 'COI Administrator')
/

-- make the coi admin a member of the coi approver role, so it will transitively regain the coi review responsibility (and its approve action) removed above
-- we need to do this because KEW seems to require approve action from each seperate role mapped to a route node's responsibility (AND semantics across roles)
-- since we want the OR semantics across all roles, so deploying only a single approver role directly mapped to the approve responsibility (with an action policy of "F")
-- other roles that need to be allowed to see (and act on) this approve action request can simply become members of this approver role.

INSERT INTO KRIM_ROLE_MBR_T (ROLE_MBR_ID, ROLE_ID, MBR_ID, MBR_TYP_CD, LAST_UPDT_DT, OBJ_ID, VER_NBR)
    VALUES (KRIM_ROLE_MBR_ID_BS_S.NEXTVAL, KRIM_ROLE_ID_BS_S.CURRVAL, (SELECT ROLE_ID FROM KRIM_ROLE_T WHERE ROLE_NM = 'COI Administrator'), 'R', SYSDATE, SYS_GUID(), 1)
/

INSERT INTO KRIM_ROLE_MBR_ATTR_DATA_T (ATTR_DATA_ID, ROLE_MBR_ID, KIM_TYP_ID, KIM_ATTR_DEFN_ID, ATTR_VAL, OBJ_ID,VER_NBR)
    VALUES (KRIM_ATTR_DATA_ID_BS_S.NEXTVAL, KRIM_ROLE_MBR_ID_BS_S.CURRVAL, (SELECT KIM_TYP_ID FROM KRIM_TYP_T WHERE NM = 'UnitHierarchy'), (SELECT KIM_ATTR_DEFN_ID FROM KRIM_ATTR_DEFN_T WHERE NM = 'unitNumber'), '000001', SYS_GUID(), 1)
/

INSERT INTO KRIM_ROLE_MBR_ATTR_DATA_T (ATTR_DATA_ID, ROLE_MBR_ID, KIM_TYP_ID, KIM_ATTR_DEFN_ID, ATTR_VAL, OBJ_ID, VER_NBR)
    VALUES (KRIM_ATTR_DATA_ID_BS_S.NEXTVAL, KRIM_ROLE_MBR_ID_BS_S.CURRVAL, (SELECT KIM_TYP_ID FROM KRIM_TYP_T WHERE NM = 'UnitHierarchy'), (SELECT KIM_ATTR_DEFN_ID FROM KRIM_ATTR_DEFN_T WHERE NM = 'subunits'), 'Y', SYS_GUID(), 1)
/


text:
class AdColonyListenerLua : public sdkbox::AdColonyListener {
public:
	AdColonyListenerLua(): mLuaHandler(0) {

	}
	~AdColonyListenerLua() {
		resetHandler();
	}

	void setHandler(int luaHandler) {
		if (mLuaHandler == luaHandler) {
			return;
		}
		resetHandler();
		mLuaHandler = luaHandler;
	}

	void resetHandler() {
		if (0 == mLuaHandler) {
			return;
		}

        LUAENGINE->removeScriptHandler(mLuaHandler);
		mLuaHandler = 0;
	}

    void onAdColonyChange(const sdkbox::AdColonyAdInfo& info, bool available) {
        LuaStack* stack = LUAENGINE->getLuaStack();

        LuaValueDict dict;
        dict.insert(std::make_pair("name", LuaValue::stringValue("onAdColonyChange")));
        dict.insert(std::make_pair("info", adInfo2LuaValue(info)));
        dict.insert(std::make_pair("available", LuaValue::booleanValue(available)));
        stack->pushLuaValueDict(dict);
        stack->executeFunctionByHandler(mLuaHandler, 1);
    }
    void onAdColonyReward(const sdkbox::AdColonyAdInfo& info, const std::string& currencyName, int amount, bool success) {
        LuaStack* stack = LUAENGINE->getLuaStack();

        LuaValueDict dict;
        dict.insert(std::make_pair("name", LuaValue::stringValue("onAdColonyReward")));
        dict.insert(std::make_pair("info", adInfo2LuaValue(info)));
        dict.insert(std::make_pair("currencyName", LuaValue::stringValue(currencyName)));
        dict.insert(std::make_pair("amount", LuaValue::intValue(amount)));
        dict.insert(std::make_pair("success", LuaValue::booleanValue(success)));
        stack->pushLuaValueDict(dict);
        stack->executeFunctionByHandler(mLuaHandler, 1);
    }
    void onAdColonyStarted(const sdkbox::AdColonyAdInfo& info) {
        LuaStack* stack = LUAENGINE->getLuaStack();

        LuaValueDict dict;
        dict.insert(std::make_pair("name", LuaValue::stringValue("onAdColonyStarted")));
        dict.insert(std::make_pair("info", adInfo2LuaValue(info)));
        stack->pushLuaValueDict(dict);
        stack->executeFunctionByHandler(mLuaHandler, 1);
    }
    void onAdColonyFinished(const sdkbox::AdColonyAdInfo& info) {
        LuaStack* stack = LUAENGINE->getLuaStack();
        LuaValueDict dict;
        dict.insert(std::make_pair("name", LuaValue::stringValue("onAdColonyFinished")));
        dict.insert(std::make_pair("info", adInfo2LuaValue(info)));
        stack->pushLuaValueDict(dict);
        stack->executeFunctionByHandler(mLuaHandler, 1);
    }

private:
    LuaValue adInfo2LuaValue(const sdkbox::AdColonyAdInfo& info) {
        LuaValueDict dicLua;
        dicLua.insert(std::make_pair("name", LuaValue::stringValue(info.name)));
        dicLua.insert(std::make_pair("show", LuaValue::booleanValue(info.shown)));
        dicLua.insert(std::make_pair("zoneID", LuaValue::stringValue(info.zoneID)));
        dicLua.insert(std::make_pair("iapEnabled", LuaValue::booleanValue(info.iapEnabled)));
        dicLua.insert(std::make_pair("iapProductID", LuaValue::stringValue(info.iapProductID)));
        dicLua.insert(std::make_pair("iapQuantity", LuaValue::intValue(info.iapQuantity)));
        dicLua.insert(std::make_pair("iapEngagementType", LuaValue::intValue(info.iapEngagementType)));

        return LuaValue::dictValue(dicLua);
    }

private:
	int mLuaHandler;
};

int lua_PluginAdColonyLua_PluginAdColony_setListener(lua_State* tolua_S) {
	int argc = 0;

#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
#endif

#if COCOS2D_DEBUG >= 1
    if (!tolua_isusertable(tolua_S,1,"sdkbox.PluginAdColony",0,&tolua_err)) goto tolua_lerror;
#endif

    argc = lua_gettop(tolua_S) - 1;

    if (argc == 1)
    {
#if COCOS2D_DEBUG >= 1
        if (!toluafix_isfunction(tolua_S, 2 , "LUA_FUNCTION",0,&tolua_err))
        {
            goto tolua_lerror;
        }
#endif
        LUA_FUNCTION handler = (  toluafix_ref_function(tolua_S,2,0));
        AdColonyListenerLua* lis = static_cast<AdColonyListenerLua*> (sdkbox::PluginAdColony::getListener());
        if (nullptr == lis) {
        	lis = new AdColonyListenerLua();
        }
        lis->setHandler(handler);
        sdkbox::PluginAdColony::setListener(lis);

        return 0;
    }
    luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "sdkbox.PluginAdColony::setListener",argc, 1);
    return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'lua_PluginAdColonyLua_PluginAdColony_setListener'.",&tolua_err);
#endif
    return 0;
}

int extern_PluginAdcolony(lua_State* L) {
	if (nullptr == L) {
		return 0;
	}

	lua_pushstring(L, "sdkbox.PluginAdColony");
    lua_rawget(L, LUA_REGISTRYINDEX);
    if (lua_istable(L,-1))
    {
        tolua_function(L,"setListener", lua_PluginAdColonyLua_PluginAdColony_setListener);
    }
     lua_pop(L, 1);

    return 1;
}

TOLUA_API int register_all_PluginAdColonyLua_helper(lua_State* L) {
	tolua_module(L,"sdkbox",0);
	tolua_beginmodule(L,"sdkbox");

	extern_PluginAdcolony(L);

	tolua_endmodule(L);
	return 1;
}


text: html{background:transparent}


text:
* Make sure your issue was not [reported](https://github.com/MarcosSegovia/apiai-go/issues) before.

### Detailed explanation

Help us maximize the effort we can spend fixing issues by not reporting duplicate issues.

### When reporting bugs

Please provide the details so that the problem can be fixed.

### When opening a pull request

Please try to scheme as follows:
- Summary about the issue to get in context
- Reason about why you think this is happening
- Proposed solution

e.g. https://github.com/marcossegovia/apiai-go/pull/2


text:
package org.springframework.test.context.web;

import jakarta.servlet.ServletContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.Conventions;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.context.TestContext;
import org.springframework.test.context.TestExecutionListener;
import org.springframework.test.context.support.AbstractTestExecutionListener;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.util.Assert;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletWebRequest;

/**
 * {@code TestExecutionListener} which provides mock Servlet API support to
 * {@link WebApplicationContext WebApplicationContexts} loaded by the Spring
 * TestContext Framework.
 *
 *
Specifically, {@code ServletTestExecutionListener} sets up thread-local
 * state via Spring Web's {@link RequestContextHolder} during {@linkplain
 * #prepareTestInstance(TestContext) test instance preparation} and {@linkplain
 * #beforeTestMethod(TestContext) before each test method} and creates a {@link
 * MockHttpServletRequest}, {@link MockHttpServletResponse}, and
 * {@link ServletWebRequest} based on the {@link MockServletContext} present in
 * the {@code WebApplicationContext}. This listener also ensures that the
 * {@code MockHttpServletResponse} and {@code ServletWebRequest} can be injected
 * into the test instance, and once the test is complete this listener {@linkplain
 * #afterTestMethod(TestContext) cleans up} thread-local state.
 *
 *
Note that {@code ServletTestExecutionListener} is enabled by default but
 * generally takes no action if the {@linkplain TestContext#getTestClass() test
 * class} is not annotated with {@link WebAppConfiguration @WebAppConfiguration}.
 * See the javadocs for individual methods in this class for details.
 *
 * @author Sam Brannen
 * @author Phillip Webb
 * @since 3.2
 */
public class ServletTestExecutionListener extends AbstractTestExecutionListener {

	/**
	 * Attribute name for a {@link TestContext} attribute which indicates
	 * whether the {@code ServletTestExecutionListener} should {@linkplain
	 * RequestContextHolder#resetRequestAttributes() reset} Spring Web's
	 * {@code RequestContextHolder} in {@link #afterTestMethod(TestContext)}.
	 *
Permissible values include {@link Boolean#TRUE} and {@link Boolean#FALSE}.
	 */
	public static final String RESET_REQUEST_CONTEXT_HOLDER_ATTRIBUTE = Conventions.getQualifiedAttributeName(
			ServletTestExecutionListener.class, "resetRequestContextHolder");

	/**
	 * Attribute name for a {@link TestContext} attribute which indicates that
	 * {@code ServletTestExecutionListener} has already populated Spring Web's
	 * {@code RequestContextHolder}.
	 *
Permissible values include {@link Boolean#TRUE} and {@link Boolean#FALSE}.
	 */
	public static final String POPULATED_REQUEST_CONTEXT_HOLDER_ATTRIBUTE = Conventions.getQualifiedAttributeName(
			ServletTestExecutionListener.class, "populatedRequestContextHolder");

	/**
	 * Attribute name for a request attribute which indicates that the
	 * {@link MockHttpServletRequest} stored in the {@link RequestAttributes}
	 * in Spring Web's {@link RequestContextHolder} was created by the TestContext
	 * framework.
	 *
Permissible values include {@link Boolean#TRUE} and {@link Boolean#FALSE}.
	 * @since 4.2
	 */
	public static final String CREATED_BY_THE_TESTCONTEXT_FRAMEWORK = Conventions.getQualifiedAttributeName(
			ServletTestExecutionListener.class, "createdByTheTestContextFramework");

	/**
	 * Attribute name for a {@link TestContext} attribute which indicates that the
	 * {@code ServletTestExecutionListener} should be activated. When not set to
	 * {@code true}, activation occurs when the {@linkplain TestContext#getTestClass()
	 * test class} is annotated with {@link WebAppConfiguration @WebAppConfiguration}.
	 *
Permissible values include {@link Boolean#TRUE} and {@link Boolean#FALSE}.
	 * @since 4.3
	 */
	public static final String ACTIVATE_LISTENER = Conventions.getQualifiedAttributeName(
			ServletTestExecutionListener.class, "activateListener");

	private static final Log logger = LogFactory.getLog(ServletTestExecutionListener.class);

	/**
	 * Returns {@code 1000}.
	 */
	@Override
	public final int getOrder() {
		return 1000;
	}

	/**
	 * Sets up thread-local state during the test instance preparation
	 * callback phase via Spring Web's {@link RequestContextHolder}, but only if
	 * the {@linkplain TestContext#getTestClass() test class} is annotated with
	 * {@link WebAppConfiguration @WebAppConfiguration}.
	 * @see TestExecutionListener#prepareTestInstance(TestContext)
	 * @see #setUpRequestContextIfNecessary(TestContext)
	 */
	@Override
	public void prepareTestInstance(TestContext testContext) throws Exception {
		setUpRequestContextIfNecessary(testContext);
	}

	/**
	 * Sets up thread-local state before each test method via Spring Web's
	 * {@link RequestContextHolder}, but only if the
	 * {@linkplain TestContext#getTestClass() test class} is annotated with
	 * {@link WebAppConfiguration @WebAppConfiguration}.
	 * @see TestExecutionListener#beforeTestMethod(TestContext)
	 * @see #setUpRequestContextIfNecessary(TestContext)
	 */
	@Override
	public void beforeTestMethod(TestContext testContext) throws Exception {
		setUpRequestContextIfNecessary(testContext);
	}

	/**
	 * If the {@link #RESET_REQUEST_CONTEXT_HOLDER_ATTRIBUTE} in the supplied
	 * {@code TestContext} has a value of {@link Boolean#TRUE}, this method will
	 * (1) clean up thread-local state after each test method by {@linkplain
	 * RequestContextHolder#resetRequestAttributes() resetting} Spring Web's
	 * {@code RequestContextHolder} and (2) ensure that new mocks are injected
	 * into the test instance for subsequent tests by setting the
	 * {@link DependencyInjectionTestExecutionListener#REINJECT_DEPENDENCIES_ATTRIBUTE}
	 * in the test context to {@code true}.
	 *
The {@link #RESET_REQUEST_CONTEXT_HOLDER_ATTRIBUTE} and
	 * {@link #POPULATED_REQUEST_CONTEXT_HOLDER_ATTRIBUTE} will be subsequently
	 * removed from the test context, regardless of their values.
	 * @see TestExecutionListener#afterTestMethod(TestContext)
	 */
	@Override
	public void afterTestMethod(TestContext testContext) throws Exception {
		if (Boolean.TRUE.equals(testContext.getAttribute(RESET_REQUEST_CONTEXT_HOLDER_ATTRIBUTE))) {
			if (logger.isTraceEnabled()) {
				logger.trace("Resetting RequestContextHolder for test context " + testContext);
			}
			else if (logger.isDebugEnabled()) {
				logger.debug("Resetting RequestContextHolder for test class " + testContext.getTestClass().getName());
			}
			RequestContextHolder.resetRequestAttributes();
			testContext.setAttribute(DependencyInjectionTestExecutionListener.REINJECT_DEPENDENCIES_ATTRIBUTE,
				Boolean.TRUE);
		}
		testContext.removeAttribute(POPULATED_REQUEST_CONTEXT_HOLDER_ATTRIBUTE);
		testContext.removeAttribute(RESET_REQUEST_CONTEXT_HOLDER_ATTRIBUTE);
	}

	private boolean isActivated(TestContext testContext) {
		return (Boolean.TRUE.equals(testContext.getAttribute(ACTIVATE_LISTENER)) ||
				AnnotatedElementUtils.hasAnnotation(testContext.getTestClass(), WebAppConfiguration.class));
	}

	private boolean alreadyPopulatedRequestContextHolder(TestContext testContext) {
		return Boolean.TRUE.equals(testContext.getAttribute(POPULATED_REQUEST_CONTEXT_HOLDER_ATTRIBUTE));
	}

	private void setUpRequestContextIfNecessary(TestContext testContext) {
		if (!isActivated(testContext) || alreadyPopulatedRequestContextHolder(testContext)) {
			return;
		}

		ApplicationContext context = testContext.getApplicationContext();

		if (context instanceof WebApplicationContext wac) {
			ServletContext servletContext = wac.getServletContext();
			Assert.state(servletContext instanceof MockServletContext, () -> String.format(
						"The WebApplicationContext for test context %s must be configured with a MockServletContext.",
						testContext));

			if (logger.isTraceEnabled()) {
				logger.trace("Setting up MockHttpServletRequest, MockHttpServletResponse, ServletWebRequest, " +
						"and RequestContextHolder for test context " + testContext);
			}
			else if (logger.isDebugEnabled()) {
				logger.debug("Setting up MockHttpServletRequest, MockHttpServletResponse, ServletWebRequest, " +
						"and RequestContextHolder for test class " + testContext.getTestClass().getName());
			}

			MockServletContext mockServletContext = (MockServletContext) servletContext;
			MockHttpServletRequest request = new MockHttpServletRequest(mockServletContext);
			request.setAttribute(CREATED_BY_THE_TESTCONTEXT_FRAMEWORK, Boolean.TRUE);
			MockHttpServletResponse response = new MockHttpServletResponse();
			ServletWebRequest servletWebRequest = new ServletWebRequest(request, response);

			RequestContextHolder.setRequestAttributes(servletWebRequest);
			testContext.setAttribute(POPULATED_REQUEST_CONTEXT_HOLDER_ATTRIBUTE, Boolean.TRUE);
			testContext.setAttribute(RESET_REQUEST_CONTEXT_HOLDER_ATTRIBUTE, Boolean.TRUE);

			if (wac instanceof ConfigurableApplicationContext configurableApplicationContext) {
				ConfigurableListableBeanFactory bf = configurableApplicationContext.getBeanFactory();
				bf.registerResolvableDependency(MockHttpServletResponse.class, response);
				bf.registerResolvableDependency(ServletWebRequest.class, servletWebRequest);
			}
		}
	}

}


text:
from __future__ import absolute_import, unicode_literals
import os
from flask import Flask, request, abort, render_template
from wechatpy import parse_message, create_reply
from wechatpy.utils import check_signature
from wechatpy.exceptions import InvalidSignatureException

# set token or get from environments
TOKEN = os.getenv('WECHAT_TOKEN', '123456')

app = Flask(__name__)

@app.route('/')
def index():
    host = request.url_root
    return render_template('index.html', host=host)

@app.route('/wechat', methods=['GET', 'POST'])
def wechat():
    signature = request.args.get('signature', '')
    timestamp = request.args.get('timestamp', '')
    nonce = request.args.get('nonce', '')
    echo_str = request.args.get('echostr', '')
    try:
        check_signature(TOKEN, signature, timestamp, nonce)
    except InvalidSignatureException:
        abort(403)
    if request.method == 'GET':
        return echo_str
    else:
        msg = parse_message(request.data)
        if msg.type == 'text':
            reply = create_reply(msg.content, msg)
        else:
            reply = create_reply('Sorry, can not handle this for now', msg)
        return reply.render()

if __name__ == '__main__':
    app.run('127.0.0.1', 5001, debug=True)


text:
import mock
import pytest
import yaml

from hpe_test_utils import OneViewBaseTest
from oneview_module_loader import DatacenterModule

FAKE_MSG_ERROR = 'Fake message error'

RACK_URI = '/rest/racks/rackid'

YAML_DATACENTER = """
        config: "{{ config }}"
        state: present
        data:
            name: "MyDatacenter"
            width: 5000
            depth: 6000
            contents:
                - resourceName: "Rack-221"
                  resourceUri: '/rest/racks/rackid'
                  x: 1000
                  y: 1000
          """

YAML_DATACENTER_CHANGE = """
        config: "{{ config }}"
        state: present
        data:
            name: "MyDatacenter"
            newName: "MyDatacenter1"
            width: 5000
            depth: 5000
            contents:
                - resourceUri: '/rest/racks/rackid'
                  x: 1000
                  y: 1000
      """

YAML_DATACENTER_ABSENT = """
        config: "{{ config }}"
        state: absent
        data:
            name: 'MyDatacenter'
        """

DICT_DEFAULT_DATACENTER = yaml.load(YAML_DATACENTER)["data"]
DICT_DEFAULT_DATACENTER_CHANGED = yaml.load(YAML_DATACENTER_CHANGE)["data"]

@pytest.mark.resource(TestDatacenterModule='datacenters')
class TestDatacenterModule(OneViewBaseTest):
    """
    OneViewBaseTestCase has tests for the main function and provides the mocks used in this test case.
    """

    def test_should_create_new_datacenter(self):
        self.resource.get_by.return_value = []
        self.resource.add.return_value = {"name": "name"}
        self.mock_ov_client.racks.get_by.return_value = [{'uri': RACK_URI}]

        self.mock_ansible_module.params = yaml.load(YAML_DATACENTER)

        DatacenterModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=True,
            msg=DatacenterModule.MSG_CREATED,
            ansible_facts=dict(datacenter={"name": "name"})
        )

    def test_should_update_the_datacenter(self):
        self.resource.get_by.side_effect = [[DICT_DEFAULT_DATACENTER], []]
        self.resource.update.return_value = {"name": "name"}

        self.mock_ansible_module.params = yaml.load(YAML_DATACENTER_CHANGE)

        DatacenterModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=True,
            msg=DatacenterModule.MSG_UPDATED,
            ansible_facts=dict(datacenter={"name": "name"})
        )

    def test_should_not_update_when_data_is_equals(self):
        datacenter_replaced = DICT_DEFAULT_DATACENTER.copy()
        del datacenter_replaced['contents'][0]['resourceName']

        self.resource.get_by.return_value = [DICT_DEFAULT_DATACENTER]
        self.mock_ov_client.racks.get_by.return_value = [{'uri': RACK_URI}]

        self.mock_ansible_module.params = yaml.load(YAML_DATACENTER)

        DatacenterModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            msg=DatacenterModule.MSG_ALREADY_PRESENT,
            ansible_facts=dict(datacenter=DICT_DEFAULT_DATACENTER)
        )

    def test_should_remove_datacenter(self):
        self.resource.get_by.return_value = [DICT_DEFAULT_DATACENTER]

        self.mock_ansible_module.params = yaml.load(YAML_DATACENTER_ABSENT)

        DatacenterModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=True,
            msg=DatacenterModule.MSG_DELETED
        )

    def test_should_do_nothing_when_datacenter_not_exist(self):
        self.resource.get_by.return_value = []

        self.mock_ansible_module.params = yaml.load(YAML_DATACENTER_ABSENT)

        DatacenterModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            msg=DatacenterModule.MSG_ALREADY_ABSENT
        )

    def test_should_fail_when_switch_type_was_not_found(self):
        self.resource.get_by.return_value = []
        self.mock_ov_client.racks.get_by.return_value = []

        self.mock_ansible_module.params = yaml.load(YAML_DATACENTER)

        DatacenterModule().run()

        self.mock_ansible_module.fail_json.assert_called_once_with(exception=mock.ANY, msg=DatacenterModule.MSG_RACK_NOT_FOUND)

if __name__ == '__main__':
    pytest.main([__file__])


text:
package com.facebook.buck.util;

/**
 * Fetches the user ID of the running process.
 */
public interface UserIdFetcher {
  /**
   * Returns the user ID for the current user.
   */
  long getUserId();
}


text:
package com.github.daylily.mt.thread.local.inherit;

public class ThreadLocalTools {
	public static InheritableThreadLocal<Object> t1 = new CustomInheritThreadLocal<>();
}