text:
module Arqivarius
  class BlobKey
    def initialize(sha1, storage_type, stretch_encryption_key, compressed, archive_id = nil, archive_size = 0, archive_uploaded_date = nil)
      @sha1 = sha1
      @storage_type = storage_type
      @stretch_encryption_key = stretch_encryption_key
      @compressed = compressed
      @archive_id = archive_id
      @archive_size = archive_size
      @archive_uploaded_date = archive_uploaded_date
    end

    attr_reader :sha1, :stretch_encryption_key, :compressed, :storage_type

    def ==(other)
      other.sha1 == @sha1 && other.stretch_encryption_key = @stretch_encryption_key
    end
  end
end


text:
<!-- .slide: data-background="../img/products/cloudbees.png" data-background-size="contain" -->

# CloudBees

---

* Leaders in the CI\CD space<!-- .element: class="fragment" -->
* 60% marketplace<!-- .element: class="fragment" -->
* Committed to DevOps<!-- .element: class="fragment" -->
* Jenkins created by CTO, KK<!-- .element: class="fragment" -->
* DevOps World | Jenkins World<!-- .element: class="fragment" -->
* Certifications<!-- .element: class="fragment" -->

redpajama_set_name: RedPajamaGithub


text:
type pbtsCallback = (err: Error|null, output?: string) => void;

/**
 * Runs pbts programmatically.
 * @param {string[]} args Command line arguments
 * @param {function(?Error, string=)} [callback] Optional completion callback
 * @returns {number|undefined} Exit code, if known
 */
export function main(args: string[], callback?: pbtsCallback): number|undefined;


text:
package com.example.android.pmovies.adapters;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.android.pmovies.R;
import com.example.android.pmovies.tools.Movie;
import com.squareup.picasso.Picasso;

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

/**
 * Created by ref on 8/5/2017.
 */

public class MovieAdapter extends ArrayAdapter<Movie> {

    private final List<Movie>  mMovies;

    public MovieAdapter(Context context, List<Movie> movies) {
        super(context, 0, movies);
        mMovies = movies;
    }

    @NonNull
    public View getView(int position, View convertView, @NonNull ViewGroup parent) {
        Movie movie = getItem(position);

        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.recyclerview_item, parent, false);
        }

        ImageView moviePoster = (ImageView) convertView.findViewById(R.id.movie_image);
        if (movie != null) {
            Picasso.with(getContext()).load(movie.getImageFullURL()).placeholder(R.mipmap.ic_autorenew_black_24dp).error(R.mipmap.ic_warning_black_24dp).into(moviePoster);
        }

        return convertView;
    }

    public List<Movie>  getMovies() {
        return mMovies;
    }
}


text:
package org.jboss.weld.tests.bridge.methods;

import java.util.concurrent.atomic.AtomicInteger;

import javax.enterprise.event.Observes;

public class CharlieObserver implements BasicObserver<Bar> {

    static final AtomicInteger OBSERVATIONS = new AtomicInteger(0);

    // Generic parameter
    @Override
    public void on(@Observes Bar event) {
        OBSERVATIONS.incrementAndGet();
    }

}


text:
title: "home"
bg: corporate_blue     #defined in _config.yml, can use html color like '#010101'
color: white  #text color
style: left
---

