text:
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import

class AlphaMode(object):
    BLEND = "BLEND"
    MASK = "MASK"
    OPAQUE = "OPAQUE"

class MineType(object):
    JPEG = "image/jpeg"
    PNG = "image/png"

# I changed the name of this so as not to collide with compas.Base
class BaseGLTFDataClass(object):

    IS_BASE_GLTF_DATA = True  # only needed for ipy in `GLTFContent.check_extensions_texture_recursively`

    def __init__(self, extras=None, extensions=None):
        self.extras = extras
        self.extensions = extensions

    def add_extension(self, extension):
        if not self.extensions:
            self.extensions = {}
        self.extensions.update({extension.key: extension})

    def extensions_to_data(self, **kwargs):
        if not self.extensions:
            return None
        return {
            key: value.to_data(**kwargs) if hasattr(value, "to_data") else value
            for key, value in self.extensions.items()
        }

    @classmethod
    def extensions_from_data(cls, data):
        # i hate hate hate this local import, but i don't see a good way around it
        from compas.files.gltf.extensions import SUPPORTED_EXTENSIONS

        if not data:
            return None
        extensions = {}
        for key, value_data in data.items():
            if key in SUPPORTED_EXTENSIONS:
                extensions[key] = SUPPORTED_EXTENSIONS[key].from_data(value_data)
            else:
                extensions[key] = value_data
        return extensions

    def to_data(self, *args, **kwargs):
        dct = {}
        if self.extras is not None:
            dct["extras"] = self.extras
        if self.extensions is not None:
            dct["extensions"] = self.extensions_to_data()
        return dct

class SamplerData(BaseGLTFDataClass):
    def __init__(
        self,
        mag_filter=None,
        min_filter=None,
        wrap_s=None,
        wrap_t=None,
        name=None,
        extras=None,
        extensions=None,
    ):
        super(SamplerData, self).__init__(extras, extensions)
        self.mag_filter = mag_filter
        self.min_filter = min_filter
        self.wrap_s = wrap_s
        self.wrap_t = wrap_t
        self.name = name

    def to_data(self):
        sampler_dict = {}
        if self.mag_filter is not None:
            sampler_dict["magFilter"] = self.mag_filter
        if self.min_filter is not None:
            sampler_dict["minFilter"] = self.min_filter
        if self.wrap_s is not None:
            sampler_dict["wrapS"] = self.wrap_s
        if self.wrap_t is not None:
            sampler_dict["wrapT"] = self.wrap_t
        if self.name is not None:
            sampler_dict["name"] = self.name
        if self.extras is not None:
            sampler_dict["extras"] = self.extras
        if self.extensions is not None:
            sampler_dict["extensions"] = self.extensions_to_data()
        return sampler_dict

    @classmethod
    def from_data(cls, sampler):
        if sampler is None:
            return None
        return cls(
            mag_filter=sampler.get("magFilter"),
            min_filter=sampler.get("minFilter"),
            wrap_s=sampler.get("wrapS"),
            wrap_t=sampler.get("wrapT"),
            name=sampler.get("name"),
            extras=sampler.get("extras"),
            extensions=cls.extensions_from_data(sampler.get("extensions")),
        )

class TextureData(BaseGLTFDataClass):
    def __init__(self, sampler=None, source=None, name=None, extras=None, extensions=None):
        super(TextureData, self).__init__(extras, extensions)
        self.sampler = sampler
        self.source = source
        self.name = name

    def to_data(self, sampler_index_by_key, image_index_by_key):
        texture_dict = {}
        if self.sampler is not None:
            texture_dict["sampler"] = sampler_index_by_key[self.sampler]
        if self.source is not None:
            texture_dict["source"] = image_index_by_key[self.source]
        if self.name is not None:
            texture_dict["name"] = self.name
        if self.extras is not None:
            texture_dict["extras"] = self.extras
        if self.extensions is not None:
            texture_dict["extensions"] = self.extensions_to_data()
        return texture_dict

    @classmethod
    def from_data(cls, texture):
        if texture is None:
            return None
        return cls(
            sampler=texture.get("sampler"),
            source=texture.get("source"),
            name=texture.get("name"),
            extras=texture.get("extras"),
            extensions=cls.extensions_from_data(texture.get("extensions")),
        )

class TextureInfoData(BaseGLTFDataClass):

    IS_TEXTURE_INFO_DATA = True  # only needed for ipy in `GLTFContent.check_extensions_texture_recursively`

    def __init__(self, index, tex_coord=None, extras=None, extensions=None):
        super(TextureInfoData, self).__init__(extras, extensions)
        self.index = index
        self.tex_coord = tex_coord

    def to_data(self, texture_index_by_key):
        texture_info_dict = {"index": texture_index_by_key[self.index]}
        if self.tex_coord is not None:
            texture_info_dict["texCoord"] = self.tex_coord
        if self.extras is not None:
            texture_info_dict["extras"] = self.extras
        if self.extensions is not None:
            texture_info_dict["extensions"] = self.extensions_to_data()
        return texture_info_dict

    @classmethod
    def from_data(cls, texture_info):
        if texture_info is None:
            return None
        return cls(
            index=texture_info["index"],
            tex_coord=texture_info.get("texCoord"),
            extras=texture_info.get("extras"),
            extensions=cls.extensions_from_data(texture_info.get("extensions")),
        )

class OcclusionTextureInfoData(TextureInfoData):
    def __init__(self, index, tex_coord=None, extras=None, extensions=None, strength=None):
        super(OcclusionTextureInfoData, self).__init__(index, tex_coord, extras, extensions)
        self.strength = strength

    def to_data(self, texture_index_by_key):
        texture_info_dict = super(OcclusionTextureInfoData, self).to_data(texture_index_by_key)
        if self.strength is not None:
            texture_info_dict["strength"] = self.strength
        return texture_info_dict

    @classmethod
    def from_data(cls, texture_info):
        if texture_info is None:
            return None
        return cls(
            index=texture_info["index"],
            tex_coord=texture_info.get("texCoord"),
            extras=texture_info.get("extras"),
            extensions=cls.extensions_from_data(texture_info.get("extensions")),
            strength=texture_info.get("strength"),
        )

class NormalTextureInfoData(TextureInfoData):
    def __init__(self, index, tex_coord=None, extras=None, extensions=None, scale=None):
        super(NormalTextureInfoData, self).__init__(index, tex_coord, extras, extensions)
        self.scale = scale

    def to_data(self, texture_index_by_key):
        texture_info_dict = super(NormalTextureInfoData, self).to_data(texture_index_by_key)
        if self.scale is not None:
            texture_info_dict["scale"] = self.scale
        return texture_info_dict

    @classmethod
    def from_data(cls, texture_info):
        if texture_info is None:
            return None
        return cls(
            index=texture_info["index"],
            tex_coord=texture_info.get("texCoord"),
            extras=texture_info.get("extras"),
            extensions=cls.extensions_from_data(texture_info.get("extensions")),
            scale=texture_info.get("scale"),
        )

class PBRMetallicRoughnessData(BaseGLTFDataClass):
    def __init__(
        self,
        base_color_factor=None,
        base_color_texture=None,
        metallic_factor=None,
        roughness_factor=None,
        metallic_roughness_texture=None,
        extras=None,
        extensions=None,
    ):
        super(PBRMetallicRoughnessData, self).__init__(extras, extensions)
        self.base_color_factor = base_color_factor
        self.base_color_texture = base_color_texture
        self.metallic_factor = metallic_factor
        self.roughness_factor = roughness_factor
        self.metallic_roughness_texture = metallic_roughness_texture

    def to_data(self, texture_index_by_key):
        roughness_dict = {}
        if self.base_color_factor is not None:
            roughness_dict["baseColorFactor"] = self.base_color_factor
        if self.base_color_texture is not None:
            roughness_dict["baseColorTexture"] = self.base_color_texture.to_data(texture_index_by_key)
        if self.metallic_factor is not None:
            roughness_dict["metallicFactor"] = self.metallic_factor
        if self.roughness_factor is not None:
            roughness_dict["roughnessFactor"] = self.roughness_factor
        if self.metallic_roughness_texture is not None:
            roughness_dict["metallicRoughnessTexture"] = self.metallic_roughness_texture.to_data(texture_index_by_key)
        if self.extras is not None:
            roughness_dict["extras"] = self.extras
        if self.extensions is not None:
            roughness_dict["extensions"] = self.extensions_to_data()
        return roughness_dict

    @classmethod
    def from_data(cls, texture_info):
        if texture_info is None:
            return None
        return cls(
            base_color_factor=texture_info.get("baseColorFactor"),
            base_color_texture=TextureInfoData.from_data(texture_info.get("baseColorTexture")),
            metallic_factor=texture_info.get("metallicFactor"),
            roughness_factor=texture_info.get("roughnessFactor"),
            metallic_roughness_texture=TextureInfoData.from_data(texture_info.get("metallicRoughnessTexture")),
            extras=texture_info.get("extras"),
            extensions=cls.extensions_from_data(texture_info.get("extensions")),
        )