Welcome to **LSDTopoTools**. This software was developed by members of the [Land Surface
Dynamics (LSD) research group](http://www.geos.ed.ac.uk/geosciences/research/research-institutes/global-change/land-surface-dynamics) at the [University of Edinburgh](http://www.ed.ac.uk/).

The software aims to operate:

* As a framework for implementing the latest developments in topographic analysis.
* As a framework for developing new topographic analysis techniques.
* As a framework for numerical modelling of landscapes.
* To improve the speed and performance of topographic analysis versus other tools (e.g., commercial GIS software).
* To enable **reproducible** topographic analysis in the research context.

This software is constantly used for research and is regularly updated with new routines. Some
popular techniques already implemented include:

* [Basic topographic analysis](https://github.com/LSDtopotools/LSDTopoTools_AnalysisDriver)
* [Channel network extraction from LiDAR data](https://github.com/LSDtopotools/LSDTopoTools_ChannelExtraction)
* [Chi analysis](https://github.com/LSDtopotools/LSDTopoTools_ChiMudd2014)
* [Calculation of erosion rates from cosmogenic nuclides](https://github.com/LSDtopotools/LSDTopoTools_CRNBasinwide)
* [Hilltop flow routing, and hillslope relief metrics](https://github.com/LSDtopotools/LSDTT_Hillslope_Analysis)
* [Topographic extraction of floodplains and terraces](https://github.com/LSDtopotools/LSDTopoTools_FloodplainTerraceExtraction)

For an overview of some of the features of LSDTopoTools, see this poster, presented at the [2015 BSG Conference](http://geomorphology.org.uk/annual_general_meetings):


text:
<!DOCTYPE html>

<form method="post">
    Username: <input type="text" name="username" placeholder="Enter username" value="{{request.form.username}}" required/>

    Password: <input type="password" name="password" placeholder="Enter password" required/>

    First name: <input type="text" name="first_name" placeholder="Enter first name" value="{{request.form.last_name}}" required/>

    Last name: <input type="text" name="last_name" placeholder="Enter last name" value="{{request.form.last_name}}" required/>

    Address: <input type="text" name="address" placeholder="Enter address" value="{{request.form.address}}" required/>
    <input type="submit" value="Register"/>

</form>

{% if error %}
    {{error}}
{% endif %}

{% if message %}
    {{message}}
{% endif %}


text:
using System.Threading;
using Moq;
using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.PropertyEditors.Validators;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
using Umbraco.Cms.Infrastructure.Serialization;

namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Infrastructure.Services;

[TestFixture]
public class PropertyValidationServiceTests
{
    private IShortStringHelper ShortStringHelper => new DefaultShortStringHelper(new DefaultShortStringHelperConfig());

    private void MockObjects(out PropertyValidationService validationService, out IDataType dt)
    {
        var textService = new Mock<ILocalizedTextService>();
        textService.Setup(x =>
                x.Localize(It.IsAny<string>(), It.IsAny<string>(), Thread.CurrentThread.CurrentCulture, null))
            .Returns("Localized text");

        var dataTypeService = new Mock<IDataTypeService>();
        var dataType = Mock.Of<IDataType>(
            x => x.Configuration == string.Empty // irrelevant but needs a value
                 && x.DatabaseType == ValueStorageType.Nvarchar
                 && x.EditorAlias == Constants.PropertyEditors.Aliases.TextBox);
        dataTypeService.Setup(x => x.GetDataType(It.IsAny<int>())).Returns(() => dataType);
        dt = dataType;

        // new data editor that returns a TextOnlyValueEditor which will do the validation for the properties
        var dataEditor = Mock.Of<IDataEditor>(
            x => x.Type == EditorType.PropertyValue
                 && x.Alias == Constants.PropertyEditors.Aliases.TextBox);
        Mock.Get(dataEditor).Setup(x => x.GetValueEditor(It.IsAny<object>()))
            .Returns(new CustomTextOnlyValueEditor(
                new DataEditorAttribute(Constants.PropertyEditors.Aliases.TextBox, "Test Textbox", "textbox"),
                textService.Object,
                Mock.Of<IShortStringHelper>(),
                new JsonNetSerializer(),
                Mock.Of<IIOHelper>()));

        var propEditors = new PropertyEditorCollection(new DataEditorCollection(() => new[] { dataEditor }));

        validationService = new PropertyValidationService(propEditors, dataTypeService.Object, Mock.Of<ILocalizedTextService>(), new ValueEditorCache());
    }

    [Test]
    public void Validate_Invariant_Properties_On_Variant_Default_Culture()
    {
        MockObjects(out var validationService, out var dataType);

        var p1 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test1")
            {
                Mandatory = true,
                Variations = ContentVariation.Culture,
            });
        p1.SetValue("Hello", "en-US");
        var p2 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test2")
            {
                Mandatory = true,
                Variations = ContentVariation.Nothing,
            });
        p2.SetValue("Hello");
        var p3 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test3")
            {
                Mandatory = true,
                Variations = ContentVariation.Culture,
            });
        p3.SetValue(null, "en-US"); // invalid
        var p4 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test4")
            {
                Mandatory = true,
                Variations = ContentVariation.Nothing,
            });
        p4.SetValue(null); // invalid

        var content = Mock.Of<IContent>(
            x => x.Published == true // set to published, the default culture will validate invariant anyways
                 && x.Properties == new PropertyCollection(new[] { p1, p2, p3, p4 }));

        var result =
            validationService.IsPropertyDataValid(content, out var invalid, CultureImpact.Explicit("en-US", true));

        Assert.IsFalse(result);
        Assert.AreEqual(2, invalid.Length);
    }

    [Test]
    public void Validate_Invariant_Properties_On_Variant_Non_Default_Culture()
    {
        MockObjects(out var validationService, out var dataType);

        var p1 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test1")
            {
                Mandatory = true,
                Variations = ContentVariation.Culture,
            });
        p1.SetValue("Hello", "en-US");
        var p2 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test2")
            {
                Mandatory = true,
                Variations = ContentVariation.Nothing,
            });
        p2.SetValue("Hello");
        var p3 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test3")
            {
                Mandatory = true,
                Variations = ContentVariation.Culture,
            });
        p3.SetValue(null, "en-US"); // invalid
        var p4 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test4")
            {
                Mandatory = true,
                Variations = ContentVariation.Nothing,
            });
        p4.SetValue(null); // invalid

        var content = Mock.Of<IContent>(
            x =>
                x.Published ==
                false // set to not published, the non default culture will need to validate invariant too
                && x.Properties == new PropertyCollection(new[] { p1, p2, p3, p4 }));

        var result =
            validationService.IsPropertyDataValid(content, out var invalid, CultureImpact.Explicit("en-US", false));

        Assert.IsFalse(result);
        Assert.AreEqual(2, invalid.Length);
    }

    [Test]
    public void Validate_Variant_Properties_On_Variant()
    {
        MockObjects(out var validationService, out var dataType);

        var p1 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test1")
            {
                Mandatory = true,
                Variations = ContentVariation.Culture,
            });
        p1.SetValue(null, "en-US"); // invalid
        var p2 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test2")
            {
                Mandatory = true,
                Variations = ContentVariation.Nothing,
            });
        p2.SetValue(null); // invalid
        var p3 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test3")
            {
                Mandatory = true,
                Variations = ContentVariation.Culture,
            });
        p3.SetValue(null, "en-US"); // ignored because the impact isn't the default lang + the content is published
        var p4 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test4")
            {
                Mandatory = true,
                Variations = ContentVariation.Nothing,
            });
        p4.SetValue(null); // ignored because the impact isn't the default lang + the content is published

        var content = Mock.Of<IContent>(
            x => x.Published == true // set to published
                 && x.Properties == new PropertyCollection(new[] { p1, p2, p3, p4 }));

        var result =
            validationService.IsPropertyDataValid(content, out var invalid, CultureImpact.Explicit("en-US", false));

        Assert.IsFalse(result);
        Assert.AreEqual(2, invalid.Length);
    }

    [Test]
    public void Validate_Invariant_Properties_On_Invariant()
    {
        MockObjects(out var validationService, out var dataType);

        var p1 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test1")
            {
                Mandatory = true,
                Variations = ContentVariation.Culture,
            });
        p1.SetValue(null, "en-US"); // ignored since this is variant
        var p2 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test2")
            {
                Mandatory = true,
                Variations = ContentVariation.Nothing,
            });
        p2.SetValue(null); // invalid
        var p3 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test3")
            {
                Mandatory = true,
                Variations = ContentVariation.Culture,
            });
        p3.SetValue("Hello", "en-US"); // ignored since this is variant
        var p4 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test4")
            {
                Mandatory = true,
                Variations = ContentVariation.Nothing,
            });
        p4.SetValue(null); // invalid

        var content = Mock.Of<IContent>(
            x => x.Properties == new PropertyCollection(new[] { p1, p2, p3, p4 }));

        var result = validationService.IsPropertyDataValid(content, out var invalid, CultureImpact.Invariant);

        Assert.IsFalse(result);
        Assert.AreEqual(2, invalid.Length);
    }

    [Test]
    public void Validate_Properties_On_All()
    {
        MockObjects(out var validationService, out var dataType);

        var p1 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test1")
            {
                Mandatory = true,
                Variations = ContentVariation.Culture,
            });
        p1.SetValue(null, "en-US"); // invalid
        var p2 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test2")
            {
                Mandatory = true,
                Variations = ContentVariation.Nothing,
            });
        p2.SetValue(null); // invalid
        var p3 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test3")
            {
                Mandatory = true,
                Variations = ContentVariation.Culture,
            });
        p3.SetValue(null, "en-US"); // invalid
        var p4 = new Property(
            new PropertyType(ShortStringHelper, dataType, "test4")
            {
                Mandatory = true,
                Variations = ContentVariation.Nothing,
            });
        p4.SetValue(null); // invalid

        var content = Mock.Of<IContent>(
            x => x.Properties == new PropertyCollection(new[] { p1, p2, p3, p4 }));

        var result = validationService.IsPropertyDataValid(content, out var invalid, CultureImpact.All);

        Assert.IsFalse(result);
        Assert.AreEqual(4, invalid.Length);
    }

    // used so we can inject a mock - we should fix the base class DataValueEditor to be able to have the ILocalizedTextField passed
    // in to create the Requried and Regex validators so we aren't using singletons
    private class CustomTextOnlyValueEditor : TextOnlyValueEditor
    {
        private readonly ILocalizedTextService _textService;

        public CustomTextOnlyValueEditor(
            DataEditorAttribute attribute,
            ILocalizedTextService textService,
            IShortStringHelper shortStringHelper,
            IJsonSerializer jsonSerializer,
            IIOHelper ioHelper)
            : base(attribute, textService, shortStringHelper, jsonSerializer, ioHelper) => _textService = textService;

        public override IValueRequiredValidator RequiredValidator => new RequiredValidator(_textService);

        public override IValueFormatValidator FormatValidator => new RegexValidator(_textService, null);
    }
}


text:
package org.apache.harmony.test.func.api.java.beans.introspector.surveymethods.methods;

import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.MethodDescriptor;

import org.apache.harmony.share.MultiCase;
import org.apache.harmony.share.Result;

/**
 * Under test: Introspector, MethodDescriptor, FeatureDescriptor.
 * <p>
 * Purpose: verify that Introspector correctly introspects methods in a bean and
 * returns only public methods of a bean.
 *
 * @see java.beans.BeanInfo#getMethodDescriptors()
 */
public class MethodsTest extends MultiCase {
    MethodDescriptor[] methodDescriptors;

    public static void main(String[] args) {
        System.exit(new MethodsTest().test(args));
    }

    protected void setUp() throws IntrospectionException {
        methodDescriptors = Introspector.getBeanInfo(Bean1.class)
            .getMethodDescriptors();
    }

    /**
     * Verify that Introspector doesn't return protected method.
     */
    public Result testProtectedMethod() {
        if (findMethod("f1") != -1) {
            return failed("Introspector have not to return protected method f1()");
        }
        return passed();
    }

    /**
     * Verify that Introspector doesn't return package protected method.
     */
    public Result testMethodWithoutIndentificator() {
        if (findMethod("f2") != -1) {
            return failed("Introspector have not to return package protected method f2()");
        }
        return passed();
    }

    /**
     * Verify that Introspector returns public method.
     */
    public Result testPublicMethod() {
        if (findMethod("ggetI") == -1) {
            return failed("Introspecor have to return public method ggetI");
        }
        return passed();
    }

    /**
     * Verify that Introspector doesn't return private method.
     */
    public Result testPrivateMethod() {
        if (findMethod("setProperty9") != -1) {
            return failed("Introspector have not to return private method setProperty9()");
        }
        return passed();
    }

    private int findMethod(String name) {
        for (int i = 0; i < methodDescriptors.length; i++) {
            if (methodDescriptors[i].getName().equals(name)) {
                return i;
            }
        }
        return -1;
    }

    /**
     * Verify that Introspector finds all public methods.
     */
    public Result testReturnedMethods() {
        assertTrue(findMethod("getProperty8") != -1);
        assertTrue(findMethod("setProperty8") != -1);
        assertTrue(findMethod("removeFredListener") != -1);
        assertTrue(findMethod("addFredListener") != -1);
        assertTrue(findMethod("ssetI") != -1);
        assertTrue(findMethod("ggetI") != -1);
        assertTrue(findMethod("getClass") != -1);
        assertTrue(findMethod("equals") != -1);
        assertTrue(findMethod("hashCode") != -1);
        assertTrue(findMethod("notify") != -1);
        assertTrue(findMethod("notifyAll") != -1);
        assertTrue(findMethod("toString") != -1);
        assertTrue(findMethod("wait") != -1);
        // There are 3 wait methods in Object class.
        assertEquals(methodDescriptors.length, 15);
        return passed();
    }
}