class MaterialData(BaseGLTFDataClass):
    def __init__(
        self,
        name=None,
        extras=None,
        pbr_metallic_roughness=None,  # PBRMetallicRoughnessData
        normal_texture=None,  # NormalTextureInfoData
        occlusion_texture=None,  # OcclusionTextureInfoData
        emissive_texture=None,  # TextureInfoData
        emissive_factor=None,
        alpha_mode=None,
        alpha_cutoff=None,
        double_sided=None,
        extensions=None,
    ):
        super(MaterialData, self).__init__(extras, extensions)
        self.name = name
        self.pbr_metallic_roughness = pbr_metallic_roughness
        self.normal_texture = normal_texture
        self.occlusion_texture = occlusion_texture
        self.emissive_texture = emissive_texture
        self.emissive_factor = emissive_factor
        self.alpha_mode = alpha_mode
        self.alpha_cutoff = alpha_cutoff
        self.double_sided = double_sided

    def to_data(self, texture_index_by_key):
        material_dict = {}
        if self.name is not None:
            material_dict["name"] = self.name
        if self.extras is not None:
            material_dict["extras"] = self.extras
        if self.pbr_metallic_roughness is not None:
            material_dict["pbrMetallicRoughness"] = self.pbr_metallic_roughness.to_data(texture_index_by_key)
        if self.normal_texture is not None:
            material_dict["normalTexture"] = self.normal_texture.to_data(texture_index_by_key)
        if self.occlusion_texture is not None:
            material_dict["materialTexture"] = self.occlusion_texture.to_data(texture_index_by_key)
        if self.emissive_texture is not None:
            material_dict["emissiveTexture"] = self.emissive_texture.to_data(texture_index_by_key)
        if self.emissive_factor is not None:
            material_dict["emissiveFactor"] = self.emissive_factor
        if self.alpha_mode is not None:
            material_dict["alphaMode"] = self.alpha_mode
        if self.alpha_cutoff is not None:
            material_dict["alphaFactor"] = self.alpha_cutoff
        if self.double_sided is not None:
            material_dict["doubleSided"] = self.double_sided
        if self.extensions is not None:
            material_dict["extensions"] = self.extensions_to_data(texture_index_by_key=texture_index_by_key)
        return material_dict

    @classmethod
    def from_data(cls, material):
        if material is None:
            return None
        return cls(
            name=material.get("name"),
            extras=material.get("extras"),
            pbr_metallic_roughness=PBRMetallicRoughnessData.from_data(material.get("pbrMetallicRoughness")),
            normal_texture=NormalTextureInfoData.from_data(material.get("normalTexture")),
            occlusion_texture=OcclusionTextureInfoData.from_data(material.get("occlusionTexture")),
            emissive_texture=TextureInfoData.from_data(material.get("emissiveTexture")),
            emissive_factor=material.get("emissiveFactor"),
            alpha_mode=material.get("alphaMode"),
            alpha_cutoff=material.get("alphaCutoff"),
            double_sided=material.get("doubleSided"),
            extensions=cls.extensions_from_data(material.get("extensions")),
        )

class CameraData(BaseGLTFDataClass):
    def __init__(
        self,
        type_,
        orthographic=None,
        perspective=None,
        name=None,
        extras=None,
        extensions=None,
    ):
        super(CameraData, self).__init__(extras, extensions)
        self.type = type_
        self.orthographic = orthographic
        self.perspective = perspective
        self.name = name

    def to_data(self):
        camera_dict = {"type": self.type}
        if self.orthographic is not None:
            camera_dict["orthographic"] = self.orthographic
        if self.perspective is not None:
            camera_dict["perspective"] = self.perspective
        if self.name is not None:
            camera_dict["name"] = self.name
        if self.extras is not None:
            camera_dict["extras"] = self.extras
        if self.extensions is not None:
            camera_dict["extensions"] = self.extensions_to_data()
        return camera_dict

    @classmethod
    def from_data(cls, camera):
        if camera is None:
            return None
        return cls(
            type_=camera["type"],
            orthographic=camera.get("orthographic"),
            perspective=camera.get("perspective"),
            name=camera.get("name"),
            extras=camera.get("extras"),
            extensions=cls.extensions_from_data(camera.get("extensions")),
        )

class AnimationSamplerData(BaseGLTFDataClass):
    def __init__(self, input_, output, interpolation=None, extras=None, extensions=None):
        super(AnimationSamplerData, self).__init__(extras, extensions)
        self.input = input_
        self.output = output
        self.interpolation = interpolation

    def to_data(self, input_accessor, output_accessor):
        sampler_dict = {
            "input": input_accessor,
            "output": output_accessor,
        }
        if self.interpolation is not None:
            sampler_dict["interpolation"] = self.interpolation
        if self.extras is not None:
            sampler_dict["extras"] = self.extras
        if self.extensions is not None:
            sampler_dict["extensions"] = self.extensions_to_data()
        return sampler_dict

    @classmethod
    def from_data(cls, sampler, input_, output):
        if sampler is None:
            return None
        return cls(
            input_=input_,
            output=output,
            interpolation=sampler.get("interpolation"),
            extras=sampler.get("extras"),
            extensions=cls.extensions_from_data(sampler.get("extensions")),
        )

class TargetData(BaseGLTFDataClass):
    def __init__(self, path, node=None, extras=None, extensions=None):
        super(TargetData, self).__init__(extras, extensions)
        self.path = path
        self.node = node

    def to_data(self, node_index_by_key):
        target_dict = {"path": self.path}
        if self.node is not None:
            target_dict["node"] = node_index_by_key[self.node]
        if self.extras is not None:
            target_dict["extras"] = self.extras
        if self.extensions is not None:
            target_dict["extensions"] = self.extensions_to_data()
        return target_dict

    @classmethod
    def from_data(cls, target):
        if target is None:
            return None
        return cls(
            path=target["path"],
            node=target.get("node"),
            extras=target.get("extras"),
            extensions=cls.extensions_from_data(target.get("extensions")),
        )

class ChannelData(BaseGLTFDataClass):
    def __init__(self, sampler, target, extras=None, extensions=None):
        super(ChannelData, self).__init__(extras, extensions)
        self.sampler = sampler
        self.target = target

    def to_data(self, node_index_by_key, sampler_index_by_key):
        channel_dict = {
            "sampler": sampler_index_by_key[self.sampler],
            "target": self.target.to_data(node_index_by_key),
        }
        if self.extras is not None:
            channel_dict["extras"] = self.extras
        if self.extensions is not None:
            channel_dict["extensions"] = self.extensions_to_data()
        return channel_dict

    @classmethod
    def from_data(cls, channel):
        if channel is None:
            return None
        return cls(
            sampler=channel["sampler"],
            target=TargetData.from_data(channel["target"]),
            extras=channel.get("extras"),
            extensions=cls.extensions_from_data(channel.get("extensions")),
        )

class AnimationData(BaseGLTFDataClass):
    def __init__(self, channels, samplers_dict, name=None, extras=None, extensions=None):
        super(AnimationData, self).__init__(extras, extensions)
        self.channels = channels
        self.samplers_dict = samplers_dict
        self.name = name

        self._sampler_index_by_key = None

    def to_data(self, samplers_list, node_index_by_key):
        channels = [
            channel_data.to_data(node_index_by_key, self._sampler_index_by_key) for channel_data in self.channels
        ]
        animation_dict = {
            "channels": channels,
            "samplers": samplers_list,
        }
        if self.name is not None:
            animation_dict["name"] = self.name
        if self.extras is not None:
            animation_dict["extras"] = self.extras
        if self.extensions is not None:
            animation_dict["extensions"] = self.extensions_to_data()
        return animation_dict

    def get_sampler_index_by_key(self):
        self._sampler_index_by_key = {key: index for index, key in enumerate(self.samplers_dict)}
        return self._sampler_index_by_key

    @classmethod
    def from_data(cls, animation, channel_data_list, sampler_dict):
        if animation is None:
            return None
        return cls(
            channels=channel_data_list,
            samplers_dict=sampler_dict,
            name=animation.get("name"),
            extras=animation.get("extras"),
            extensions=cls.extensions_from_data(animation.get("extensions")),
        )

class SkinData(BaseGLTFDataClass):
    def __init__(
        self,
        joints,
        inverse_bind_matrices=None,
        skeleton=None,
        name=None,
        extras=None,
        extensions=None,
    ):
        super(SkinData, self).__init__(extras, extensions)
        self.joints = joints
        self.inverse_bind_matrices = inverse_bind_matrices
        self.skeleton = skeleton
        self.name = name

    def to_data(self, node_index_by_key, accessor_index):
        node_indices = [node_index_by_key.get(item) for item in self.joints if node_index_by_key.get(item) is not None]
        skin_dict = {"joints": node_indices}
        if self.skeleton is not None:
            skin_dict["skeleton"] = self.skeleton
        if self.name is not None:
            skin_dict["name"] = self.name
        if self.extras is not None:
            skin_dict["extras"] = self.extras
        if self.inverse_bind_matrices is not None:
            skin_dict["inverseBindMatrices"] = accessor_index
        if self.extensions is not None:
            skin_dict["extensions"] = self.extensions_from_data()
        return skin_dict

    @classmethod
    def from_data(cls, skin, inverse_bind_matrices):
        if skin is None:
            return None
        return cls(
            joints=skin["joints"],
            inverse_bind_matrices=inverse_bind_matrices,
            skeleton=skin.get("skeleton"),
            name=skin.get("name"),
            extras=skin.get("extras"),
            extensions=cls.extensions_from_data(skin.get("extensions")),
        )