text:
package android.content.res;

import com.android.ide.common.rendering.api.ResourceReference;
import com.android.ide.common.rendering.api.StyleResourceValue;
import com.android.layoutlib.bridge.android.BridgeContext;
import com.android.layoutlib.bridge.impl.DelegateManager;
import com.android.layoutlib.bridge.impl.RenderSessionImpl;
import com.android.resources.ResourceType;
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;

import android.annotation.Nullable;
import android.content.res.Resources.NotFoundException;
import android.content.res.Resources.Theme;
import android.content.res.Resources.ThemeKey;
import android.util.AttributeSet;
import android.util.TypedValue;

/**
 * Delegate used to provide new implementation of a select few methods of {@link Resources.Theme}
 *
 * Through the layoutlib_create tool, the original  methods of Theme have been replaced
 * by calls to methods of the same name in this delegate class.
 *
 */
public class Resources_Theme_Delegate {

    // ---- delegate manager ----

    private static final DelegateManager<Resources_Theme_Delegate> sManager =
            new DelegateManager<Resources_Theme_Delegate>(Resources_Theme_Delegate.class);

    public static DelegateManager<Resources_Theme_Delegate> getDelegateManager() {
        return sManager;
    }

    // ---- delegate methods. ----

    @LayoutlibDelegate
    /*package*/ static TypedArray obtainStyledAttributes(
            Resources thisResources, Theme thisTheme,
            int[] attrs) {
        boolean changed = setupResources(thisTheme);
        BridgeTypedArray ta = RenderSessionImpl.getCurrentContext().obtainStyledAttributes(attrs);
        ta.setTheme(thisTheme);
        restoreResources(changed);
        return ta;
    }

    @LayoutlibDelegate
    /*package*/ static TypedArray obtainStyledAttributes(
            Resources thisResources, Theme thisTheme,
            int resid, int[] attrs)
            throws NotFoundException {
        boolean changed = setupResources(thisTheme);
        BridgeTypedArray ta = RenderSessionImpl.getCurrentContext().obtainStyledAttributes(resid,
                attrs);
        ta.setTheme(thisTheme);
        restoreResources(changed);
        return ta;
    }

    @LayoutlibDelegate
    /*package*/ static TypedArray obtainStyledAttributes(
            Resources thisResources, Theme thisTheme,
            AttributeSet set, int[] attrs, int defStyleAttr, int defStyleRes) {
        boolean changed = setupResources(thisTheme);
        BridgeTypedArray ta = RenderSessionImpl.getCurrentContext().obtainStyledAttributes(set,
                attrs, defStyleAttr, defStyleRes);
        ta.setTheme(thisTheme);
        restoreResources(changed);
        return ta;
    }

    @LayoutlibDelegate
    /*package*/ static boolean resolveAttribute(
            Resources thisResources, Theme thisTheme,
            int resid, TypedValue outValue,
            boolean resolveRefs) {
        boolean changed = setupResources(thisTheme);
        boolean found =  RenderSessionImpl.getCurrentContext().resolveThemeAttribute(resid,
                outValue, resolveRefs);
        restoreResources(changed);
        return found;
    }

    @LayoutlibDelegate
    /*package*/ static TypedArray resolveAttributes(Resources thisResources, Theme thisTheme,
            int[] values, int[] attrs) {
        // FIXME
        return null;
    }

    // ---- private helper methods ----

    private static boolean setupResources(Theme thisTheme) {
        // Key is a space-separated list of theme ids applied that have been merged into the
        // BridgeContext's theme to make thisTheme.
        final ThemeKey key = thisTheme.getKey();
        final int[] resId = key.mResId;
        final boolean[] force = key.mForce;

        boolean changed = false;
        for (int i = 0, N = key.mCount; i < N; i++) {
            StyleResourceValue style = resolveStyle(resId[i]);
            if (style != null) {
                RenderSessionImpl.getCurrentContext().getRenderResources().applyStyle(
                        style, force[i]);
                changed = true;
            }

        }
        return changed;
    }

    private static void restoreResources(boolean changed) {
        if (changed) {
            RenderSessionImpl.getCurrentContext().getRenderResources().clearStyles();
        }
    }

    @Nullable
    private static StyleResourceValue resolveStyle(int nativeResid) {
        if (nativeResid == 0) {
            return null;
        }
        BridgeContext context = RenderSessionImpl.getCurrentContext();
        ResourceReference theme = context.resolveId(nativeResid);
        if (theme.isFramework()) {
            return (StyleResourceValue) context.getRenderResources()
                    .getFrameworkResource(ResourceType.STYLE, theme.getName());
        } else {
            return (StyleResourceValue) context.getRenderResources()
                    .getProjectResource(ResourceType.STYLE, theme.getName());
        }
    }
}


text:
module SeedList
  class Engine < ::Rails::Engine
    isolate_namespace SeedList
  end
end


text:
const demand = require('must')

const Wemo = require('../index.js')
const WemoClient = require('../client.js')

/* eslint-env mocha */
describe('Lights', function () {
  const wemo = new Wemo()
  let dimmableLight
  let colorLight

  before(function (done) {
    this.timeout(10000)
    let complete = done
    wemo.discover(function (deviceInfo) {
      if (deviceInfo.deviceType === Wemo.DEVICE_TYPE.Bridge) {
        const client = this.client(deviceInfo)
        client.getEndDevices(function (err, endDevices) {
          if (!err) {
            endDevices.forEach(function (endDevice) {
              if (endDevice.deviceType === 'dimmableLight') {
                dimmableLight = {
                  deviceInfo: deviceInfo,
                  endDevice: endDevice
                }
              }
              if (endDevice.deviceType === 'colorLight') {
                colorLight = {
                  deviceInfo: deviceInfo,
                  endDevice: endDevice
                }
              }
            })
            complete()
            complete = function () {}
          }
        })
      }
    })
  })

  describe('Dimmable Light', function () {
    let client
    let deviceId
    let initialState

    before(function (done) {
      if (!dimmableLight) this.skip()
      client = wemo.client(dimmableLight.deviceInfo)
      deviceId = dimmableLight.endDevice.deviceId
      client.getDeviceStatus(deviceId, function (err, deviceStatus) {
        demand(err).to.be.falsy()
        initialState = deviceStatus
        done()
      })
    })

    it('should be dimmable', function (done) {
      const value = Math.floor(Math.random() * 255)
      client.setDeviceStatus(deviceId, 10008, value + ':0', function () {
        client.getDeviceStatus(deviceId, function (err, deviceStatus) {
          demand(err).to.be.falsy()
          deviceStatus.must.have.property('10008', value + ':0')
          done()
        })
      })
    })

    it('should turn on and off', function (done) {
      const value = (initialState['10006'][0] === '1') ? '0' : '1'
      client.setDeviceStatus(deviceId, 10006, value, function () {
        client.getDeviceStatus(deviceId, function (err, deviceStatus) {
          demand(err).to.be.falsy()
          deviceStatus.must.have.property('10006', value)
          done()
        })
      })
    })
  })

  describe('Color Light', function () {
    let client
    let deviceId
    let initialState

    before(function (done) {
      if (!colorLight) this.skip()
      client = wemo.client(colorLight.deviceInfo)
      deviceId = colorLight.endDevice.deviceId
      client.getDeviceStatus(deviceId, function (err, deviceStatus) {
        demand(err).to.be.falsy()
        initialState = deviceStatus
        done()
      })
    })

    it('should be dimmable', function (done) {
      const value = Math.floor(Math.random() * 255)
      client.setDeviceStatus(deviceId, 10008, value + ':0', function () {
        client.getDeviceStatus(deviceId, function (err, deviceStatus) {
          demand(err).to.be.falsy()
          deviceStatus.must.have.property('10008', value + ':0')
          done()
        })
      })
    })

    it('should change color', function (done) {
      const r = Math.floor(Math.random() * 255)
      const g = Math.floor(Math.random() * 255)
      const b = Math.floor(Math.random() * 255)
      const xy = WemoClient.rgb2xy(r, g, b).join(':')

      client.setDeviceStatus(deviceId, 10300, xy + ':0', function () {
        client.getDeviceStatus(deviceId, function (err, deviceStatus) {
          demand(err).to.be.falsy()
          deviceStatus.must.have.property('10300', xy + ':0')
          done()
        })
      })
    })

    it('should turn on and off', function (done) {
      const value = (initialState['10006'][0] === '1') ? '0' : '1'
      client.setDeviceStatus(deviceId, 10006, value, function () {
        client.getDeviceStatus(deviceId, function (err, deviceStatus) {
          demand(err).to.be.falsy()
          deviceStatus.must.have.property('10006', value)
          done()
        })
      })
    })
  })
})