class ImageData(BaseGLTFDataClass):
    def __init__(
        self,
        data=None,
        uri=None,
        mime_type=None,
        name=None,
        extras=None,
        extensions=None,
    ):
        super(ImageData, self).__init__(extras, extensions)
        self.uri = uri
        self.mime_type = mime_type
        self.name = name
        self.data = data

    def to_data(self, uri, buffer_view):
        image_dict = {}
        if self.name is not None:
            image_dict["name"] = self.name
        if self.extras is not None:
            image_dict["extras"] = self.extras
        if self.mime_type is not None:
            image_dict["mimeType"] = self.mime_type
        if uri is not None:
            image_dict["uri"] = uri
        elif buffer_view is not None:
            image_dict["bufferView"] = buffer_view
        elif self.uri is not None:
            image_dict["uri"] = self.uri
        if self.extensions is not None:
            image_dict["extensions"] = self.extensions_from_data()
        return image_dict

    @classmethod
    def from_data(cls, image, data, mime_type):
        if image is None:
            return None
        return cls(
            uri=image.get("uri"),
            mime_type=image.get("mimeType") or mime_type,
            name=image.get("name"),
            extras=image.get("extras"),
            extensions=cls.extensions_from_data(image.get("extensions")),
            data=data,
        )

class PrimitiveData(BaseGLTFDataClass):
    def __init__(
        self,
        attributes,
        indices=None,
        material=None,
        mode=None,
        targets=None,
        extras=None,
        extensions=None,
    ):
        super(PrimitiveData, self).__init__(extras, extensions)
        self.attributes = attributes or {}
        self.indices = indices
        self.material = material
        self.mode = mode
        self.targets = targets

    def to_data(self, indices_accessor, attributes_dict, targets_dict, material_index_by_key):
        primitive_dict = {"indices": indices_accessor}
        if self.material is not None:
            primitive_dict["material"] = material_index_by_key[self.material]
        if self.mode is not None:
            primitive_dict["mode"] = self.mode
        if self.extras is not None:
            primitive_dict["extras"] = self.extras
        if attributes_dict:
            primitive_dict["attributes"] = attributes_dict
        if targets_dict:
            primitive_dict["targets"] = targets_dict
        if self.extensions is not None:
            primitive_dict["extensions"] = self.extensions_to_data()
        return primitive_dict

    @classmethod
    def from_data(cls, primitive, attributes, indices, target_list):
        if primitive is None:
            return None
        return cls(
            attributes=attributes,
            indices=indices,
            material=primitive.get("material"),
            mode=primitive.get("mode"),
            targets=target_list,
            extras=primitive.get("extras"),
            extensions=cls.extensions_from_data(primitive.get("extensions")),
        )


text:
<link rel="stylesheet" href="<?php echo RES; ?>lib/datatables/extras/TableTools/media/css/TableTools.css">
<link rel="stylesheet" href="<?php echo RES; ?>/common/common.css" />
<?php $this->load->view('shared/alert'); ?>

商品客户列表

                <input name="s_name" class="input-medium form-control" placeholder="客户名称" type="text">

                <input name="s_id" class="input-medium form-control" placeholder="客户id" type="text">

                <select name="s_status" class="select-medium form-control">
                    <option value="0">全部状态</option>
                    <option value="1">启用</option>
                    <option value="2">停用</option>
                </select>

                <button class="btn btn-success label search">查询</button>

                新建
                停用
                启用

                        <input name="select_rows" class="select_rows" data-tableid="customer_tb" type="checkbox">

                    名  称
                    id
                    状  态
                    商品数量
                    备  注
                      操作

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

新建客户

                            客户名称

                                <input name="a_name" type="text" class="form-control">

                            备注

                                <textarea name="a_remark" cols="6" rows="3" class="form-control"></textarea>

                                <button type="button" class="btn btn-success" id="add-customer-bnt">确认</button>

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

编辑客户

                            客户id

                            名称

                                <input name="e_name" type="text" class="form-control">

                            状态

                                <select name="e_status" class="form-control">
                                    <option value="1">启用</option>
                                    <option value="2">停用</option>
                                </select>

                            备注

                                <textarea name="e_remark" cols="6" rows="2" class="form-control"></textarea>

                                <button type="button" class="btn btn-success" id="edit-customer-bnt">确认</button>

redpajama_set_name: RedPajamaGithub


text:
package org.apache.flink.table.gateway.rest.message.operation;

import org.apache.flink.runtime.rest.messages.MessagePathParameter;
import org.apache.flink.table.gateway.api.operation.OperationHandle;

import java.util.UUID;

/** {@link MessagePathParameter} that parse the {@link OperationHandle}. */
public class OperationHandleIdPathParameter extends MessagePathParameter<OperationHandle> {

    public static final String KEY = "operation_handle";

    public OperationHandleIdPathParameter() {
        super(KEY);
    }

    @Override
    protected OperationHandle convertFromString(String operationHandleId) {
        return new OperationHandle(UUID.fromString(operationHandleId));
    }

    @Override
    protected String convertToString(OperationHandle operationHandle) {
        return operationHandle.getIdentifier().toString();
    }

    @Override
    public String getDescription() {
        return "The OperationHandle that identifies a operation.";
    }
}


text:
package samples.junit3.annotationbased;

import junit.framework.TestCase;
import samples.Service;
import samples.annotationbased.AnnotationDemo;

import static org.easymock.EasyMock.expect;
import static org.powermock.api.easymock.PowerMock.replayAll;
import static org.powermock.api.easymock.PowerMock.verifyAll;

/**
 * Verifies that PowerMock test listeners works correctly with setup methods
 * when this is supported by junit 3.
 */
public class AnnotationDemoWithSetupMethodTest extends TestCase {

	@org.powermock.api.easymock.annotation.Mock
	private Service serviceMock;

	private AnnotationDemo tested;

	@Override
	protected void setUp() throws Exception {
		tested = new AnnotationDemo(serviceMock);
	}

	public void ignored_testInjectionWorked() throws Exception {
		final String expected = "mock";
		expect(serviceMock.getServiceMessage()).andReturn(expected);

		replayAll();

		assertEquals(expected, tested.getServiceMessage());

		verifyAll();
	}

	public void testDummy() throws Exception {
	}
}


text:
(function ($)
{
    /**
     * Creates jQuery plugin for crypto fields
     * @returns DxCryptoFileField
     */
    $.fn.DxCryptoFileField = function ()
    {
        /*for (var i=0; i < this.length; i++){
         var selfR = this[i];

         var self = $(selfR);

         if (self.data('dx_is_init') == 1) {
         continue;
         }

         self.data('dx_is_init', 1);

         var cr = new $.DxCryptoFileField(self);

         this.crypto = cr;
         }*/

        return this.each(function ()
        {
            var self = $(this);

            if (self.data('dx_is_init') == 1) {
                return;
            }

            self.data('dx_is_init', 1);

            this.crypto = new $.DxCryptoFileField(self);
        });
    };

    /**
     * Class for managing crypto fields
     * @type DxCryptoFileField
     */
    $.DxCryptoFileField = function (domObject) {
        /**
         * Field's DOM object which is related to this class
         */
        this.domObject = domObject;

        // Initializes class
        this.init();
    };

    /**
     * Initializes component
     * @returns {undefined}
     */
    $.extend($.DxCryptoFileField.prototype, {
        /**
         * Initializes field
         * @returns {undefined}
         */
        init: function () {
            var self = this;

            if (this.domObject.is('input')) {
                this.inputInit();
            } else if (this.domObject.is('a')) {
                this.linkInit();
            }
        },
        inputInit: function () {

        },
        linkInit: function () {
            this.domObject.click(this.onLinkClick);
        },
        onLinkClick: function (event) {
            event.preventDefault();
            event.stopPropagation();
            event.stopImmediatePropagation();

            window.DxCrypto.decryptFields($(this));
        },
        setAccessError: function () {
            /*  var label = '<span class="label label-danger"> ' + Lang.get('crypto.e_no_access') + ' </span>';

             this.domObject.next('.dx-crypto-decrypt-btn').remove();
             this.domObject.after(label);*/
        },
        /**
         * Gets value of current element. It can be input or other container (e.g. div, span)
         * @returns {string}
         */
        getValue: function (callback) {
            if (this.domObject.is('input')) {
                this.getFileValue(callback);
            } else if (this.domObject.is('a')) {
                this.getLinkValue(callback);
            }
        },
        getFileValue: function (callback) {
            if (this.domObject[0].files.length === 0) {
                return new ArrayBuffer(0);
            }

            var fr = new FileReader();
            fr.onload = function () {
                var data = fr.result;
                var dataArray = new Uint8Array(data);

                callback(dataArray);
            };

            fr.readAsArrayBuffer(this.domObject[0].files[0]);
        },
        getLinkValue: function (callback) {
            var xhr = new XMLHttpRequest();

            xhr.onload = function () {
                var reader = new FileReader();

                reader.readAsArrayBuffer(xhr.response);

                reader.onloadend = function () {

                    var arrayBuffer = new Uint8Array(reader.result);

                    callback(arrayBuffer, xhr.response.type);
                };
            };
            xhr.open('GET', this.domObject.attr("href"));
            xhr.responseType = 'blob';
            xhr.send();
        },
        /**
         * Sets value of current element. It can be input or other container (e.g. div, span)
         * @param {string} value It will be set to element
         * @returns {undefined}
         */
        setValue: function (value, fileType) {
            if (this.domObject.is('input')) {
                return this.setFileValue(value);
            } else if (this.domObject.is('a')) {
                return this.setLinkValue(value, fileType);
            }
        },
        setFileValue: function (value) {
            var valueBlob = new Blob([new Uint8Array(value)], {type: "application/octet-stream"});

            this.domObject.data('crypto-value', valueBlob);
        },
        setLinkValue: function (value, fileType) {
            var blob = new Blob([value], {type: fileType});
            var newUrl = URL.createObjectURL(blob);

            var a = document.createElement("a");
            a.style.display = "none";
            a.href = newUrl;
            a.download = this.domObject.text().trim();
            $("body").append($(a));
            a.click();
            window.URL.revokeObjectURL(newUrl);
            a.remove();
        }
    });
})(jQuery);