text:
using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Services;
using MediaBrowser.Plugins.PushALotNotifications.Configuration;

namespace MediaBrowser.Plugins.PushALotNotifications.Api
{
    [Route("/Notification/Pushalot/Test/{UserID}", "POST", Summary = "Tests Pushalot")]
    public class TestNotification : IReturnVoid
    {
        [ApiMember(Name = "UserID", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
        public string UserID { get; set; }
    }

    class ServerApiEndpoints : IService
    {
        private readonly IHttpClient _httpClient;
        private readonly ILogger _logger;

        public ServerApiEndpoints(ILogManager logManager, IHttpClient httpClient)
        {
            _logger = logManager.GetLogger(GetType().Name);
            _httpClient = httpClient;
        }

        private PushALotOptions GetOptions(String userID)
        {
            return Plugin.Instance.Configuration.Options
                .FirstOrDefault(i => string.Equals(i.MediaBrowserUserId, userID, StringComparison.OrdinalIgnoreCase));
        }

        public object Post(TestNotification request)
        {
            var options = GetOptions(request.UserID);

            var parameters = new Dictionary<string, string>
            {
                {"AuthorizationToken", options.Token},
                {"Title", "Test Notification" },
                {"Body", "This is a test notification from MediaBrowser"}
            };

            _logger.Debug("PushAlot <TEST> to {0}", options.Token);

            return _httpClient.Post(new HttpRequestOptions { Url = "https://pushalot.com/api/sendmessage" }, parameters);
        }
    }
}


text: A mongoose find or create plugin (that works)


text:
package org.sidoh.song_recognition.signature;

import java.io.Serializable;

import org.sidoh.math.Histogram;

/**
 * A {@link HistogramScorer} should return a score based on a {@link Histogram}.
 *
 * @author chris
 *
 */
public abstract class HistogramScorer implements Serializable {
	private static final long serialVersionUID = 7388831796868643276L;

	/**
	 * Generate score for this {@link Histogram}
	 * @param hist
	 * @return
	 */
	public abstract double score(Histogram hist);

	public static HistogramScorer heightScorer() {
		return new HeightScorer();
	}

	public static HistogramScorer heightProbabilityScorer() {
		return new HeightProbabilityScorer();
	}

	public static HistogramScorer sdsFromMean() {
		return new SdsFromMeanScorer();
	}

	public static HistogramScorer sizeScorer() {
		return new SizeScorer();
	}
}


text:
package net.sourceforge.marathon.javafxagent.components;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import javafx.scene.control.ListView;
import javafx.scene.layout.Pane;
import net.sourceforge.marathon.javafx.tests.CheckBoxListViewSample;
import net.sourceforge.marathon.javafx.tests.CheckBoxListViewSample.Item;
import net.sourceforge.marathon.javafxagent.IJavaFXElement;
import net.sourceforge.marathon.javafxagent.JavaFXAgent;
import net.sourceforge.marathon.javafxagent.Wait;

public class JavaFXListViewCheckBoxListCellElementTest extends JavaFXElementTest {

    private JavaFXAgent driver;
    private IJavaFXElement listView;

    @BeforeMethod
    public void initializeDriver() {
        driver = new JavaFXAgent();
        listView = driver.findElementByTagName("list-view");
    }

    @Test
    public void selectListItemCheckBoxNotSelectedSelected() {
        IJavaFXElement item = listView.findElementByCssSelector(".::select-by-properties('{\"select\":\"Item 3\"}')");
        IJavaFXElement cb = item.findElementByCssSelector(".::editor");
        cb.marathon_select("checked");
        new Wait("Wait for list item check box to be selected") {
            @Override
            public boolean until() {
                String selected = cb.getAttribute("selected");
                return selected.equals("true");
            }
        };
    }

    @Test
    public void selectListItemCheckBoxSelectedSelected() {
        ListView<?> listViewNode = (ListView<?>) getPrimaryStage().getScene().getRoot().lookup(".list-view");
        Item x = (Item) listViewNode.getItems().get(2);
        x.setOn(true);
        IJavaFXElement item = listView.findElementByCssSelector(".::select-by-properties('{\"select\":\"Item 3\"}')");
        IJavaFXElement cb = item.findElementByCssSelector(".::editor");
        cb.marathon_select("checked");
        new Wait("Wait for list item check box to be selected") {
            @Override
            public boolean until() {
                String selected = cb.getAttribute("selected");
                return selected.equals("true");
            }
        };
    }

    @Test
    public void selectListItemCheckBoxSelectedNotSelected() {
        ListView<?> listViewNode = (ListView<?>) getPrimaryStage().getScene().getRoot().lookup(".list-view");
        Item x = (Item) listViewNode.getItems().get(2);
        x.setOn(true);
        IJavaFXElement item = listView.findElementByCssSelector(".::select-by-properties('{\"select\":\"Item 3\"}')");
        IJavaFXElement cb = item.findElementByCssSelector(".::editor");
        cb.marathon_select("unchecked");
        new Wait("Wait for list item check box to be deselected") {
            @Override
            public boolean until() {
                String selected = cb.getAttribute("selected");
                return selected.equals("false");
            }
        };
    }

    @Test
    public void selectListItemCheckBoxNotSelectedNotSelected() {
        IJavaFXElement item = listView.findElementByCssSelector(".::select-by-properties('{\"select\":\"Item 3\"}')");
        IJavaFXElement cb = item.findElementByCssSelector(".::editor");
        new Wait("Wait for list item check box to be deselected") {
            @Override
            public boolean until() {
                String selected = cb.getAttribute("selected");
                return selected.equals("false");
            }
        };
        cb.marathon_select("unchecked");
        new Wait("Wait for list item check box to be deselected") {
            @Override
            public boolean until() {
                String selected = cb.getAttribute("selected");
                return selected.equals("false");
            }
        };
    }

    @Override
    protected Pane getMainPane() {
        return new CheckBoxListViewSample();
    }
}


text:
using System;

namespace Krkadoni.Enigma
{

    #region Apache License

    //
    // Licensed to the Apache Software Foundation (ASF) under one or more
    // contributor license agreements. See the NOTICE file distributed with
    // this work for additional information regarding copyright ownership.
    // The ASF licenses this file to you under the Apache License, Version 2.0
    // (the "License"); you may not use this file except in compliance with
    // the License. You may obtain a copy of the License at
    //
    // http://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing, software
    // distributed under the License is distributed on an "AS IS" BASIS,
    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    // See the License for the specific language governing permissions and
    // limitations under the License.
    //

    #endregion