// ajaxComplete ready
$(document).ready(function () {
    // Initializes all found worklfow containers
    $('.dx-crypto-field-file').DxCryptoFileField();
});

$(document).ajaxComplete(function () {
    // Initializes all found worklfow containers
    $('.dx-crypto-field-file').DxCryptoFileField();
});


text:
package syscall

import (
	"unsafe"
)

// Deprecated: Use golang.org/x/net/bpf instead.
func BpfStmt(code, k int) *BpfInsn {
	return &BpfInsn{Code: uint16(code), K: uint32(k)}
}

// Deprecated: Use golang.org/x/net/bpf instead.
func BpfJump(code, k, jt, jf int) *BpfInsn {
	return &BpfInsn{Code: uint16(code), Jt: uint8(jt), Jf: uint8(jf), K: uint32(k)}
}

// Deprecated: Use golang.org/x/net/bpf instead.
func BpfBuflen(fd int) (int, error) {
	var l int
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGBLEN, uintptr(unsafe.Pointer(&l)))
	if err != 0 {
		return 0, Errno(err)
	}
	return l, nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func SetBpfBuflen(fd, l int) (int, error) {
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSBLEN, uintptr(unsafe.Pointer(&l)))
	if err != 0 {
		return 0, Errno(err)
	}
	return l, nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func BpfDatalink(fd int) (int, error) {
	var t int
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGDLT, uintptr(unsafe.Pointer(&t)))
	if err != 0 {
		return 0, Errno(err)
	}
	return t, nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func SetBpfDatalink(fd, t int) (int, error) {
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSDLT, uintptr(unsafe.Pointer(&t)))
	if err != 0 {
		return 0, Errno(err)
	}
	return t, nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func SetBpfPromisc(fd, m int) error {
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCPROMISC, uintptr(unsafe.Pointer(&m)))
	if err != 0 {
		return Errno(err)
	}
	return nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func FlushBpf(fd int) error {
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCFLUSH, 0)
	if err != 0 {
		return Errno(err)
	}
	return nil
}

type ivalue struct {
	name  [IFNAMSIZ]byte
	value int16
}

// Deprecated: Use golang.org/x/net/bpf instead.
func BpfInterface(fd int, name string) (string, error) {
	var iv ivalue
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGETIF, uintptr(unsafe.Pointer(&iv)))
	if err != 0 {
		return "", Errno(err)
	}
	return name, nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func SetBpfInterface(fd int, name string) error {
	var iv ivalue
	copy(iv.name[:], []byte(name))
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSETIF, uintptr(unsafe.Pointer(&iv)))
	if err != 0 {
		return Errno(err)
	}
	return nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func BpfTimeout(fd int) (*Timeval, error) {
	var tv Timeval
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGRTIMEOUT, uintptr(unsafe.Pointer(&tv)))
	if err != 0 {
		return nil, Errno(err)
	}
	return &tv, nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func SetBpfTimeout(fd int, tv *Timeval) error {
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSRTIMEOUT, uintptr(unsafe.Pointer(tv)))
	if err != 0 {
		return Errno(err)
	}
	return nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func BpfStats(fd int) (*BpfStat, error) {
	var s BpfStat
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGSTATS, uintptr(unsafe.Pointer(&s)))
	if err != 0 {
		return nil, Errno(err)
	}
	return &s, nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func SetBpfImmediate(fd, m int) error {
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCIMMEDIATE, uintptr(unsafe.Pointer(&m)))
	if err != 0 {
		return Errno(err)
	}
	return nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func SetBpf(fd int, i []BpfInsn) error {
	var p BpfProgram
	p.Len = uint32(len(i))
	p.Insns = (*BpfInsn)(unsafe.Pointer(&i[0]))
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSETF, uintptr(unsafe.Pointer(&p)))
	if err != 0 {
		return Errno(err)
	}
	return nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func CheckBpfVersion(fd int) error {
	var v BpfVersion
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCVERSION, uintptr(unsafe.Pointer(&v)))
	if err != 0 {
		return Errno(err)
	}
	if v.Major != BPF_MAJOR_VERSION || v.Minor != BPF_MINOR_VERSION {
		return EINVAL
	}
	return nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func BpfHeadercmpl(fd int) (int, error) {
	var f int
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGHDRCMPLT, uintptr(unsafe.Pointer(&f)))
	if err != 0 {
		return 0, Errno(err)
	}
	return f, nil
}

// Deprecated: Use golang.org/x/net/bpf instead.
func SetBpfHeadercmpl(fd, f int) error {
	_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSHDRCMPLT, uintptr(unsafe.Pointer(&f)))
	if err != 0 {
		return Errno(err)
	}
	return nil
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Http;
using GroupDocs.Annotation;
using GroupDocs.Annotation.Common.License;

namespace GroupDocs.Annotation_for.NET
{
    public class Global : HttpApplication
    {
        private static string _licensePath = "E:\\GroupDocs.Total.lic";
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            License l = new License();
            if (System.IO.File.Exists(_licensePath))
            {
                try
                {
                    l.SetLicense(_licensePath);
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
    }
}


text: export * from 'rxjs-compat/operator/pluck';


text:
package org.ehcache.internal.store.tiering;

import org.ehcache.function.BiFunction;
import org.ehcache.function.Function;
import org.ehcache.function.NullaryFunction;
import org.ehcache.spi.cache.Store;
import org.ehcache.spi.cache.tiering.AuthoritativeTier;
import org.ehcache.spi.cache.tiering.CachingTier;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.core.Is.is;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

/**
 * @author Ludovic Orban
 */
public class CacheStoreTest {

  @Test
  public void testGetHitsCachingTier() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(cachingTier.getOrComputeIfAbsent(eq(1), any(Function.class))).thenReturn(newValueHolder("one"));

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.get(1).value(), Matchers.<CharSequence>equalTo("one"));

    verify(authoritativeTier, times(0)).getAndFault(any(Number.class));
  }

  @Test
  public void testGetHitsAuthoritativeTier() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    Store.ValueHolder<CharSequence> valueHolder = newValueHolder("one");
    when(authoritativeTier.getAndFault(eq(1))).thenReturn(valueHolder);
    when(cachingTier.getOrComputeIfAbsent(any(Number.class), any(Function.class))).then(new Answer<Store.ValueHolder<CharSequence>>() {
      @Override
      public Store.ValueHolder<CharSequence> answer(InvocationOnMock invocation) throws Throwable {
        Number key = (Number) invocation.getArguments()[0];
        Function<Number, Store.ValueHolder<CharSequence>> function = (Function<Number, Store.ValueHolder<CharSequence>>) invocation.getArguments()[1];
        return function.apply(key);
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.get(1).value(), Matchers.<CharSequence>equalTo("one"));

    verify(cachingTier, times(1)).getOrComputeIfAbsent(eq(1), any(Function.class));
    verify(authoritativeTier, times(1)).getAndFault(any(Number.class));
  }

  @Test
  public void testGetMisses() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.getAndFault(eq(1))).thenReturn(null);
    when(cachingTier.getOrComputeIfAbsent(any(Number.class), any(Function.class))).then(new Answer<Store.ValueHolder<CharSequence>>() {
      @Override
      public Store.ValueHolder<CharSequence> answer(InvocationOnMock invocation) throws Throwable {
        Number key = (Number) invocation.getArguments()[0];
        Function<Number, Store.ValueHolder<CharSequence>> function = (Function<Number, Store.ValueHolder<CharSequence>>) invocation.getArguments()[1];
        return function.apply(key);
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.get(1), is(nullValue()));

    verify(cachingTier, times(1)).getOrComputeIfAbsent(eq(1), any(Function.class));
    verify(authoritativeTier, times(1)).getAndFault(any(Number.class));
  }

  @Test
  public void testPut() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    cacheStore.put(1, "one");

    verify(cachingTier, times(1)).invalidate(eq(1));
    verify(authoritativeTier, times(1)).put(eq(1), eq("one"));
  }