    ///
    ///     The ILog interface is use by application to log messages into
    ///     the log4net framework.
    ///
    /// <remarks>
    ///     <para>
    ///         Use the LogManager to obtain logger instances
    ///         that implement this interface. The LogManager.GetLogger(Assembly,Type)
    ///         static method is used to get logger instances.
    ///     </para>
    ///     <para>
    ///         This class contains methods for logging at different levels and also
    ///         has properties for determining if those logging levels are
    ///         enabled in the current configuration.
    ///     </para>
    ///     <para>
    ///         This interface can be implemented in different ways. This documentation
    ///         specifies reasonable behavior that a caller can expect from the actual
    ///         implementation, however different implementations reserve the right to
    ///         do things differently.
    ///     </para>
    /// </remarks>
    /// <example>
    ///     Simple example of logging messages
    ///
    ///  ILog log = LogManager.GetLogger("application-log");
    ///
    ///  log.Info("Application Start");
    ///  log.Debug("This is a debug message");
    ///
    ///  if (log.IsDebugEnabled)
    ///  {
    /// 		log.Debug("This is another debug message");
    ///  }
    ///
    /// </example>
    /// <author>Nicko Cadell</author>
    /// <author>Gert Driesen</author>
    public interface ILog
    {
        ///
        ///     Checks if this logger is enabled for the Level.Debug level.
        ///
        /// <value>
        ///     <c>true</c> if this logger is enabled for Level.Debug events, <c>false</c> otherwise.
        /// </value>
        /// <remarks>
        ///     <para>
        ///         This function is intended to lessen the computational cost of
        ///         disabled log debug statements.
        ///     </para>
        ///     <para> For some ILog interface <c>log</c>, when you write:</para>
        ///
        /// log.Debug("This is entry number: " + i );
        ///
        ///     <para>
        ///         You incur the cost constructing the message, string construction and concatenation in
        ///         this case, regardless of whether the message is logged or not.
        ///     </para>
        ///     <para>
        ///         If you are worried about speed (who isn't), then you should write:
        ///     </para>
        ///
        /// if (log.IsDebugEnabled)
        /// {
        ///     log.Debug("This is entry number: " + i );
        /// }
        ///
        ///     <para>
        ///         This way you will not incur the cost of parameter
        ///         construction if debugging is disabled for <c>log</c>. On
        ///         the other hand, if the <c>log</c> is debug enabled, you
        ///         will incur the cost of evaluating whether the logger is debug
        ///         enabled twice. Once in IsDebugEnabled and once in
        ///         the M:Debug(object).  This is an insignificant overhead
        ///         since evaluating a logger takes about 1% of the time it
        ///         takes to actually log. This is the preferred style of logging.
        ///     </para>
        ///     <para>
        ///         Alternatively if your logger is available statically then the is debug
        ///         enabled state can be stored in a static variable like this:
        ///     </para>
        ///
        /// private static readonly bool isDebugEnabled = log.IsDebugEnabled;
        ///
        ///     <para>
        ///         Then when you come to log you can write:
        ///     </para>
        ///
        /// if (isDebugEnabled)
        /// {
        ///     log.Debug("This is entry number: " + i );
        /// }
        ///
        ///     <para>
        ///         This way the debug enabled state is only queried once
        ///         when the class is loaded. Using a <c>private static readonly</c>
        ///         variable is the most efficient because it is a run time constant
        ///         and can be heavily optimized by the JIT compiler.
        ///     </para>
        ///     <para>
        ///         Of course if you use a static readonly variable to
        ///         hold the enabled state of the logger then you cannot
        ///         change the enabled state at runtime to vary the logging
        ///         that is produced. You have to decide if you need absolute
        ///         speed or runtime flexibility.
        ///     </para>
        /// </remarks>
        bool IsDebugEnabled { get; }

        ///
        ///     Checks if this logger is enabled for the Level.Info level.
        ///
        /// <value>
        ///     <c>true</c> if this logger is enabled for Level.Info events, <c>false</c> otherwise.
        /// </value>
        /// <remarks>
        ///     For more information see ILog.IsDebugEnabled.
        /// </remarks>
        bool IsInfoEnabled { get; }

        ///
        ///     Checks if this logger is enabled for the Level.Warn level.
        ///
        /// <value>
        ///     <c>true</c> if this logger is enabled for Level.Warn events, <c>false</c> otherwise.
        /// </value>
        /// <remarks>
        ///     For more information see ILog.IsDebugEnabled.
        /// </remarks>
        bool IsWarnEnabled { get; }

        ///
        ///     Checks if this logger is enabled for the Level.Error level.
        ///
        /// <value>
        ///     <c>true</c> if this logger is enabled for Level.Error events, <c>false</c> otherwise.
        /// </value>
        /// <remarks>
        ///     For more information see ILog.IsDebugEnabled.
        /// </remarks>
        bool IsErrorEnabled { get; }

        ///
        ///     Checks if this logger is enabled for the Level.Fatal level.
        ///
        /// <value>
        ///     <c>true</c> if this logger is enabled for Level.Fatal events, <c>false</c> otherwise.
        /// </value>
        /// <remarks>
        ///     For more information see ILog.IsDebugEnabled.
        /// </remarks>
        bool IsFatalEnabled { get; }

        /// <overloads>Log a message object with the Level.Debug level.</overloads>
        ///
        ///     Log a message object with the Level.Debug level.
        ///
        /// <param name="message">The message object to log.</param>
        /// <remarks>
        ///     <para>
        ///         This method first checks if this logger is <c>DEBUG</c>
        ///         enabled by comparing the level of this logger with the
        ///         Level.Debug level. If this logger is
        ///         <c>DEBUG</c> enabled, then it converts the message object
        ///         (passed as parameter) to a string by invoking the appropriate
        ///         log4net.ObjectRenderer.IObjectRenderer. It then
        ///         proceeds to call all the registered appenders in this logger
        ///         and also higher in the hierarchy depending on the value of
        ///         the additivity flag.
        ///     </para>
        ///     <para>
        ///         WARNING Note that passing an Exception
        ///         to this method will print the name of the Exception
        ///         but no stack trace. To print a stack trace use the
        ///         M:Debug(object,Exception) form instead.
        ///     </para>
        /// </remarks>
        void Debug(object message);

        ///
        ///     Log a message object with the Level.Debug level including
        ///     the stack trace of the Exception passed
        ///     as a parameter.
        ///
        /// <param name="message">The message object to log.</param>
        /// <param name="exception">The exception to log, including its stack trace.</param>
        /// <remarks>
        ///     <para>
        ///         See the M:Debug(object) form for more detailed information.
        ///     </para>
        /// </remarks>
        void Debug(object message, Exception exception);

        /// <overloads>Log a formatted string with the Level.Debug level.</overloads>
        ///
        ///     Logs a formatted message string with the Level.Debug level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Debug(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void DebugFormat(string format, params object[] args);

        ///
        ///     Logs a formatted message string with the Level.Debug level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Debug(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void DebugFormat(string format, object arg0);

        ///
        ///     Logs a formatted message string with the Level.Debug level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <param name="arg1">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Debug(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void DebugFormat(string format, object arg0, object arg1);

        ///
        ///     Logs a formatted message string with the Level.Debug level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <param name="arg1">An Object to format</param>
        /// <param name="arg2">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Debug(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void DebugFormat(string format, object arg0, object arg1, object arg2);

        ///
        ///     Logs a formatted message string with the Level.Debug level.
        ///
        /// <param name="provider">An IFormatProvider that supplies culture-specific formatting information</param>
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Debug(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void DebugFormat(IFormatProvider provider, string format, params object[] args);

        /// <overloads>Log a message object with the Level.Info level.</overloads>
        ///
        ///     Logs a message object with the Level.Info level.
        ///
        /// <remarks>
        ///     <para>
        ///         This method first checks if this logger is <c>INFO</c>
        ///         enabled by comparing the level of this logger with the
        ///         Level.Info level. If this logger is
        ///         <c>INFO</c> enabled, then it converts the message object
        ///         (passed as parameter) to a string by invoking the appropriate
        ///         log4net.ObjectRenderer.IObjectRenderer. It then
        ///         proceeds to call all the registered appenders in this logger
        ///         and also higher in the hierarchy depending on the value of the
        ///         additivity flag.
        ///     </para>
        ///     <para>
        ///         WARNING Note that passing an Exception
        ///         to this method will print the name of the Exception
        ///         but no stack trace. To print a stack trace use the
        ///         M:Info(object,Exception) form instead.
        ///     </para>
        /// </remarks>
        /// <param name="message">The message object to log.</param>
        void Info(object message);

        ///
        ///     Logs a message object with the <c>INFO</c> level including
        ///     the stack trace of the Exception passed
        ///     as a parameter.
        ///
        /// <param name="message">The message object to log.</param>
        /// <param name="exception">The exception to log, including its stack trace.</param>
        /// <remarks>
        ///     <para>
        ///         See the M:Info(object) form for more detailed information.
        ///     </para>
        /// </remarks>
        void Info(object message, Exception exception);

        /// <overloads>Log a formatted message string with the Level.Info level.</overloads>
        ///
        ///     Logs a formatted message string with the Level.Info level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Info(object)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void InfoFormat(string format, params object[] args);

        ///
        ///     Logs a formatted message string with the Level.Info level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Info(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void InfoFormat(string format, object arg0);

        ///
        ///     Logs a formatted message string with the Level.Info level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <param name="arg1">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Info(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void InfoFormat(string format, object arg0, object arg1);

        ///
        ///     Logs a formatted message string with the Level.Info level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <param name="arg1">An Object to format</param>
        /// <param name="arg2">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Info(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void InfoFormat(string format, object arg0, object arg1, object arg2);

        ///
        ///     Logs a formatted message string with the Level.Info level.
        ///
        /// <param name="provider">An IFormatProvider that supplies culture-specific formatting information</param>
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Info(object)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void InfoFormat(IFormatProvider provider, string format, params object[] args);

        /// <overloads>Log a message object with the Level.Warn level.</overloads>
        ///
        ///     Log a message object with the Level.Warn level.
        ///
        /// <remarks>
        ///     <para>
        ///         This method first checks if this logger is <c>WARN</c>
        ///         enabled by comparing the level of this logger with the
        ///         Level.Warn level. If this logger is
        ///         <c>WARN</c> enabled, then it converts the message object
        ///         (passed as parameter) to a string by invoking the appropriate
        ///         log4net.ObjectRenderer.IObjectRenderer. It then
        ///         proceeds to call all the registered appenders in this logger
        ///         and also higher in the hierarchy depending on the value of the
        ///         additivity flag.
        ///     </para>
        ///     <para>
        ///         WARNING Note that passing an Exception
        ///         to this method will print the name of the Exception
        ///         but no stack trace. To print a stack trace use the
        ///         M:Warn(object,Exception) form instead.
        ///     </para>
        /// </remarks>
        /// <param name="message">The message object to log.</param>
        void Warn(object message);

        ///
        ///     Log a message object with the Level.Warn level including
        ///     the stack trace of the Exception passed
        ///     as a parameter.
        ///
        /// <param name="message">The message object to log.</param>
        /// <param name="exception">The exception to log, including its stack trace.</param>
        /// <remarks>
        ///     <para>
        ///         See the M:Warn(object) form for more detailed information.
        ///     </para>
        /// </remarks>
        void Warn(object message, Exception exception);

        /// <overloads>Log a formatted message string with the Level.Warn level.</overloads>
        ///
        ///     Logs a formatted message string with the Level.Warn level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Warn(object)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void WarnFormat(string format, params object[] args);

        ///
        ///     Logs a formatted message string with the Level.Warn level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Warn(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void WarnFormat(string format, object arg0);

        ///
        ///     Logs a formatted message string with the Level.Warn level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <param name="arg1">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Warn(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void WarnFormat(string format, object arg0, object arg1);

        ///
        ///     Logs a formatted message string with the Level.Warn level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <param name="arg1">An Object to format</param>
        /// <param name="arg2">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Warn(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void WarnFormat(string format, object arg0, object arg1, object arg2);

        ///
        ///     Logs a formatted message string with the Level.Warn level.
        ///
        /// <param name="provider">An IFormatProvider that supplies culture-specific formatting information</param>
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Warn(object)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void WarnFormat(IFormatProvider provider, string format, params object[] args);

        /// <overloads>Log a message object with the Level.Error level.</overloads>
        ///
        ///     Logs a message object with the Level.Error level.
        ///
        /// <param name="message">The message object to log.</param>
        /// <remarks>
        ///     <para>
        ///         This method first checks if this logger is <c>ERROR</c>
        ///         enabled by comparing the level of this logger with the
        ///         Level.Error level. If this logger is
        ///         <c>ERROR</c> enabled, then it converts the message object
        ///         (passed as parameter) to a string by invoking the appropriate
        ///         log4net.ObjectRenderer.IObjectRenderer. It then
        ///         proceeds to call all the registered appenders in this logger
        ///         and also higher in the hierarchy depending on the value of the
        ///         additivity flag.
        ///     </para>
        ///     <para>
        ///         WARNING Note that passing an Exception
        ///         to this method will print the name of the Exception
        ///         but no stack trace. To print a stack trace use the
        ///         M:Error(object,Exception) form instead.
        ///     </para>
        /// </remarks>
        void Error(object message);

        ///
        ///     Log a message object with the Level.Error level including
        ///     the stack trace of the Exception passed
        ///     as a parameter.
        ///
        /// <param name="message">The message object to log.</param>
        /// <param name="exception">The exception to log, including its stack trace.</param>
        /// <remarks>
        ///     <para>
        ///         See the M:Error(object) form for more detailed information.
        ///     </para>
        /// </remarks>
        void Error(object message, Exception exception);

        /// <overloads>Log a formatted message string with the Level.Error level.</overloads>
        ///
        ///     Logs a formatted message string with the Level.Error level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Error(object)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void ErrorFormat(string format, params object[] args);

        ///
        ///     Logs a formatted message string with the Level.Error level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Error(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void ErrorFormat(string format, object arg0);

        ///
        ///     Logs a formatted message string with the Level.Error level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <param name="arg1">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Error(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void ErrorFormat(string format, object arg0, object arg1);

        ///
        ///     Logs a formatted message string with the Level.Error level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <param name="arg1">An Object to format</param>
        /// <param name="arg2">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Error(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void ErrorFormat(string format, object arg0, object arg1, object arg2);

        ///
        ///     Logs a formatted message string with the Level.Error level.
        ///
        /// <param name="provider">An IFormatProvider that supplies culture-specific formatting information</param>
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Error(object)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void ErrorFormat(IFormatProvider provider, string format, params object[] args);

        /// <overloads>Log a message object with the Level.Fatal level.</overloads>
        ///
        ///     Log a message object with the Level.Fatal level.
        ///
        /// <remarks>
        ///     <para>
        ///         This method first checks if this logger is <c>FATAL</c>
        ///         enabled by comparing the level of this logger with the
        ///         Level.Fatal level. If this logger is
        ///         <c>FATAL</c> enabled, then it converts the message object
        ///         (passed as parameter) to a string by invoking the appropriate
        ///         log4net.ObjectRenderer.IObjectRenderer. It then
        ///         proceeds to call all the registered appenders in this logger
        ///         and also higher in the hierarchy depending on the value of the
        ///         additivity flag.
        ///     </para>
        ///     <para>
        ///         WARNING Note that passing an Exception
        ///         to this method will print the name of the Exception
        ///         but no stack trace. To print a stack trace use the
        ///         M:Fatal(object,Exception) form instead.
        ///     </para>
        /// </remarks>
        /// <param name="message">The message object to log.</param>
        void Fatal(object message);

        ///
        ///     Log a message object with the Level.Fatal level including
        ///     the stack trace of the Exception passed
        ///     as a parameter.
        ///
        /// <param name="message">The message object to log.</param>
        /// <param name="exception">The exception to log, including its stack trace.</param>
        /// <remarks>
        ///     <para>
        ///         See the M:Fatal(object) form for more detailed information.
        ///     </para>
        /// </remarks>
        void Fatal(object message, Exception exception);

        /// <overloads>Log a formatted message string with the Level.Fatal level.</overloads>
        ///
        ///     Logs a formatted message string with the Level.Fatal level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Fatal(object)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void FatalFormat(string format, params object[] args);

        ///
        ///     Logs a formatted message string with the Level.Fatal level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Fatal(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void FatalFormat(string format, object arg0);

        ///
        ///     Logs a formatted message string with the Level.Fatal level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <param name="arg1">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Fatal(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void FatalFormat(string format, object arg0, object arg1);

        ///
        ///     Logs a formatted message string with the Level.Fatal level.
        ///
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="arg0">An Object to format</param>
        /// <param name="arg1">An Object to format</param>
        /// <param name="arg2">An Object to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Fatal(object,Exception)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void FatalFormat(string format, object arg0, object arg1, object arg2);

        ///
        ///     Logs a formatted message string with the Level.Fatal level.
        ///
        /// <param name="provider">An IFormatProvider that supplies culture-specific formatting information</param>
        /// <param name="format">A String containing zero or more format items</param>
        /// <param name="args">An Object array containing zero or more objects to format</param>
        /// <remarks>
        ///     <para>
        ///         The message is formatted using the <c>String.Format</c> method. See
        ///         M:String.Format(string, object[]) for details of the syntax of the format string and the behavior
        ///         of the formatting.
        ///     </para>
        ///     <para>
        ///         This method does not take an Exception object to include in the
        ///         log event. To pass an Exception use one of the M:Fatal(object)
        ///         methods instead.
        ///     </para>
        /// </remarks>
        void FatalFormat(IFormatProvider provider, string format, params object[] args);
    }
}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pl.edu.mimuw.dmexlib.execution_contexts;

import java.util.Iterator;
import java.util.List;
import java.util.Random;
import pl.edu.mimuw.dmexlib.Algorithm;
import pl.edu.mimuw.dmexlib.executors.IExecutor;
import pl.edu.mimuw.dmexlib.executors.SequentialExecutor;
import pl.edu.mimuw.dmexlib.optimizers.ITreeOptimizer;
import pl.edu.mimuw.dmexlib.optimizers.NoOpOptimizer;

/**
 *
 * @author matek
 */
public class SimpleSequentialExecutionContext extends OptimizingExecutionContext {