  @Test
  public void testPutIfAbsent_whenAbsent() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.putIfAbsent(1, "one"), is(nullValue()));

    verify(cachingTier, times(1)).invalidate(eq(1));
    verify(authoritativeTier, times(1)).putIfAbsent(eq(1), eq("one"));
  }

  @Test
  public void testPutIfAbsent_whenPresent() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.putIfAbsent(eq(1), eq("one"))).thenReturn(newValueHolder("un"));

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.putIfAbsent(1, "one").value(), Matchers.<CharSequence>equalTo("un"));

    verify(cachingTier, times(0)).invalidate(any(Number.class));
    verify(authoritativeTier, times(1)).putIfAbsent(eq(1), eq("one"));
  }

  @Test
  public void testRemove() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    cacheStore.remove(1);

    verify(cachingTier, times(1)).invalidate(eq(1));
    verify(authoritativeTier, times(1)).remove(eq(1));
  }

  @Test
  public void testRemove2Args_removes() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.remove(eq(1), eq("one"))).thenReturn(true);

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.remove(1, "one"), is(true));

    verify(cachingTier, times(1)).invalidate(eq(1));
    verify(authoritativeTier, times(1)).remove(eq(1), eq("one"));
  }

  @Test
  public void testRemove2Args_doesNotRemove() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.remove(eq(1), eq("one"))).thenReturn(false);

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.remove(1, "one"), is(false));

    verify(cachingTier, times(0)).invalidate(any(Number.class));
    verify(authoritativeTier, times(1)).remove(eq(1), eq("one"));
  }

  @Test
  public void testReplace2Args_replaces() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.replace(eq(1), eq("one"))).thenReturn(newValueHolder("un"));

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.replace(1, "one").value(), Matchers.<CharSequence>equalTo("un"));

    verify(cachingTier, times(1)).invalidate(eq(1));
    verify(authoritativeTier, times(1)).replace(eq(1), eq("one"));
  }

  @Test
  public void testReplace2Args_doesNotReplace() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.replace(eq(1), eq("one"))).thenReturn(null);

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.replace(1, "one"), is(nullValue()));

    verify(cachingTier, times(0)).invalidate(any(Number.class));
    verify(authoritativeTier, times(1)).replace(eq(1), eq("one"));
  }

  @Test
  public void testReplace3Args_replaces() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.replace(eq(1), eq("un"), eq("one"))).thenReturn(true);

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.replace(1, "un", "one"), is(true));

    verify(cachingTier, times(1)).invalidate(eq(1));
    verify(authoritativeTier, times(1)).replace(eq(1), eq("un"), eq("one"));
  }

  @Test
  public void testReplace3Args_doesNotReplace() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.replace(eq(1), eq("un"), eq("one"))).thenReturn(false);

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.replace(1, "un", "one"), is(false));

    verify(cachingTier, times(0)).invalidate(any(Number.class));
    verify(authoritativeTier, times(1)).replace(eq(1), eq("un"), eq("one"));
  }

  @Test
  public void testClear() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    cacheStore.clear();

    verify(cachingTier, times(1)).invalidate();
    verify(authoritativeTier, times(1)).clear();
  }

  @Test
  public void testCompute2Args() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.compute(any(Number.class), any(BiFunction.class))).then(new Answer<Store.ValueHolder<CharSequence>>() {
      @Override
      public Store.ValueHolder<CharSequence> answer(InvocationOnMock invocation) throws Throwable {
        Number key = (Number) invocation.getArguments()[0];
        BiFunction<Number, CharSequence, CharSequence> function = (BiFunction<Number, CharSequence, CharSequence>) invocation.getArguments()[1];
        return newValueHolder(function.apply(key, null));
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.compute(1, new BiFunction<Number, CharSequence, CharSequence>() {
      @Override
      public CharSequence apply(Number number, CharSequence charSequence) {
        return "one";
      }
    }).value(), Matchers.<CharSequence>equalTo("one"));

    verify(cachingTier, times(1)).invalidate(any(Number.class));
    verify(authoritativeTier, times(1)).compute(eq(1), any(BiFunction.class));
  }

  @Test
  public void testCompute3Args() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.compute(any(Number.class), any(BiFunction.class), any(NullaryFunction.class))).then(new Answer<Store.ValueHolder<CharSequence>>() {
      @Override
      public Store.ValueHolder<CharSequence> answer(InvocationOnMock invocation) throws Throwable {
        Number key = (Number) invocation.getArguments()[0];
        BiFunction<Number, CharSequence, CharSequence> function = (BiFunction<Number, CharSequence, CharSequence>) invocation.getArguments()[1];
        return newValueHolder(function.apply(key, null));
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.compute(1, new BiFunction<Number, CharSequence, CharSequence>() {
      @Override
      public CharSequence apply(Number number, CharSequence charSequence) {
        return "one";
      }
    }, new NullaryFunction<Boolean>() {
      @Override
      public Boolean apply() {
        return true;
      }
    }).value(), Matchers.<CharSequence>equalTo("one"));

    verify(cachingTier, times(1)).invalidate(any(Number.class));
    verify(authoritativeTier, times(1)).compute(eq(1), any(BiFunction.class), any(NullaryFunction.class));
  }

  @Test
  public void testComputeIfAbsent_computes() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(cachingTier.getOrComputeIfAbsent(any(Number.class), any(Function.class))).thenAnswer(new Answer<Store.ValueHolder<CharSequence>>() {
      @Override
      public Store.ValueHolder<CharSequence> answer(InvocationOnMock invocation) throws Throwable {
        Number key = (Number) invocation.getArguments()[0];
        Function<Number, Store.ValueHolder<CharSequence>> function = (Function<Number, Store.ValueHolder<CharSequence>>) invocation.getArguments()[1];
        return function.apply(key);
      }
    });
    when(authoritativeTier.computeIfAbsentAndFault(any(Number.class), any(Function.class))).thenAnswer(new Answer<Store.ValueHolder<CharSequence>>() {
      @Override
      public Store.ValueHolder<CharSequence> answer(InvocationOnMock invocation) throws Throwable {
        Number key = (Number) invocation.getArguments()[0];
        Function<Number, CharSequence> function = (Function<Number, CharSequence>) invocation.getArguments()[1];
        return newValueHolder(function.apply(key));
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.computeIfAbsent(1, new Function<Number, CharSequence>() {
      @Override
      public CharSequence apply(Number number) {
        return "one";
      }
    }).value(), Matchers.<CharSequence>equalTo("one"));

    verify(cachingTier, times(1)).getOrComputeIfAbsent(eq(1), any(Function.class));
    verify(authoritativeTier, times(1)).computeIfAbsentAndFault(eq(1), any(Function.class));
  }

  @Test
  public void testComputeIfAbsent_doesNotCompute() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    final Store.ValueHolder<CharSequence> valueHolder = newValueHolder("one");
    when(cachingTier.getOrComputeIfAbsent(any(Number.class), any(Function.class))).thenAnswer(new Answer<Store.ValueHolder<CharSequence>>() {
      @Override
      public Store.ValueHolder<CharSequence> answer(InvocationOnMock invocation) throws Throwable {
        return valueHolder;
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.computeIfAbsent(1, new Function<Number, CharSequence>() {
      @Override
      public CharSequence apply(Number number) {
        return "one";
      }
    }).value(), Matchers.<CharSequence>equalTo("one"));

    verify(cachingTier, times(1)).getOrComputeIfAbsent(eq(1), any(Function.class));
    verify(authoritativeTier, times(0)).computeIfAbsentAndFault(eq(1), any(Function.class));
  }

  @Test
  public void testComputeIfPresent2Args() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.computeIfPresent(any(Number.class), any(BiFunction.class))).then(new Answer<Store.ValueHolder<CharSequence>>() {
      @Override
      public Store.ValueHolder<CharSequence> answer(InvocationOnMock invocation) throws Throwable {
        Number key = (Number) invocation.getArguments()[0];
        BiFunction<Number, CharSequence, CharSequence> function = (BiFunction<Number, CharSequence, CharSequence>) invocation.getArguments()[1];
        return newValueHolder(function.apply(key, null));
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.computeIfPresent(1, new BiFunction<Number, CharSequence, CharSequence>() {
      @Override
      public CharSequence apply(Number number, CharSequence charSequence) {
        return "one";
      }
    }).value(), Matchers.<CharSequence>equalTo("one"));

    verify(cachingTier, times(1)).invalidate(any(Number.class));
    verify(authoritativeTier, times(1)).computeIfPresent(eq(1), any(BiFunction.class));
  }

  @Test
  public void testComputeIfPresent3Args() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.computeIfPresent(any(Number.class), any(BiFunction.class), any(NullaryFunction.class))).then(new Answer<Store.ValueHolder<CharSequence>>() {
      @Override
      public Store.ValueHolder<CharSequence> answer(InvocationOnMock invocation) throws Throwable {
        Number key = (Number) invocation.getArguments()[0];
        BiFunction<Number, CharSequence, CharSequence> function = (BiFunction<Number, CharSequence, CharSequence>) invocation.getArguments()[1];
        return newValueHolder(function.apply(key, null));
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    assertThat(cacheStore.computeIfPresent(1, new BiFunction<Number, CharSequence, CharSequence>() {
      @Override
      public CharSequence apply(Number number, CharSequence charSequence) {
        return "one";
      }
    }, new NullaryFunction<Boolean>() {
      @Override
      public Boolean apply() {
        return true;
      }
    }).value(), Matchers.<CharSequence>equalTo("one"));

    verify(cachingTier, times(1)).invalidate(any(Number.class));
    verify(authoritativeTier, times(1)).computeIfPresent(eq(1), any(BiFunction.class), any(NullaryFunction.class));
  }

  @Test
  public void testBulkCompute2Args() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.bulkCompute(any(Set.class), any(Function.class))).thenAnswer(new Answer<Map<Number, Store.ValueHolder<CharSequence>>>() {
      @Override
      public Map<Number, Store.ValueHolder<CharSequence>> answer(InvocationOnMock invocation) throws Throwable {
        Set<Number> keys = (Set) invocation.getArguments()[0];
        Function<Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>, Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>> function = (Function<Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>, Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>>) invocation.getArguments()[1];

        List<Map.Entry<? extends Number, ? extends CharSequence>> functionArg = new ArrayList<Map.Entry<? extends Number, ? extends CharSequence>>();
        for (Number key : keys) {
          functionArg.add(newMapEntry(key, null));
        }

        Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>> functionResult = function.apply(functionArg);

        Map<Number, Store.ValueHolder<CharSequence>> result = new HashMap<Number, Store.ValueHolder<CharSequence>>();
        for (Map.Entry<? extends Number, ? extends CharSequence> entry : functionResult) {
         result.put(entry.getKey(), newValueHolder(entry.getValue()));
        }

        return result;
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    Map<Number, Store.ValueHolder<CharSequence>> result = cacheStore.bulkCompute(new HashSet<Number>(Arrays.asList(1, 2, 3)), new Function<Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>, Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>>() {
      @Override
      public Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>> apply(Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>> entries) {
        return new ArrayList<Map.Entry<? extends Number, ? extends CharSequence>>(Arrays.asList(newMapEntry(1, "one"), newMapEntry(2, "two"), newMapEntry(3, "three")));
      }
    });

    assertThat(result.size(), is(3));
    assertThat(result.get(1).value(), Matchers.<CharSequence>equalTo("one"));
    assertThat(result.get(2).value(), Matchers.<CharSequence>equalTo("two"));
    assertThat(result.get(3).value(), Matchers.<CharSequence>equalTo("three"));

    verify(cachingTier, times(1)).invalidate(1);
    verify(cachingTier, times(1)).invalidate(2);
    verify(cachingTier, times(1)).invalidate(3);
    verify(authoritativeTier, times(1)).bulkCompute(any(Set.class), any(Function.class));
  }

  @Test
  public void testBulkCompute3Args() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.bulkCompute(any(Set.class), any(Function.class), any(NullaryFunction.class))).thenAnswer(new Answer<Map<Number, Store.ValueHolder<CharSequence>>>() {
      @Override
      public Map<Number, Store.ValueHolder<CharSequence>> answer(InvocationOnMock invocation) throws Throwable {
        Set<Number> keys = (Set) invocation.getArguments()[0];
        Function<Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>, Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>> function = (Function<Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>, Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>>) invocation.getArguments()[1];

        List<Map.Entry<? extends Number, ? extends CharSequence>> functionArg = new ArrayList<Map.Entry<? extends Number, ? extends CharSequence>>();
        for (Number key : keys) {
          functionArg.add(newMapEntry(key, null));
        }

        Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>> functionResult = function.apply(functionArg);

        Map<Number, Store.ValueHolder<CharSequence>> result = new HashMap<Number, Store.ValueHolder<CharSequence>>();
        for (Map.Entry<? extends Number, ? extends CharSequence> entry : functionResult) {
          result.put(entry.getKey(), newValueHolder(entry.getValue()));
        }

        return result;
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    Map<Number, Store.ValueHolder<CharSequence>> result = cacheStore.bulkCompute(new HashSet<Number>(Arrays.asList(1, 2, 3)), new Function<Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>, Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>>() {
      @Override
      public Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>> apply(Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>> entries) {
        return new ArrayList<Map.Entry<? extends Number, ? extends CharSequence>>(Arrays.asList(newMapEntry(1, "one"), newMapEntry(2, "two"), newMapEntry(3, "three")));
      }
    }, new NullaryFunction<Boolean>() {
      @Override
      public Boolean apply() {
        return true;
      }
    });

    assertThat(result.size(), is(3));
    assertThat(result.get(1).value(), Matchers.<CharSequence>equalTo("one"));
    assertThat(result.get(2).value(), Matchers.<CharSequence>equalTo("two"));
    assertThat(result.get(3).value(), Matchers.<CharSequence>equalTo("three"));

    verify(cachingTier, times(1)).invalidate(1);
    verify(cachingTier, times(1)).invalidate(2);
    verify(cachingTier, times(1)).invalidate(3);
    verify(authoritativeTier, times(1)).bulkCompute(any(Set.class), any(Function.class), any(NullaryFunction.class));
  }

  @Test
  public void testBulkComputeIfAbsent() throws Exception {
    CachingTier<Number, CharSequence> cachingTier = mock(CachingTier.class);
    AuthoritativeTier<Number, CharSequence> authoritativeTier = mock(AuthoritativeTier.class);

    when(authoritativeTier.bulkComputeIfAbsent(any(Set.class), any(Function.class))).thenAnswer(new Answer<Map<Number, Store.ValueHolder<CharSequence>>>() {
      @Override
      public Map<Number, Store.ValueHolder<CharSequence>> answer(InvocationOnMock invocation) throws Throwable {
        Set<Number> keys = (Set) invocation.getArguments()[0];
        Function<Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>, Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>> function = (Function<Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>, Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>>) invocation.getArguments()[1];

        List<Map.Entry<? extends Number, ? extends CharSequence>> functionArg = new ArrayList<Map.Entry<? extends Number, ? extends CharSequence>>();
        for (Number key : keys) {
          functionArg.add(newMapEntry(key, null));
        }

        Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>> functionResult = function.apply(functionArg);

        Map<Number, Store.ValueHolder<CharSequence>> result = new HashMap<Number, Store.ValueHolder<CharSequence>>();
        for (Map.Entry<? extends Number, ? extends CharSequence> entry : functionResult) {
          result.put(entry.getKey(), newValueHolder(entry.getValue()));
        }

        return result;
      }
    });

    CacheStore<Number, CharSequence> cacheStore = new CacheStore<Number, CharSequence>(cachingTier, authoritativeTier);

    Map<Number, Store.ValueHolder<CharSequence>> result = cacheStore.bulkComputeIfAbsent(new HashSet<Number>(Arrays.asList(1, 2, 3)), new Function<Iterable<? extends Number>, Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>>>() {
      @Override
      public Iterable<? extends Map.Entry<? extends Number, ? extends CharSequence>> apply(Iterable<? extends Number> numbers) {
        return Arrays.asList(newMapEntry(1, "one"), newMapEntry(2, "two"), newMapEntry(3, "three"));
      }
    });

    assertThat(result.size(), is(3));
    assertThat(result.get(1).value(), Matchers.<CharSequence>equalTo("one"));
    assertThat(result.get(2).value(), Matchers.<CharSequence>equalTo("two"));
    assertThat(result.get(3).value(), Matchers.<CharSequence>equalTo("three"));

    verify(cachingTier, times(1)).invalidate(1);
    verify(cachingTier, times(1)).invalidate(2);
    verify(cachingTier, times(1)).invalidate(3);
    verify(authoritativeTier, times(1)).bulkComputeIfAbsent(any(Set.class), any(Function.class));
  }

  public Map.Entry<? extends Number, ? extends CharSequence> newMapEntry(Number key, CharSequence value) {
    return new AbstractMap.SimpleEntry<Number, CharSequence>(key, value);
  }

  public Store.ValueHolder<CharSequence> newValueHolder(final CharSequence v) {
    return new Store.ValueHolder<CharSequence>() {

      @Override
      public CharSequence value() {
        return v;
      }

      @Override
      public long creationTime(TimeUnit unit) {
        return 0;
      }

      @Override
      public long expirationTime(TimeUnit unit) {
        return 0;
      }

      @Override
      public boolean isExpired(long expirationTime, TimeUnit unit) {
        return false;
      }

      @Override
      public long lastAccessTime(TimeUnit unit) {
        return 0;
      }

      @Override
      public float hitRate(TimeUnit unit) {
        return 0;
      }

      @Override
      public long getId() {
        throw new UnsupportedOperationException("Implement me!");
      }
    };
  }

}


text:
from django import test
from django.conf import settings
from model_bakery import baker

from devilry.apps.core.models import Examiner, ExaminerAssignmentGroupHistory
from devilry.devilry_dbcache.customsql import AssignmentGroupDbCacheCustomSql

class TestExaminerTriggers(test.TestCase):
    def setUp(self):
        AssignmentGroupDbCacheCustomSql().initialize()

    def test_insert_history_model_is_created_when_examiner_is_created(self):
        baker.make('core.Examiner')
        self.assertEqual(ExaminerAssignmentGroupHistory.objects.count(), 1)

    def test_insert_history_models_created_fields(self):
        testgroup = baker.make('core.AssignmentGroup')
        testuser = baker.make(settings.AUTH_USER_MODEL)
        baker.make('core.Examiner',
                   assignmentgroup=testgroup,
                   relatedexaminer__user=testuser)
        self.assertEqual(ExaminerAssignmentGroupHistory.objects.count(), 1)
        history = ExaminerAssignmentGroupHistory.objects.get()
        self.assertEqual(history.assignment_group, testgroup)
        self.assertEqual(history.user, testuser)
        self.assertTrue(history.is_add)

    def test_insert_history_models_fields_multiple(self):
        testgroup1 = baker.make('core.AssignmentGroup')
        testuser1 = baker.make(settings.AUTH_USER_MODEL)
        baker.make('core.Examiner',
                   assignmentgroup=testgroup1,
                   relatedexaminer__user=testuser1)

        testgroup2 = baker.make('core.AssignmentGroup')
        testuser2 = baker.make(settings.AUTH_USER_MODEL)
        baker.make('core.Examiner',
                   assignmentgroup=testgroup2,
                   relatedexaminer__user=testuser2)

        self.assertEqual(ExaminerAssignmentGroupHistory.objects.count(), 2)

        history1 = ExaminerAssignmentGroupHistory.objects.get(assignment_group_id=testgroup1.id)
        history2 = ExaminerAssignmentGroupHistory.objects.get(assignment_group_id=testgroup2.id)

        self.assertEqual(history1.assignment_group, testgroup1)
        self.assertEqual(history1.user, testuser1)
        self.assertTrue(history1.is_add)

        self.assertEqual(history2.assignment_group, testgroup2)
        self.assertEqual(history2.user, testuser2)
        self.assertTrue(history2.is_add)

    def test_delete_history_model_is_created_when_examiner_is_created(self):
        baker.make('core.Examiner')
        Examiner.objects.get().delete()
        self.assertEqual(ExaminerAssignmentGroupHistory.objects.count(), 2)

    def test_delete_history_models_created_fields(self):
        testgroup = baker.make('core.AssignmentGroup')
        testuser = baker.make(settings.AUTH_USER_MODEL)
        baker.make('core.Examiner',
                   assignmentgroup=testgroup,
                   relatedexaminer__user=testuser)
        Examiner.objects.get().delete()
        self.assertEqual(ExaminerAssignmentGroupHistory.objects.count(), 2)

        history_created = ExaminerAssignmentGroupHistory.objects.filter(is_add=True).get()
        self.assertEqual(history_created.assignment_group, testgroup)
        self.assertEqual(history_created.user, testuser)
        self.assertTrue(history_created.is_add)

        history_deleted = ExaminerAssignmentGroupHistory.objects.filter(is_add=False).get()
        self.assertEqual(history_deleted.assignment_group, testgroup)
        self.assertEqual(history_deleted.user, testuser)
        self.assertFalse(history_deleted.is_add)

    def test_delete_history_models_fields_multiple(self):
        testgroup1 = baker.make('core.AssignmentGroup')
        testuser1 = baker.make(settings.AUTH_USER_MODEL)
        baker.make('core.Examiner',
                   assignmentgroup=testgroup1,
                   relatedexaminer__user=testuser1)

        testgroup2 = baker.make('core.AssignmentGroup')
        testuser2 = baker.make(settings.AUTH_USER_MODEL)
        baker.make('core.Examiner',
                   assignmentgroup=testgroup2,
                   relatedexaminer__user=testuser2)
        Examiner.objects.all().delete()
        self.assertEqual(ExaminerAssignmentGroupHistory.objects.count(), 4)

        # Test history1 create/delete history entries.
        history1_created = ExaminerAssignmentGroupHistory.objects.get(assignment_group_id=testgroup1.id, is_add=True)
        history1_deleted = ExaminerAssignmentGroupHistory.objects.get(assignment_group_id=testgroup1.id, is_add=False)

        self.assertEqual(history1_created.assignment_group, testgroup1)
        self.assertEqual(history1_created.user, testuser1)
        self.assertTrue(history1_created.is_add)

        self.assertEqual(history1_deleted.assignment_group, testgroup1)
        self.assertEqual(history1_deleted.user, testuser1)
        self.assertFalse(history1_deleted.is_add)

        # Test history2 create/delete history entries.
        history2_created = ExaminerAssignmentGroupHistory.objects.get(assignment_group_id=testgroup2.id, is_add=True)
        history2_deleted = ExaminerAssignmentGroupHistory.objects.get(assignment_group_id=testgroup2.id, is_add=False)
        self.assertEqual(history2_created.assignment_group, testgroup2)
        self.assertEqual(history2_created.user, testuser2)
        self.assertTrue(history2_created.is_add)

        self.assertEqual(history2_deleted.assignment_group, testgroup2)
        self.assertEqual(history2_deleted.user, testuser2)
        self.assertFalse(history2_deleted.is_add)

    def test_update_examiner_assignment_group_is_changed(self):
        testgroup = baker.make('core.AssignmentGroup')
        testgroup_updated_to = baker.make('core.AssignmentGroup')
        testuser = baker.make(settings.AUTH_USER_MODEL)
        examiner = baker.make('core.Examiner', assignmentgroup=testgroup, relatedexaminer__user=testuser)
        examiner.assignmentgroup = testgroup_updated_to
        examiner.save()
        self.assertEqual(ExaminerAssignmentGroupHistory.objects.count(), 3)

        history_entry_from_group = ExaminerAssignmentGroupHistory.objects.get(
            assignment_group_id=testgroup.id, is_add=False)
        self.assertEqual(history_entry_from_group.user, testuser)

        history_entry_to_group = ExaminerAssignmentGroupHistory.objects.get(
            assignment_group_id=testgroup_updated_to.id, is_add=True)
        self.assertEqual(history_entry_to_group.user, testuser)

    def test_update_examiner_assignment_group_multiple_changes(self):
        testgroup1 = baker.make('core.AssignmentGroup')
        testgroup2 = baker.make('core.AssignmentGroup')
        testgroup3 = baker.make('core.AssignmentGroup')
        testgroup4 = baker.make('core.AssignmentGroup')
        testuser = baker.make(settings.AUTH_USER_MODEL)
        examiner = baker.make('core.Examiner', assignmentgroup=testgroup1, relatedexaminer__user=testuser)
        examiner.assignmentgroup = testgroup2
        examiner.save()
        examiner.assignmentgroup = testgroup3
        examiner.save()
        examiner.assignmentgroup = testgroup4
        examiner.save()
        self.assertEqual(ExaminerAssignmentGroupHistory.objects.count(), 7)

    def test_assignment_group_is_deleted_ok(self):
        testgroup = baker.make('core.AssignmentGroup')
        baker.make('core.Examiner', assignmentgroup=testgroup)
        testgroup.delete()
        self.assertEqual(ExaminerAssignmentGroupHistory.objects.count(), 0)

    def test_relatedstudent_is_deleted_ok(self):
        testgroup = baker.make('core.AssignmentGroup')
        relatedexaminer = baker.make('core.RelatedExaminer')
        baker.make('core.Examiner', assignmentgroup=testgroup, relatedexaminer=relatedexaminer)
        relatedexaminer.delete()
        self.assertEqual(ExaminerAssignmentGroupHistory.objects.count(), 2)


text:
package br.edu.ifrn.helppet.validacao;

import br.edu.ifrn.helppet.dominio.Experiencia;
import br.edu.ifrn.helppet.dominio.Usuario;
import br.edu.ifrn.helppet.persistencia.PersistenciaGamb;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author camila
 */
public class ExperienciaVL {

    private final int tamanhoNome = 45;
    private final int tamanhoTexto = 5000;

    private final List<String> tipos = new ArrayList();
    PersistenciaGamb dao;

    // QUAIS OS TIPOS DE EXPERIÊNCIAS?
    public ExperienciaVL() {
        // Tipos válidos
        tipos.add("tipo1");
        tipos.add("tipo2");
        tipos.add("tipo3");
        tipos.add("outro");

        dao = new PersistenciaGamb();
    }

    public String cadastrarExperiencia(Experiencia e){
        if(validarTitulo(e).equals("OK")){
            if(validarTipo(e).equals("OK")){
                if(validarTexto(e).equals("OK")){
                    if(validarResponsavel(e).equals("OK")){
                        dao.cadastrarExperiencia(e);
                        return "Cadastrado com sucesso";
                    } else {
                        return validarResponsavel(e);
                    }
                } else {
                    return validarTexto(e);
                }
            } else {
                return validarTipo(e);
            }
        }else {
            return validarTitulo(e);
        }
    }

    private String validarTitulo(Experiencia e) {
        if (e.getTitulo() != null) {
            String palavraSemEspaco = e.getTitulo().trim();
            if (!e.getTitulo().isEmpty() && (palavraSemEspaco.length() != 0)) {
                if (e.getTitulo().length() < tamanhoNome) {
                    return "OK";
                } else {
                    return "Título muito grande";
                }
            } else {
                return "Informe um título válido";
            }
        } else {
            return "Título da experiência é um campo obrigatório";
        }
    }

    private String validarTipo(Experiencia e) {
        if (e.getTipo() != null) {
            if (!e.getTipo().isEmpty()) {
                if (tipos.contains(e.getTipo())) {
                    return "OK";
                } else {
                    return "Tipo inválido";
                }
            } else {
                return "Tipo inválido";
            }
        } else {
            return "Tipo inválido";
        }
    }

    private String validarTexto(Experiencia e) {
        if (e.getTexto() != null) {
            String palavraSemEspaco = e.getTexto().trim();
            if (!e.getTexto().isEmpty() && (palavraSemEspaco.length() != 0)) {
                if (e.getTitulo().length() < tamanhoTexto) {
                    return "OK";
                } else {
                    return "Texto muito grande";
                }
            } else {
                return "Informe um texto válido";
            }
        } else {
            return "O texto é um campo obrigatório";
        }
    }

    private String validarResponsavel(Experiencia e) {

        if (e.getUsuario() != null) {
            if (dao.ListarUsuarios().contains(e.getUsuario())) {
                if (e.getUsuario().getNome() != null) {
                    if (e.getUsuario().getEmail() != null) {
                        return "OK";

                    } else {
                        return "E-mail do usuário não pode ser nulo.";
                    }
                } else {
                    return "Nome do usuário não pode ser nulo";
                }
            } else {
                return "Responsável não cadastrado";
            }
        } else {
            return "A experiência tem que ter um responsável";
        }
    }

    public String editarExperiencia(Experiencia e){
        if(validarTitulo(e).equals("OK")){
            if(validarTipo(e).equals("OK")){
                if(validarTexto(e).equals("OK")){

                        dao.editarExperiencia(e);
                        return "Editado com sucesso";

                } else {
                    return validarTexto(e);
                }
            } else {
                return validarTipo(e);
            }
        }else {
            return validarTitulo(e);
        }
    }

    public String excluirExperiencia(Experiencia experiencia, Usuario usuario) {
        for (Usuario u : dao.ListarUsuarios()) {
            if (u.equals(usuario)) {
                for (Experiencia e : dao.ListarExperiencias()) {
                    if (e.equals(experiencia)) {
                        if (e.getUsuario().equals(usuario)) {
                            dao.excluirExperiencia(experiencia);
                            return "Experiência excluída";
                        }
                    }
                }
            }
        }
        return "Experiência não encontrado";

    }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annls mycol. 15(5): 371 (1917)

#### Original name
Aulographum anaxaeum Sacc. & D. Sacc.

### Remarks
null


text:
SamdaNet::SamdaNet()
	: ioMultiplexer(nullptr)
	, sessionManager(nullptr)
	, dbManager(nullptr)
	, networkThread(nullptr)
	, mainThread(nullptr)
	, dbThread(nullptr)
	, acceptorManager(nullptr)
	, messageQueue(nullptr)
	, timerQueue(nullptr)
	, initialized(false)
	, running(false)
{
	Init();
}

SamdaNet::~SamdaNet()
{
	Stop();

	Close();
}

bool SamdaNet::Init()
{
	if (initialized == true)
		return false;

#ifdef _WINDOWS
	WSADATA WSAData;
	if (WSAStartup(MAKEWORD(2, 0), &WSAData) != 0)
		return false;
#endif

	// DB󸮸¦ ´ã´çÇÒ DB ½º·¹µå »ý¼º
	dbThread = new DBThread(*this);

	// IO¸¦ ´ã´çÇÒ ³×Æ®¿öÅ© ½º·¹µå »ý¼º (Worker Thread)
	networkThread = new NetworkThread(*this);

	// ÆÐŶÀ» ó¸®ÇÒ ¸ÞÀνº·¹µå(Logic Thread) »ý¼º
	mainThread = new MainThread(*this);

	// IO°´Ã¼ »ý¼º
	ioMultiplexer = new IOMultiplexer();
	if (ioMultiplexer->create() == false)
		return false;

	// DB¿¬°áÀ» °ü¸®ÇÏ´Â ¸Å´ÏÀú »ý¼º
	dbManager = new DBManager;

	// ¿¬°áµÈ ¼¼¼ÇµéÀ» °ü¸®Çϱâ À§ÇÑ ¼¼¼Ç ¸Å´ÏÀú »ý¼º
	sessionManager = new SessionManager(*this);

	// ¿©·¯°³ÀÇ port¸¦ ¿±âÀ§ÇÑ accept ¸Å´ÏÀú »ý¼º (ÀÏ¹Ý ¼¹ö´Â 1°³¸¸ »ç¿ë)
	acceptorManager = new AcceptorManager(ioMultiplexer, sessionManager);

	// ÆÐŶÀ» ´ã¾Æ³õÀ» Å¥ ¸Å´ÏÀú »ý¼º
	messageQueue = new MessageQueue();

	// ŸÀ̸Ӹ¦ ´ã¾Æ³õÀº Å¥ »ý¼º
	timerQueue = new TimerQueue();

	// ÃʱâÈ ¿Ï·á
	initialized = true;

	return true;
}

void SamdaNet::Close()
{
	SAFE_DELETE(dbManager);
	SAFE_DELETE(acceptorManager);
	SAFE_DELETE(dbThread);
	SAFE_DELETE(mainThread);
	SAFE_DELETE(networkThread);
	SAFE_DELETE(sessionManager);
	SAFE_DELETE(messageQueue);
	SAFE_DELETE(timerQueue);
	SAFE_DELETE(ioMultiplexer);

#ifdef _WINDOWS
	WSACleanup();
#endif
}

SessionManager* SamdaNet::GetSessionManager()
{
	return sessionManager;
}

MessageQueue* SamdaNet::GetMessageQueue()
{
	return messageQueue;
}

TimerQueue* SamdaNet::GetTimerQueue()
{
	return timerQueue;
}

IOMultiplexer* SamdaNet::GetIOMultiplexer()
{
	return ioMultiplexer;
}

DBManager* SamdaNet::GetDBManager()
{
	return dbManager;
}

bool SamdaNet::Start()
{
	// µ¿ÀÛÇ÷¡±×¸¦ ÄÑ°í, ÇÊ¿äÇÑ ½º·¹µå¸¦ µ¿ÀÛ½ÃŲ´Ù
	SetRunning(true);

	mainThread->Start();

	networkThread->Start();

	dbThread->Start();

	return true;
}

void SamdaNet::Stop()
{
	networkThread->Stop();

	mainThread->Stop();

	// µ¿ÀÛÇ÷¡±× OFF
	SetRunning(false);
}

void SamdaNet::SetRunning(bool flag)
{
	LockGuard<Mutex> lock(runningSync);

	running = flag;
}

bool SamdaNet::IsRunning()
{
	LockGuard<Mutex> lock(runningSync);

	return running;
}

void SamdaNet::SetDBDispatcher(IDBDispatcher* disp)
{
	dbThread->SetDBDispatcher(disp);
}

void SamdaNet::SetInterDispatcher(IInterDispatcher* disp)
{
	mainThread->SetInterDispatcher(disp);
}

void SamdaNet::SetTimerDispatcher(ITimerDispatcher* disp)
{
	mainThread->SetTimerDispatcher(disp);
}

bool SamdaNet::Open(const wchar_t* ip, unsigned short port, IDispatcher* disp)
{
	Acceptor* acceptor = acceptorManager->create(disp);
	if (acceptor->Open(ip, port) == false)
		return false;

	return true;
}

bool SamdaNet::Connect(const wchar_t* ip, unsigned short port, IDispatcher* disp)
{
	return true;
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<project name="symplate" default="phpunit" basedir=".">
    <property environment="env"/>
    <target name="prepare" depends="vendors" description="Prepares tests">
    </target>
    <target name="vendors" description="Install dependencies">
        <exec executable="wget" failonerror="true">
            <arg value="-nc" />
            <arg value="http://getcomposer.org/composer.phar" />
        </exec>

        <exec executable="php" failonerror="true">
            <arg value="composer.phar" />
            <arg value="install" />
        </exec>
        <exec executable="php" failonerror="true">
            <arg value="app/console" />
            <arg value="assetic:dump" />
        </exec>
        <exec executable="php" failonerror="true">
            <arg value="app/console" />
            <arg value="fos:js-routing:dump" />
        </exec>
        <exec executable="php" failonerror="false">
            <arg value="app/console" />
            <arg value="doctrine:schema:create" />
        </exec>
        <exec executable="php" failonerror="false">
            <arg value="app/console" />
            <arg value="doctrine:migrations:migrate --no-interaction" />
        </exec>

    </target>
</project>


text:
package org.sakaiproject.component.app.scheduler;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sakaiproject.api.app.scheduler.DelayedInvocation;
import org.sakaiproject.db.api.SqlReader;

/**
 * An SQLReader so we can get the info out of the DB reasonably
 *
 * @author Aaron Zeckoski (aaronz@vt.edu)
 */
public class DelayedInvocationReader implements SqlReader {

	private static final Logger LOG = LoggerFactory.getLogger(DelayedInvocationReader.class);

	public Object readSqlResultRecord(ResultSet result) {

		DelayedInvocation invocation = new DelayedInvocation();

		try {
			invocation.uuid = result.getString("INVOCATION_ID");
			invocation.date = result.getTimestamp("INVOCATION_TIME");
			invocation.componentId = result.getString("COMPONENT");
			invocation.contextId = result.getString("CONTEXT");
		} catch (SQLException e) {
			LOG.error("SqlException: " + e);
			return null;
		}

		return invocation;
	}

}