    public SimpleSequentialExecutionContext() {
        this(new NoOpOptimizer());
    }

    public SimpleSequentialExecutionContext(ITreeOptimizer treeOptimizer) {
        this(treeOptimizer, new Random());
    }

    public SimpleSequentialExecutionContext(ITreeOptimizer treeOptimizer, Random rnd) {
        super(treeOptimizer, rnd);
        this.executor = new SequentialExecutor();
    }

    @Override
    public <T> Iterator<T> iterator(List<T> coll) {
        return coll.iterator();
    }

    @Override
    public IExecutor getExecutor() {
        return executor;
    }

    @Override
    public <Result> Result execute(Algorithm<Result> algo) throws Exception {
        return optimize(algo).accept(this);
    }

    private SequentialExecutor executor;
}


text:
import unittest

import botocore.exceptions
import mock
from parameterized import parameterized

from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.batch_client import AwsBatchClientHook

# Use dummy AWS credentials
AWS_REGION = "eu-west-1"
AWS_ACCESS_KEY_ID = "airflow_dummy_key"
AWS_SECRET_ACCESS_KEY = "airflow_dummy_secret"

JOB_ID = "8ba9d676-4108-4474-9dca-8bbac1da9b19"

class TestAwsBatchClient(unittest.TestCase):

    MAX_RETRIES = 2
    STATUS_RETRIES = 3

    @mock.patch.dict("os.environ", AWS_DEFAULT_REGION=AWS_REGION)
    @mock.patch.dict("os.environ", AWS_ACCESS_KEY_ID=AWS_ACCESS_KEY_ID)
    @mock.patch.dict("os.environ", AWS_SECRET_ACCESS_KEY=AWS_SECRET_ACCESS_KEY)
    @mock.patch("airflow.providers.amazon.aws.hooks.batch_client.AwsBaseHook.get_client_type")
    def setUp(self, get_client_type_mock):
        self.get_client_type_mock = get_client_type_mock
        self.batch_client = AwsBatchClientHook(
            max_retries=self.MAX_RETRIES,
            status_retries=self.STATUS_RETRIES,
            aws_conn_id='airflow_test',
            region_name=AWS_REGION,
        )
        self.client_mock = get_client_type_mock.return_value
        self.assertEqual(self.batch_client.client, self.client_mock)  # setup client property

        # don't pause in these unit tests
        self.mock_delay = mock.Mock(return_value=None)
        self.batch_client.delay = self.mock_delay
        self.mock_exponential_delay = mock.Mock(return_value=0)
        self.batch_client.exponential_delay = self.mock_exponential_delay

    def test_init(self):
        self.assertEqual(self.batch_client.max_retries, self.MAX_RETRIES)
        self.assertEqual(self.batch_client.status_retries, self.STATUS_RETRIES)
        self.assertEqual(self.batch_client.region_name, AWS_REGION)
        self.assertEqual(self.batch_client.aws_conn_id, 'airflow_test')
        self.assertEqual(self.batch_client.client, self.client_mock)

        self.get_client_type_mock.assert_called_once_with(
            "batch", region_name=AWS_REGION
        )

    def test_wait_for_job_with_success(self):
        self.client_mock.describe_jobs.return_value = {
            "jobs": [{"jobId": JOB_ID, "status": "SUCCEEDED"}]
        }

        with mock.patch.object(
            self.batch_client,
            "poll_for_job_running",
            wraps=self.batch_client.poll_for_job_running,
        ) as job_running:
            self.batch_client.wait_for_job(JOB_ID)
            job_running.assert_called_once_with(JOB_ID, None)

        with mock.patch.object(
            self.batch_client,
            "poll_for_job_complete",
            wraps=self.batch_client.poll_for_job_complete,
        ) as job_complete:
            self.batch_client.wait_for_job(JOB_ID)
            job_complete.assert_called_once_with(JOB_ID, None)

        self.assertEqual(self.client_mock.describe_jobs.call_count, 4)

    def test_wait_for_job_with_failure(self):
        self.client_mock.describe_jobs.return_value = {
            "jobs": [{"jobId": JOB_ID, "status": "FAILED"}]
        }

        with mock.patch.object(
            self.batch_client,
            "poll_for_job_running",
            wraps=self.batch_client.poll_for_job_running,
        ) as job_running:
            self.batch_client.wait_for_job(JOB_ID)
            job_running.assert_called_once_with(JOB_ID, None)

        with mock.patch.object(
            self.batch_client,
            "poll_for_job_complete",
            wraps=self.batch_client.poll_for_job_complete,
        ) as job_complete:
            self.batch_client.wait_for_job(JOB_ID)
            job_complete.assert_called_once_with(JOB_ID, None)

        self.assertEqual(self.client_mock.describe_jobs.call_count, 4)

    def test_poll_job_running_for_status_running(self):
        self.client_mock.describe_jobs.return_value = {
            "jobs": [{"jobId": JOB_ID, "status": "RUNNING"}]
        }
        self.batch_client.poll_for_job_running(JOB_ID)
        self.client_mock.describe_jobs.assert_called_once_with(jobs=[JOB_ID])

    def test_poll_job_complete_for_status_success(self):
        self.client_mock.describe_jobs.return_value = {
            "jobs": [{"jobId": JOB_ID, "status": "SUCCEEDED"}]
        }
        self.batch_client.poll_for_job_complete(JOB_ID)
        self.client_mock.describe_jobs.assert_called_once_with(jobs=[JOB_ID])

    def test_poll_job_complete_raises_for_max_retries(self):
        self.client_mock.describe_jobs.return_value = {
            "jobs": [{"jobId": JOB_ID, "status": "RUNNING"}]
        }
        with self.assertRaises(AirflowException) as e:
            self.batch_client.poll_for_job_complete(JOB_ID)
        msg = "AWS Batch job ({}) status checks exceed max_retries".format(JOB_ID)
        self.assertIn(msg, str(e.exception))
        self.client_mock.describe_jobs.assert_called_with(jobs=[JOB_ID])
        self.assertEqual(self.client_mock.describe_jobs.call_count, self.MAX_RETRIES + 1)

    def test_poll_job_status_hit_api_throttle(self):
        self.client_mock.describe_jobs.side_effect = botocore.exceptions.ClientError(
            error_response={"Error": {"Code": "TooManyRequestsException"}},
            operation_name="get job description",
        )
        with self.assertRaises(AirflowException) as e:
            self.batch_client.poll_for_job_complete(JOB_ID)
        msg = "AWS Batch job ({}) description error".format(JOB_ID)
        self.assertIn(msg, str(e.exception))
        # It should retry when this client error occurs
        self.client_mock.describe_jobs.assert_called_with(jobs=[JOB_ID])
        self.assertEqual(self.client_mock.describe_jobs.call_count, self.STATUS_RETRIES)

    def test_poll_job_status_with_client_error(self):
        self.client_mock.describe_jobs.side_effect = botocore.exceptions.ClientError(
            error_response={"Error": {"Code": "InvalidClientTokenId"}},
            operation_name="get job description",
        )
        with self.assertRaises(AirflowException) as e:
            self.batch_client.poll_for_job_complete(JOB_ID)
        msg = "AWS Batch job ({}) description error".format(JOB_ID)
        self.assertIn(msg, str(e.exception))
        # It will not retry when this client error occurs
        self.client_mock.describe_jobs.assert_called_once_with(jobs=[JOB_ID])

    def test_check_job_success(self):
        self.client_mock.describe_jobs.return_value = {
            "jobs": [{"jobId": JOB_ID, "status": "SUCCEEDED"}]
        }
        status = self.batch_client.check_job_success(JOB_ID)
        self.assertTrue(status)
        self.client_mock.describe_jobs.assert_called_once_with(jobs=[JOB_ID])

    def test_check_job_success_raises_failed(self):
        self.client_mock.describe_jobs.return_value = {
            "jobs": [
                {
                    "jobId": JOB_ID,
                    "status": "FAILED",
                    "statusReason": "This is an error reason",
                    "attempts": [{"exitCode": 1}],
                }
            ]
        }
        with self.assertRaises(AirflowException) as e:
            self.batch_client.check_job_success(JOB_ID)
        self.client_mock.describe_jobs.assert_called_once_with(jobs=[JOB_ID])
        msg = "AWS Batch job ({}) failed".format(JOB_ID)
        self.assertIn(msg, str(e.exception))

    def test_check_job_success_raises_failed_for_multiple_attempts(self):
        self.client_mock.describe_jobs.return_value = {
            "jobs": [
                {
                    "jobId": JOB_ID,
                    "status": "FAILED",
                    "statusReason": "This is an error reason",
                    "attempts": [{"exitCode": 1}, {"exitCode": 10}],
                }
            ]
        }
        with self.assertRaises(AirflowException) as e:
            self.batch_client.check_job_success(JOB_ID)
        self.client_mock.describe_jobs.assert_called_once_with(jobs=[JOB_ID])
        msg = "AWS Batch job ({}) failed".format(JOB_ID)
        self.assertIn(msg, str(e.exception))

    def test_check_job_success_raises_incomplete(self):
        self.client_mock.describe_jobs.return_value = {
            "jobs": [{"jobId": JOB_ID, "status": "RUNNABLE"}]
        }
        with self.assertRaises(AirflowException) as e:
            self.batch_client.check_job_success(JOB_ID)
        self.client_mock.describe_jobs.assert_called_once_with(jobs=[JOB_ID])
        msg = "AWS Batch job ({}) is not complete".format(JOB_ID)
        self.assertIn(msg, str(e.exception))

    def test_check_job_success_raises_unknown_status(self):
        status = "STRANGE"
        self.client_mock.describe_jobs.return_value = {
            "jobs": [{"jobId": JOB_ID, "status": status}]
        }
        with self.assertRaises(AirflowException) as e:
            self.batch_client.check_job_success(JOB_ID)
        self.client_mock.describe_jobs.assert_called_once_with(jobs=[JOB_ID])
        msg = "AWS Batch job ({}) has unknown status".format(JOB_ID)
        self.assertIn(msg, str(e.exception))
        self.assertIn(status, str(e.exception))

    def test_check_job_success_raises_without_jobs(self):
        self.client_mock.describe_jobs.return_value = {"jobs": []}
        with self.assertRaises(AirflowException) as e:
            self.batch_client.check_job_success(JOB_ID)
        self.client_mock.describe_jobs.assert_called_once_with(jobs=[JOB_ID])
        msg = "AWS Batch job ({}) description error".format(JOB_ID)
        self.assertIn(msg, str(e.exception))

    def test_terminate_job(self):
        self.client_mock.terminate_job.return_value = {}
        reason = "Task killed by the user"
        response = self.batch_client.terminate_job(JOB_ID, reason)
        self.client_mock.terminate_job.assert_called_once_with(jobId=JOB_ID, reason=reason)
        self.assertEqual(response, {})

class TestAwsBatchClientDelays(unittest.TestCase):
    @mock.patch.dict("os.environ", AWS_DEFAULT_REGION=AWS_REGION)
    @mock.patch.dict("os.environ", AWS_ACCESS_KEY_ID=AWS_ACCESS_KEY_ID)
    @mock.patch.dict("os.environ", AWS_SECRET_ACCESS_KEY=AWS_SECRET_ACCESS_KEY)
    def setUp(self):
        self.batch_client = AwsBatchClientHook(
            aws_conn_id='airflow_test',
            region_name=AWS_REGION)

    def test_init(self):
        self.assertEqual(self.batch_client.max_retries, self.batch_client.MAX_RETRIES)
        self.assertEqual(self.batch_client.status_retries, self.batch_client.STATUS_RETRIES)
        self.assertEqual(self.batch_client.region_name, AWS_REGION)
        self.assertEqual(self.batch_client.aws_conn_id, 'airflow_test')

    def test_add_jitter(self):
        minima = 0
        width = 5
        result = self.batch_client.add_jitter(0, width=width, minima=minima)
        self.assertGreaterEqual(result, minima)
        self.assertLessEqual(result, width)

    @mock.patch("airflow.providers.amazon.aws.hooks.batch_client.uniform")
    @mock.patch("airflow.providers.amazon.aws.hooks.batch_client.sleep")
    def test_delay_defaults(self, mock_sleep, mock_uniform):
        self.assertEqual(AwsBatchClientHook.DEFAULT_DELAY_MIN, 1)
        self.assertEqual(AwsBatchClientHook.DEFAULT_DELAY_MAX, 10)
        mock_uniform.return_value = 0
        self.batch_client.delay()
        mock_uniform.assert_called_once_with(
            AwsBatchClientHook.DEFAULT_DELAY_MIN, AwsBatchClientHook.DEFAULT_DELAY_MAX
        )
        mock_sleep.assert_called_once_with(0)

    @mock.patch("airflow.providers.amazon.aws.hooks.batch_client.uniform")
    @mock.patch("airflow.providers.amazon.aws.hooks.batch_client.sleep")
    def test_delay_with_zero(self, mock_sleep, mock_uniform):
        self.batch_client.delay(0)
        mock_uniform.assert_called_once_with(0, 1)  # in add_jitter
        mock_sleep.assert_called_once_with(mock_uniform.return_value)

    @mock.patch("airflow.providers.amazon.aws.hooks.batch_client.uniform")
    @mock.patch("airflow.providers.amazon.aws.hooks.batch_client.sleep")
    def test_delay_with_int(self, mock_sleep, mock_uniform):
        self.batch_client.delay(5)
        mock_uniform.assert_called_once_with(4, 6)  # in add_jitter
        mock_sleep.assert_called_once_with(mock_uniform.return_value)

    @mock.patch("airflow.providers.amazon.aws.hooks.batch_client.uniform")
    @mock.patch("airflow.providers.amazon.aws.hooks.batch_client.sleep")
    def test_delay_with_float(self, mock_sleep, mock_uniform):
        self.batch_client.delay(5.0)
        mock_uniform.assert_called_once_with(4.0, 6.0)  # in add_jitter
        mock_sleep.assert_called_once_with(mock_uniform.return_value)

    @parameterized.expand(
        [
            (0, 0, 1),
            (1, 0, 2),
            (2, 0, 3),
            (3, 1, 5),
            (4, 2, 7),
            (5, 3, 11),
            (6, 4, 14),
            (7, 6, 19),
            (8, 8, 25),
            (9, 10, 31),
            (45, 200, 600),  # > 40 tries invokes maximum delay allowed
        ]
    )
    def test_exponential_delay(self, tries, lower, upper):
        result = self.batch_client.exponential_delay(tries)
        self.assertGreaterEqual(result, lower)
        self.assertLessEqual(result, upper)


text:
CREATE TABLE growthCondition (
    name varchar(255) not null,	# Symbolic name of growth condition
    shortLabel varchar(255) not null,	# Short description of growth condition
    longLabel varchar(255) not null,	# Longer description of growth condition
              #Indices
    PRIMARY KEY(name(32))
);


text:
<?php
if(isset($_POST["send"])) {
echo $name = $_POST ["yourName"];
echo $email = $_POST["yourEmail"];
echo  $message = $_POST["yourMessage"];
$to = "lauravshaffer@gmail.com";
$subject = "Message from Portfolio Contact Form";
;

mail($to,$subject,$name,$email,$message);
}
?>
<!DOCTYPE HTML>

<title>Thanks!</title>

Thanks

I will get back to you as soon as possible.

Back to my Portfolio


text:
namespace Microsoft.WindowsAzure.Management.ServiceManagement.Test.FunctionalTests.IaasCmdletInfo
{
    using Microsoft.WindowsAzure.Management.ServiceManagement.Test.FunctionalTests.PowershellCore;

    public class GetAzureCertificateCmdletInfo : CmdletsInfo
    {
        public GetAzureCertificateCmdletInfo(string serviceName, string thumbprint, string algorithm)
        {
            cmdletName = Utilities.GetAzureCertificateCmdletName;

            cmdletParams.Add(new CmdletParam("ServiceName", serviceName));

            if (thumbprint != null)
            {
                cmdletParams.Add(new CmdletParam("Thumbprint", thumbprint));
            }
            if (algorithm != null)
            {
                cmdletParams.Add(new CmdletParam("ThumbprintAlgorithm", algorithm));
            }

        }
    }
}