text:
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;

namespace Azure.Analytics.Synapse.Artifacts.Models
{
    public partial class SapHanaLinkedService : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("type");
            writer.WriteStringValue(Type);
            if (Optional.IsDefined(ConnectVia))
            {
                writer.WritePropertyName("connectVia");
                writer.WriteObjectValue(ConnectVia);
            }
            if (Optional.IsDefined(Description))
            {
                writer.WritePropertyName("description");
                writer.WriteStringValue(Description);
            }
            if (Optional.IsCollectionDefined(Parameters))
            {
                writer.WritePropertyName("parameters");
                writer.WriteStartObject();
                foreach (var item in Parameters)
                {
                    writer.WritePropertyName(item.Key);
                    writer.WriteObjectValue(item.Value);
                }
                writer.WriteEndObject();
            }
            if (Optional.IsCollectionDefined(Annotations))
            {
                writer.WritePropertyName("annotations");
                writer.WriteStartArray();
                foreach (var item in Annotations)
                {
                    writer.WriteObjectValue(item);
                }
                writer.WriteEndArray();
            }
            writer.WritePropertyName("typeProperties");
            writer.WriteStartObject();
            if (Optional.IsDefined(ConnectionString))
            {
                writer.WritePropertyName("connectionString");
                writer.WriteObjectValue(ConnectionString);
            }
            writer.WritePropertyName("server");
            writer.WriteObjectValue(Server);
            if (Optional.IsDefined(AuthenticationType))
            {
                writer.WritePropertyName("authenticationType");
                writer.WriteStringValue(AuthenticationType.Value.ToString());
            }
            if (Optional.IsDefined(UserName))
            {
                writer.WritePropertyName("userName");
                writer.WriteObjectValue(UserName);
            }
            if (Optional.IsDefined(Password))
            {
                writer.WritePropertyName("password");
                writer.WriteObjectValue(Password);
            }
            if (Optional.IsDefined(EncryptedCredential))
            {
                writer.WritePropertyName("encryptedCredential");
                writer.WriteObjectValue(EncryptedCredential);
            }
            writer.WriteEndObject();
            foreach (var item in AdditionalProperties)
            {
                writer.WritePropertyName(item.Key);
                writer.WriteObjectValue(item.Value);
            }
            writer.WriteEndObject();
        }

        internal static SapHanaLinkedService DeserializeSapHanaLinkedService(JsonElement element)
        {
            string type = default;
            Optional<IntegrationRuntimeReference> connectVia = default;
            Optional<string> description = default;
            Optional<IDictionary<string, ParameterSpecification>> parameters = default;
            Optional<IList<object>> annotations = default;
            Optional<object> connectionString = default;
            object server = default;
            Optional<SapHanaAuthenticationType> authenticationType = default;
            Optional<object> userName = default;
            Optional<SecretBase> password = default;
            Optional<object> encryptedCredential = default;
            IDictionary<string, object> additionalProperties = default;
            Dictionary<string, object> additionalPropertiesDictionary = new Dictionary<string, object>();
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectVia"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value);
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("parameters"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecification>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property0.Value));
                    }
                    parameters = dictionary;
                    continue;
                }
                if (property.NameEquals("annotations"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List<object> array = new List<object>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetObject());
                    }
                    annotations = array;
                    continue;
                }
                if (property.NameEquals("typeProperties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("connectionString"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            connectionString = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("server"))
                        {
                            server = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("authenticationType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            authenticationType = new SapHanaAuthenticationType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("userName"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            userName = property0.Value.GetObject();
                            continue;
                        }
                        if (property0.NameEquals("password"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            password = SecretBase.DeserializeSecretBase(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("encryptedCredential"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            encryptedCredential = property0.Value.GetObject();
                            continue;
                        }
                    }
                    continue;
                }
                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
            }
            additionalProperties = additionalPropertiesDictionary;
            return new SapHanaLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, server, Optional.ToNullable(authenticationType), userName.Value, password.Value, encryptedCredential.Value);
        }
    }
}


text:
package ca.mcgill.cs.sel.ram;

/**
 *
 * A representation of the model object 'Primitive Type'.
 *
 *
 *
 * @see ca.mcgill.cs.sel.ram.RamPackage#getPrimitiveType()
 * @model abstract="true"
 * @generated
 */
public interface PrimitiveType extends ObjectType, ImplementationClass {
} // PrimitiveType

redpajama_set_name: RedPajamaGithub


text:
package slacknotifications;

import org.apache.http.ProtocolVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.message.BasicHttpResponse;
import org.apache.http.message.BasicStatusLine;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import slacknotifications.teamcity.BuildStateEnum;
import slacknotifications.teamcity.SlackNotificationFactory;
import slacknotifications.teamcity.SlackNotificationFactoryImpl;
import slacknotifications.teamcity.payload.content.Commit;
import slacknotifications.teamcity.payload.content.PostMessageResponse;
import slacknotifications.teamcity.payload.content.SlackNotificationPayloadContent;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.ConnectException;
import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class SlackNotificationTest {
	public String proxy = "127.0.0.1";
	public Integer proxyPort = 58002;
	String proxyPortString = "58002";
	public Integer webserverPort = 58001;
	public Integer proxyserverPort = 58002;
	public String webserverHost = "127.0.0.1";
	String url = "http://127.0.0.1:58001";

	public String proxyUsername = "foo";
	public String proxyPassword = "bar";

	SlackNotificationFactory factory = new SlackNotificationFactoryImpl();

	@Test
	public void test_BuildStates(){
		assertTrue(BuildStateEnum.BUILD_STARTED.getShortName().equals("buildStarted"));
		assertTrue(BuildStateEnum.BUILD_FINISHED.getShortName().equals("buildFinished"));
		assertTrue(BuildStateEnum.BEFORE_BUILD_FINISHED.getShortName().equals("beforeBuildFinish"));
		assertTrue(BuildStateEnum.RESPONSIBILITY_CHANGED.getShortName().equals("responsibilityChanged"));
		assertTrue(BuildStateEnum.BUILD_INTERRUPTED.getShortName().equals("buildInterrupted"));

	}

	@Test
	public void test_ProxyPort() {
		SlackNotification W = factory.getSlackNotification(url, proxy, proxyPort);
		assertTrue(W.getProxyPort() == proxyPort);
	}

	@Test
	public void test_ProxyHost() {
		SlackNotification W = factory.getSlackNotification(url, proxy, proxyPort);
		assertTrue(W.getProxyHost() == proxy);
	}

	@Test
	public void test_URL() {
		SlackNotification W = factory.getSlackNotification(url, proxy, proxyPort);
		assertTrue(W.getChannel() == url);
	}

    @Ignore // Not a valid test anymore?
	@Test(expected=java.io.FileNotFoundException.class)
	public void test_FileNotFoundExeption() throws FileNotFoundException, IOException{
		System.out.print("Testing for FileNotFound exception");
		SlackNotification w = factory.getSlackNotification(url, proxy, proxyPort);
		w.setFilename("SlackNotifications/src/test/resources/fileWithDoesNotExist.txt");
		w.setEnabled(true);
		w.post();
		System.out.print(".. done");
	}

    @Ignore
	@Test(expected=java.net.ConnectException.class)
	public void test_ConnectionRefused() throws ConnectException, IOException{
		SlackNotification w = factory.getSlackNotification(url);
		w.setEnabled(true);
		w.post();
	}

    @Ignore // Is this still relevant?
	@Test(expected=java.io.IOException.class)
	public void test_IOExeption() throws IOException{
		System.out.println("Testing for IO exception");
		SlackNotification w = factory.getSlackNotification(url, "localhost", proxyPort);
		w.setEnabled(true);
		w.post();
		System.out.print(".. done");
	}

    @Test
    public void post_whenResponseIsOk_doesNotThrow() throws IOException {
        ArgumentCaptor<HttpPost> requestCaptor = ArgumentCaptor.forClass(HttpPost.class);
        HttpClient httpClient = mock(HttpClient.class);
        BasicHttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("http", 1, 1), 200, ""));
        PostMessageResponse successfulResponse = new PostMessageResponse();
        successfulResponse.setOk(true);
        successfulResponse.setError("channel_not_found");
        response.setEntity(new StringEntity(successfulResponse.toJson()));

        when(httpClient.execute(requestCaptor.capture())).thenReturn(response);

        SlackNotification w = factory.getSlackNotification(httpClient, "#test-channel");

        SlackNotificationPayloadContent content = new SlackNotificationPayloadContent();
        content.setBuildDescriptionWithLinkSyntax("http://foo");
        content.setCommits(new ArrayList<Commit>());

        w.setPayload(content);
        w.setEnabled(true);
        w.post();

        List<HttpPost> capturedRequests = requestCaptor.getAllValues();
        HttpPost request = capturedRequests.get(0);

        assertNotNull(w.getResponse());
        assertTrue(w.getResponse().getOk());
    }

    @Test
    public void post_whenResponseIsFailure_logsException() throws IOException {
        ArgumentCaptor<HttpPost> requestCaptor = ArgumentCaptor.forClass(HttpPost.class);
        HttpClient httpClient = mock(HttpClient.class);
        BasicHttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("http", 1, 1), 200, ""));
        PostMessageResponse failedResponse = new PostMessageResponse();
        failedResponse.setOk(false);
        failedResponse.setError("channel_not_found");
        response.setEntity(new StringEntity(failedResponse.toJson()));

        when(httpClient.execute(requestCaptor.capture())).thenReturn(response);

        SlackNotification w = factory.getSlackNotification(httpClient, "#test-channel");

        SlackNotificationPayloadContent content = new SlackNotificationPayloadContent();
        content.setBuildDescriptionWithLinkSyntax("http://foo");
        content.setCommits(new ArrayList<Commit>());

        w.setPayload(content);
        w.setEnabled(true);
        w.post();

        assertNotNull(w.getResponse());
        assertFalse(w.getResponse().getOk());
    }

    @Test
	@Ignore
    public void actualTest() throws IOException {
        SlackNotificationImpl impl = new SlackNotificationImpl("#sdfdfgdfg");
        impl.setToken("xoxp-sdfgdfg-2602518dfghdgfh312-dfghd-f93dc2");
        impl.setBotName("foo");
        impl.setTeamName("mmbottest");
        impl.setEnabled(true);
        SlackNotificationPayloadContent content = new SlackNotificationPayloadContent();
        content.setBuildResult("sdfd");
        content.setColor("#ff0000");
        content.setAgentName("fsdf");
        content.setCommits(new ArrayList<Commit>());
        content.setBuildDescriptionWithLinkSyntax("asdf");
        impl.setPayload(content);

        impl.post();

        assertNotNull(impl.getResponse());
        assertFalse(impl.getResponse().getOk());
        assertEquals(impl.getResponse().getError(), "invalid_auth");
    }

    @Test
    public void isApiToken_whenApiTokenIsSupplied_returnsTrue(){
        SlackNotificationImpl impl = new SlackNotificationImpl();
        impl.setToken("xoxp-sdsdfs-3453efgeg-35tefb");
        assertTrue(impl.getIsApiToken());
    }

    @Test
    public void isApiToken_whenOAuthAppTokenIsSupplied_returnsTrue(){
        SlackNotificationImpl impl = new SlackNotificationImpl();
        impl.setToken("34tsrfdgdrtyrysdfg");
        assertFalse(impl.getIsApiToken());
    }

/*
    @Test
	public void test_200() throws FileNotFoundException, IOException, Exception {
        String expectedBody = "";
        HttpClient httpClient = mock(HttpClient.class) ;
        HttpResponse response = null;
        when(httpClient.executeMethod(any(HttpUriRequest.class)))
                .thenReturn(response);
        when(httpClient.execute(any(PostMethod.class))).thenReturn(200);
        when(response.getStatusCode()).thenReturn(200);
        when(response.getBody()).thenReturn("{id:1, name:\"Diego\", surname:\"Castorina\"}"):
		SlackNotification w = factory.getSlackNotification(httpClient, "#test-channel");
		w.setEnabled(true);
		w.post();
		System.out.println(w.getContent());
		assertTrue(w.getStatus() == HttpStatus.SC_OK);
	}

    @Ignore
	@Test
	public void test_NotEnabled() throws FileNotFoundException, IOException, InterruptedException {
		SlackNotificationTestServer s = startWebServer();
		SlackNotification w = factory.getSlackNotification(url + "/200", proxy, proxyPort);
		w.post();
		stopWebServer(s);
		assertTrue(w.getStatus() == null);
	}

    @Ignore
	@Test
	public void test_200WithProxy() throws FileNotFoundException, IOException, InterruptedException {
		SlackNotificationTestServer s = startWebServer();
		SlackNotificationTestProxyServer p = startProxyServer();
		SlackNotification w = factory.getSlackNotification(url + "/200", proxy, proxyPort);
		w.setEnabled(true);
		w.post();
		stopWebServer(s);
		stopProxyServer(p);
		assertTrue(w.getStatus() == HttpStatus.SC_OK);
	}

    @Ignore
	@Test
	public void test_200WithProxyFailAuth() throws FileNotFoundException, IOException, InterruptedException {
		SlackNotificationTestServer s = startWebServer();
		SlackNotificationTestProxyServer p = startProxyServerAuth(proxyUsername, proxyPassword);
		SlackNotification w = factory.getSlackNotification(url + "/200", proxy, proxyPort);
		w.setEnabled(true);
		w.post();
		stopWebServer(s);
		stopProxyServer(p);
		assertTrue(w.getStatus() == HttpServletResponse.SC_PROXY_AUTHENTICATION_REQUIRED);
	}

    @Ignore
	@Test
	public void test_200WithProxyAuth() throws FileNotFoundException, IOException, InterruptedException {
		SlackNotificationTestServer s = startWebServer();
		SlackNotificationTestProxyServer p = startProxyServerAuth(proxyUsername, proxyPassword);
		SlackNotification w = factory.getSlackNotification(url + "/200", proxy, proxyPort);
		w.setEnabled(true);
		w.setProxyUserAndPass(proxyUsername, proxyPassword);
		w.post();
		stopWebServer(s);
		stopProxyServer(p);
		assertTrue(w.getStatus() == HttpStatus.SC_OK);
	}

    @Ignore
	@Test
	public void test_200WithFilename() throws FileNotFoundException, IOException, Exception {
		SlackNotificationTestServer s = startWebServer();
		SlackNotification w = factory.getSlackNotification(url + "/200");
		w.setFilename("src/test/resources/FileThatDoesExist.txt");
		w.setEnabled(true);
		w.post();
		stopWebServer(s);
		assertTrue(w.getStatus() == HttpStatus.SC_OK);
	}

    @Ignore
	@Test
	public void test_200WithFilenameWithProxy() throws FileNotFoundException, IOException, Exception {
		SlackNotificationTestServer s = startWebServer();
		SlackNotificationTestProxyServer p = startProxyServer();
		SlackNotification w = factory.getSlackNotification(url + "/200", proxy, proxyPort);
		w.setFilename("src/test/resources/FileThatDoesExist.txt");
		w.setEnabled(true);
		w.post();
		stopWebServer(s);
		stopProxyServer(p);
		assertTrue(w.getStatus() == HttpStatus.SC_OK);

	}

    @Ignore
	@Test
	public void test_302() throws FileNotFoundException, IOException, Exception {
		SlackNotificationTestServer s = startWebServer();
		SlackNotification w = factory.getSlackNotification(url + "/302");
		w.setEnabled(true);
		w.post();
		stopWebServer(s);
		assertTrue(w.getStatus() == HttpStatus.SC_MOVED_TEMPORARILY);

	}

    @Ignore
	@Test
	public void test_302WithProxy() throws FileNotFoundException, IOException, InterruptedException {
		SlackNotificationTestServer s = startWebServer();
		SlackNotificationTestProxyServer p = startProxyServer();
		SlackNotification w = factory.getSlackNotification(url + "/302", proxy, proxyPort);
		w.setEnabled(true);
		w.post();
		stopWebServer(s);
		stopProxyServer(p);
		assertTrue(w.getStatus() == HttpStatus.SC_MOVED_TEMPORARILY);

	}

    @Ignore
	@Test
	public void test_404WithProxyStringPort() throws FileNotFoundException, IOException, InterruptedException {
		SlackNotificationTestServer s = startWebServer();
		SlackNotificationTestProxyServer p = startProxyServer();
		SlackNotification w = factory.getSlackNotification(url + "/404", proxy, proxyPortString);
		w.setEnabled(true);
		w.post();
		stopWebServer(s);
		stopProxyServer(p);
		assertTrue(w.getStatus() == HttpStatus.SC_NOT_FOUND);

	}

    @Ignore
	@Test
	public void test_404WithProxyConfig() throws FileNotFoundException, IOException, InterruptedException {
		SlackNotificationTestServer s = startWebServer();
		SlackNotificationTestProxyServer p = startProxyServer();
		SlackNotificationProxyConfig pc = new SlackNotificationProxyConfig(proxy, Integer.parseInt(proxyPortString));
		SlackNotification w = factory.getSlackNotification(url + "/404", pc);
		w.setEnabled(true);
		w.post();
		stopWebServer(s);
		stopProxyServer(p);
		assertTrue(w.getStatus() == HttpStatus.SC_NOT_FOUND);
	}

    @Ignore
	@Test
	public void test_302WithFilename() throws FileNotFoundException, IOException, Exception {
		SlackNotificationTestServer s = startWebServer();
		SlackNotification w = factory.getSlackNotification(url + "/302");
		w.setFilename("src/test/resources/FileThatDoesExist.txt");
		w.setEnabled(true);
		w.post();
		stopWebServer(s);
		assertTrue(w.getStatus() == HttpStatus.SC_MOVED_TEMPORARILY);

	}

    @Ignore
	@Test
	public void test_302WithFilenameWithProxy() throws FileNotFoundException, IOException, Exception {
		SlackNotificationTestServer s = startWebServer();
		SlackNotificationTestProxyServer p = startProxyServer();
		SlackNotification w = factory.getSlackNotification(url + "/302", proxy, proxyPort);
		w.setFilename("src/test/resources/FileThatDoesExist.txt");
		w.setEnabled(true);
		w.post();
		stopWebServer(s);
		stopProxyServer(p);
		assertTrue(w.getStatus() == HttpStatus.SC_MOVED_TEMPORARILY);

	}

	@Ignore
	public void test_SlackNotificationCollection() throws SlackNotificationParameterReferenceException {
		Map <String, String> params = new HashMap<String, String>();
		params.put("system.slacknotifications.1.url", url);
		params.put("system.slacknotifications.1.enabled", "true");
		params.put("system.slacknotifications.1.parameter.1.name","fod");
		params.put("system.slacknotifications.1.parameter.1.value","baa");
		params.put("system.slacknotifications.1.parameter.2.name","slash");
		params.put("system.slacknotifications.1.parameter.2.value","dot");
		params.put("system.slacknotifications.2.url", url + "/something");
		params.put("system.slacknotifications.2.enabled", "false");
		params.put("system.slacknotifications.2.parameter.1.name","foo");
		params.put("system.slacknotifications.2.parameter.1.value","bar");
		SlackNotificationCollection whc = new SlackNotificationCollection(params);
		System.out.println("Test 1" + whc.getSlackNotifications().get(1).getParameterisedUrl());
		System.out.println("Test 2" + whc.getSlackNotifications().get(2).getParameterisedUrl());
		assertTrue(whc.getSlackNotifications().get(1).getChannel().equals(url));
		assertTrue((whc.getSlackNotifications().get(1).getParameterisedUrl().equals(url + "?fod=baa&slash=dot"))
				|| (whc.getSlackNotifications().get(1).getParameterisedUrl().equals(url + "?slash=dot&fod=baa")));
		assertTrue(whc.getSlackNotifications().get(2).getParameterisedUrl().equals(url + "/something?foo=bar"));
		assertFalse(whc.getSlackNotifications().get(1).isErrored());
	}

	@Ignore
	public void test_SlackNotificationCollectionWithRecursiveParameterReference() throws SlackNotificationParameterReferenceException {
		Map <String, String> params = new HashMap<String, String>();
		params.put("system.test.recursive1", "%system.test.recursive2%");
		params.put("system.test.recursive2", "blahblah");
		params.put("system.slacknotifications.1.url", url);
		params.put("system.slacknotifications.1.enabled", "true");
		params.put("system.slacknotifications.1.parameter.1.name","foo");
		params.put("system.slacknotifications.1.parameter.1.value","bar");
		params.put("system.slacknotifications.1.parameter.2.name","slash");
		params.put("system.slacknotifications.1.parameter.2.value","%system.test.recursive1%");
		SlackNotificationCollection whc = new SlackNotificationCollection(params);
		System.out.println("Test 1" + whc.getSlackNotifications().get(1).getParameterisedUrl());
		assertTrue(whc.getSlackNotifications().get(1).getChannel().equals(url));
		assertTrue((whc.getSlackNotifications().get(1).getParameterisedUrl().equals(url + "?foo=bar&slash=blahblah"))
				|| (whc.getSlackNotifications().get(1).getParameterisedUrl().equals(url + "?slash=blahblah&foo=bar")));
		assertFalse(whc.getSlackNotifications().get(1).isErrored());
	}

	@Ignore
	public void test_SlackNotificationCollectionWithNonExistantRecursiveParameterReference(){
		Map <String, String> params = new HashMap<String, String>();
		params.put("system.test.recursive1", "%system.test.recursive3%");
		params.put("system.test.recursive2", "blahblah");
		params.put("system.slacknotifications.1.url", url);
		params.put("system.slacknotifications.1.enabled", "true");
		params.put("system.slacknotifications.1.parameter.1.name","foo");
		params.put("system.slacknotifications.1.parameter.1.value","bar");
		params.put("system.slacknotifications.1.parameter.2.name","slash");
		params.put("system.slacknotifications.1.parameter.2.value","%system.test.recursive1%");
		SlackNotificationCollection whc = new SlackNotificationCollection(params);
		System.out.println("Test 1" + whc.getSlackNotifications().get(1).getParameterisedUrl());
		assertTrue(whc.getSlackNotifications().get(1).getChannel().equals(url));
		assertTrue(whc.getSlackNotifications().get(1).getParameterisedUrl().equals(url + "?foo=bar"));
		assertTrue(whc.getSlackNotifications().get(1).isErrored());
		System.out.println(whc.getSlackNotifications().get(1).getErrorReason());
	}

    public void test_SlackNotificationCollectionWithPost() throws SlackNotificationParameterReferenceException, InterruptedException {
		Map <String, String> params = new HashMap<String, String>();
		//params.put("system.slacknotifications.1.url", url + "/200");
		params.put("system.slacknotifications.1.url", "http://localhost/slacknotifications/" );
		params.put("system.slacknotifications.1.enabled", "true");
		params.put("system.slacknotifications.1.parameter.1.name","fod");
		params.put("system.slacknotifications.1.parameter.1.value","baa");
		params.put("system.slacknotifications.1.parameter.2.name","slash");
		params.put("system.slacknotifications.1.parameter.2.value","dot");
		params.put("system.slacknotifications.2.url", "http://localhost/slacknotifications/test/" );
		params.put("system.slacknotifications.2.enabled", "true");
		SlackNotificationCollection whc = new SlackNotificationCollection(params);
		SlackNotificationTestServer s = startWebServer();
		for (Iterator<SlackNotification> i = whc.getSlackNotificationsAsCollection().iterator(); i.hasNext();){
			SlackNotification wh = i.next();
			try {
					wh.post();
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				//Loggers.SERVER.error(e.toString());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				//Loggers.SERVER.error(e.toString());
			}
		}
		stopWebServer(s);
		assertTrue(whc.getSlackNotifications().get(1).getStatus() == HttpStatus.SC_OK);
		assertTrue(whc.getSlackNotifications().get(2).getStatus() == HttpStatus.SC_NOT_FOUND);
	}
	*/
	public SlackNotificationTestServer startWebServer(){
		try {
			SlackNotificationTestServer s = new SlackNotificationTestServer(webserverHost, webserverPort);
			s.server.start();
			return s;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public void stopWebServer(SlackNotificationTestServer s) throws InterruptedException {
		try {
			s.server.stop();
			// Sleep to let the server shutdown cleanly.
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			Thread.sleep(1000);
		}
	}

	public SlackNotificationTestProxyServer startProxyServer(){
		try {
			SlackNotificationTestProxyServer p = new SlackNotificationTestProxyServer(webserverHost, proxyserverPort);
			p.server.start();
			return p;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public SlackNotificationTestProxyServer startProxyServerAuth(String username, String password){
		try {
			SlackNotificationTestProxyServer p = new SlackNotificationTestProxyServer(webserverHost, proxyserverPort,
					username, password);
			p.server.start();
			return p;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public void stopProxyServer(SlackNotificationTestProxyServer p) {
		try {
			p.server.stop();
			// Sleep to let the server shutdown cleanly.
			Thread.sleep(1000);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}


text:
layout: post
title: Being Phileas Fogg, Day 5
date: 2007-09-08 23:37:51.000000000 +01:00
categories:
- Personal
tags: []
status: publish
type: post
published: true
meta:
  tmac_last_id: '531409219338371073'
author:
  login: admin
  email: brunofr@olympum.com
  display_name: Bruno Fernandez-Ruiz
  first_name: Bruno
  last_name: Fernandez-Ruiz
---

The flight to Singapore left close to midnight, and I had to go
through only 6 security checks, one person checking after another that
the previous one had done their job. It's always surprising to me to
see how in India things are not necessarily always done in the most
efficient ways. But then again, it is in fact and optimal utility
point, since given the low cost of labour there is no incentive for
being efficient in manual processes.

The flights with Singapore Airlines were fine, although the plane between Bangalore and Singapore was much older and rather run down than the one between Singapore and Seoul. The service however in both of them was exceptional. Singapore Airlines is always an amazing experience.

I did watch the last movie of the Pirates of the Caribbean, whatever is called, since I did not manage to sleep, at all. As we landed in Seoul, I saw an unbranded Airbus A380 in Seoul/Incheon being taxied. That plane, a double decker, is simply huge. I wonder what it was doing there, and where it was going to. It looked like a promotional plane for Airbus perhaps going or coming from some event or show.

The taxi was waiting for me, unlike in Bangalore, and it took us a bit over an hour to get the the Grand Intercontinental. It's a suberb hotel. Highly recommended, and example of the elegance and fine, delicate treatment of Asia.

It was my first time in Korea, and I was definitely impressed. Pity that everything is so expensive. I can see Korea might having trouble, alike Japan, to compete with China.


text:
// Contents of platform.h

#ifndef _SRCH2Lib_DLLDEFINES_H_
#define _SRCH2Lib_DLLDEFINES_H_

/*
Buildfiles will define MyLibrary_EXPORTS on Windows where it is
configured to build a shared library. If you are going to use
another build system on windows or create the visual studio
projects by hand you need to define MyLibrary_EXPORTS when
building a DLL on windows.
By default, srch2 build infrastructure uses the Visual Studio
Compiler and builds Shared libraries on Windows platform.
*/
namespace srch2
{
namespace instantsearch
{

#if defined (_WIN32)
  #if defined(srch2_instantsearch_EXPORTS)
    #define  MYLIB_EXPORT __declspec(dllexport)
  #else
    #define  MYLIB_EXPORT __declspec(dllimport)
  #endif /* MyLibrary_EXPORTS */
#else /* defined (_WIN32) */
 #define MYLIB_EXPORT
#endif
}}

#endif /* _SRCH2Lib_DLLDEFINES_H_ */


text:
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "has_ip_address" do
  describe "with default column" do
    before do
      build_model :visits do
        integer :ip_address
        has_ip_address
      end
    end

    describe "and setting and getting" do
      before do
        visit = Visit.new

        visit.ip_address = "127.0.0.1"

        @ip_address = visit.ip_address
      end

      it "should be a IPAddr" do
        @ip_address.should be_kind_of(IPAddr)
      end

      it "should return the set value when got" do
        @ip_address.should == IPAddr.new("127.0.0.1")
      end

    end
  end

  describe "with default column" do
    before do
      build_model :visits do
        integer :visitor_ip
        has_ip_address :visitor_ip
      end
    end

    describe "and setting and getting" do
      before do
        visit = Visit.new

        visit.visitor_ip = "192.168.0.1"

        @ip_address = visit.visitor_ip
      end

      it "should be a IPAddr" do
        @ip_address.should be_kind_of(IPAddr)
      end

      it "should return the set value when got" do
        @ip_address.should == IPAddr.new("192.168.0.1")
      end

    end
  end
end


text:
source tests/bash-test-helpers.bash || exit
demand_at_top_level || exit

num_fails=0
num_checks=1
if ! bash tests/test-logger.sh
then
    num_fails=$(expr 1 + ${num_fails})
fi
f=0
if ! ./tests/integration-tests.sh
then
    f=1
fi
k=0
if ! ./tests/local-repos-tests.sh
then
    k=1
fi
t=0
if ! ./tests/ws-requiring-tests.sh
then
    t=1
fi
s=0
if ! python setup.py test
then
    s=1
fi
if test ${num_fails} -eq 0
then
    echo "Passed all test-logger.sh script tests."
else
    echo "Failed at least one test-logger.sh script tests."
fi
if test ${f} -eq 0
then
    echo "Passed all integration-tests.sh tests."
else
    echo "Failed at least one integration-tests.sh script tests."
fi
if test ${k} -eq 0
then
    echo "Passed all local-repo-tests.sh test."
else
    echo "Failed at least one local-repo-tests.sh test."
fi
if test ${t} -eq 0
then
    echo "Passed all ws-requiring tests."
else
    echo "Failed at least one ws-requiring test"
fi
exit $(expr ${f} + ${k} + ${s} + ${t} + ${num_fails})


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="de7ae317-2fea-4163-b679-082b61d23484" name="Default" comment="" />
    <ignored path="StudentsAPI.iws" />
    <ignored path=".idea/workspace.xml" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="StudentsAPI" />
  </component>
  <component name="FileEditorManager">
    <leaf>
      <file leaf-file-name="index.html" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/index.html">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.41081703">
              <caret line="21" column="7" selection-start-line="21" selection-start-column="7" selection-end-line="21" selection-end-column="7" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="config.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/config.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="11" column="3" selection-start-line="11" selection-start-column="3" selection-end-line="11" selection-end-column="3" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="app.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/scripts/app.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="46" column="51" selection-start-line="46" selection-start-column="51" selection-end-line="46" selection-end-column="51" />
              <folding>
                <element signature="n#!!doc" expanded="true" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="ui.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/scripts/ui.js">
          <provider selected="true" editor-type-id="text-editor">
<<<<<<< HEAD
            <state vertical-scroll-proportion="0.6266892">
              <caret line="74" column="5" selection-start-line="74" selection-start-column="5" selection-end-line="74" selection-end-column="5" />
=======
            <state vertical-scroll-proportion="0.0">
              <caret line="48" column="0" selection-start-line="48" selection-start-column="0" selection-end-line="48" selection-end-column="0" />
>>>>>>> ff56a9cf990f8a078d3213ba88e1fb65b8c3ea9a
              <folding>
                <element signature="n#!!doc" expanded="true" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="templates.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/scripts/templates.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="54" column="5" selection-start-line="54" selection-start-column="5" selection-end-line="54" selection-end-column="5" />
              <folding>
                <element signature="n#!!doc" expanded="true" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="logic.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/scripts/logic.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="21" column="17" selection-start-line="21" selection-start-column="17" selection-end-line="21" selection-end-column="17" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="events.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/scripts/events.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="42" column="0" selection-start-line="42" selection-start-column="0" selection-end-line="42" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="studentById.html" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/templates/studentById.html">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="0" column="29" selection-start-line="0" selection-start-column="29" selection-end-line="0" selection-end-column="29" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="allStudents.html" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/templates/allStudents.html">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="8" column="29" selection-start-line="8" selection-start-column="29" selection-end-line="8" selection-end-column="29" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="data.json" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/data/data.json">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="29" column="0" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="FileTemplateManagerImpl">
    <option name="RECENT_TEMPLATES">
      <list>
        <option value="JavaScript File" />
        <option value="Html5" />
      </list>
    </option>
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/navigation.html" />
        <option value="$PROJECT_DIR$/allStudents.html" />
        <option value="$PROJECT_DIR$/studentById.html" />
        <option value="$PROJECT_DIR$/templates/hoverMenu.html" />
        <option value="$PROJECT_DIR$/templates/navigation.html" />
        <option value="$PROJECT_DIR$/scripts/templates.js" />
        <option value="$PROJECT_DIR$/templates/grid.html" />
        <option value="$PROJECT_DIR$/data/data.json" />
        <option value="$PROJECT_DIR$/index.html" />
        <option value="$PROJECT_DIR$/scripts/app.js" />
        <option value="$PROJECT_DIR$/scripts/events.js" />
        <option value="$PROJECT_DIR$/templates/studentForm.html" />
        <option value="$PROJECT_DIR$/templates/allStudents.html" />
        <option value="$PROJECT_DIR$/templates/studentById.html" />
        <option value="$PROJECT_DIR$/scripts/ui.js" />
        <option value="$PROJECT_DIR$/scripts/logic.js" />
        <option value="$PROJECT_DIR$/config.js" />
      </list>
    </option>
  </component>
  <component name="JsBuildToolGruntFileManager" detection-done="true" />
  <component name="JsGulpfileManager">
    <detection-done>true</detection-done>
  </component>
  <component name="NamedScopeManager">
    <order />
  </component>
  <component name="ProjectFrameBounds">
    <option name="x" value="-8" />
    <option name="y" value="-8" />
    <option name="width" value="1936" />
    <option name="height" value="1056" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="0" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
    </navigator>
    <panes>
      <pane id="Scratches" />
      <pane id="Scope" />
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="StudentsAPI" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="StudentsAPI" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="StudentsAPI" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="StudentsAPI" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="StudentsAPI" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="templates" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="StudentsAPI" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="StudentsAPI" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="scripts" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="settings.editor.selected.configurable" value="JavaScript.Libraries" />
    <property name="settings.editor.splitter.proportion" value="0.2" />
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="HbShouldOpenHtmlAsHb" value="" />
    <property name="DefaultHtmlFileTemplate" value="Html5" />
    <property name="recentsLimit" value="5" />
    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
    <property name="JavaScriptLanguageLevel" value="ES6" />
    <property name="FullScreen" value="false" />
  </component>
  <component name="RecentsManager">
    <key name="CopyFile.RECENT_KEYS">
      <recent name="D:\Malkie\Telerik\JavaScript\JavaScriptApplications\StudentsAPI\libs" />
    </key>
    <key name="MoveFile.RECENT_KEYS">
      <recent name="D:\Malkie\Telerik\JavaScript\JavaScriptApplications\StudentsAPI\templates" />
    </key>
  </component>
  <component name="RunManager" selected="JavaScript Debug.index.html">
    <configuration default="false" name="index.html" type="JavascriptDebugType" factoryName="JavaScript Debug" temporary="true" nameIsGenerated="true" uri="http://localhost:63342/StudentsAPI/index.html">
      <method />
    </configuration>
    <configuration default="false" name="index.html (1)" type="JavascriptDebugType" factoryName="JavaScript Debug" temporary="true" nameIsGenerated="true" uri="http://localhost:1071/StudentsAPI/index.html">
      <method />
    </configuration>
    <configuration default="false" name="index.html (2)" type="JavascriptDebugType" factoryName="JavaScript Debug" temporary="true" nameIsGenerated="true" uri="http://localhost:1106/StudentsAPI/index.html">
      <method />
    </configuration>
    <configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application">
      <method />
    </configuration>
    <configuration default="true" type="DartUnitRunConfigurationType" factoryName="DartUnit">
      <method />
    </configuration>
    <configuration default="true" type="JavaScriptTestRunnerKarma" factoryName="Karma" config-file="">
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
      <method />
    </configuration>
    <configuration default="true" type="JsTestDriver-test-runner" factoryName="JsTestDriver">
      <setting name="configLocationType" value="CONFIG_FILE" />
      <setting name="settingsFile" value="" />
      <setting name="serverType" value="INTERNAL" />
      <setting name="preferredDebugBrowser" value="Chrome" />
      <method />
    </configuration>
    <configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" working-dir="">
      <method />
    </configuration>
    <configuration default="true" type="cucumber.js" factoryName="Cucumber.js">
      <option name="cucumberJsArguments" value="" />
      <option name="executablePath" />
      <option name="filePath" />
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
      <node-options />
      <gulpfile />
      <tasks />
      <arguments />
      <pass-parent-envs>true</pass-parent-envs>
      <envs />
      <method />
    </configuration>
    <list size="3">
      <item index="0" class="java.lang.String" itemvalue="JavaScript Debug.index.html" />
      <item index="1" class="java.lang.String" itemvalue="JavaScript Debug.index.html (1)" />
      <item index="2" class="java.lang.String" itemvalue="JavaScript Debug.index.html (2)" />
    </list>
    <recent_temporary>
      <list size="3">
        <item index="0" class="java.lang.String" itemvalue="JavaScript Debug.index.html" />
        <item index="1" class="java.lang.String" itemvalue="JavaScript Debug.index.html (2)" />
        <item index="2" class="java.lang.String" itemvalue="JavaScript Debug.index.html (1)" />
      </list>
    </recent_temporary>
  </component>
  <component name="ShelveChangesManager" show_recycled="false" />
  <component name="SvnConfiguration">
    <configuration />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="de7ae317-2fea-4163-b679-082b61d23484" name="Default" comment="" />
      <created>1441095441831</created>
      <option name="number" value="Default" />
      <updated>1441095441831</updated>
    </task>
    <servers />
  </component>
  <component name="ToolWindowManager">
<<<<<<< HEAD
    <frame x="-8" y="-8" width="1382" height="754" extended-state="6" />
=======
    <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
>>>>>>> ff56a9cf990f8a078d3213ba88e1fb65b8c3ea9a
    <editor active="false" />
    <layout>
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24791667" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
      <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="Vcs.Log.UiProperties">
    <option name="RECENTLY_FILTERED_USER_GROUPS">
      <collection />
    </option>
    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
      <collection />
    </option>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="VcsManagerConfiguration">
    <ignored-roots>
      <path value="$PROJECT_DIR$/../../.." />
    </ignored-roots>
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager>
      <option name="time" value="1" />
    </breakpoint-manager>
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/scripts/app.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="60" column="29" selection-start-line="60" selection-start-column="15" selection-end-line="60" selection-end-column="29" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/ui.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="74" column="5" selection-start-line="74" selection-start-column="5" selection-end-line="74" selection-end-column="5" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/allStudents.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="5" column="77" selection-start-line="5" selection-start-column="4" selection-end-line="5" selection-end-column="77" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/studentById.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/templates.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="54" column="5" selection-start-line="54" selection-start-column="5" selection-end-line="54" selection-end-column="5" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/logic.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="43" column="0" selection-start-line="43" selection-start-column="0" selection-end-line="43" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/events.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="42" column="0" selection-start-line="42" selection-start-column="0" selection-end-line="42" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/navigation.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="18" column="13" selection-start-line="18" selection-start-column="13" selection-end-line="18" selection-end-column="13" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/data/data.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="29" column="0" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="9" column="27" selection-start-line="9" selection-start-column="27" selection-end-line="9" selection-end-column="27" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/app.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="60" column="29" selection-start-line="60" selection-start-column="15" selection-end-line="60" selection-end-column="29" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/ui.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/templates.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="54" column="5" selection-start-line="54" selection-start-column="5" selection-end-line="54" selection-end-column="5" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/logic.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="20" column="0" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/events.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="19" column="0" selection-start-line="19" selection-start-column="0" selection-end-line="19" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/navigation.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="18" column="13" selection-start-line="18" selection-start-column="13" selection-end-line="18" selection-end-column="13" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/data/data.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="2" column="1" selection-start-line="2" selection-start-column="1" selection-end-line="2" selection-end-column="1" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="21" column="7" selection-start-line="21" selection-start-column="7" selection-end-line="21" selection-end-column="7" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/ui.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="48" column="39" selection-start-line="48" selection-start-column="39" selection-end-line="48" selection-end-column="39" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/grid.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="25" selection-start-line="0" selection-start-column="25" selection-end-line="0" selection-end-column="25" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/app.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="43" column="27" selection-start-line="43" selection-start-column="27" selection-end-line="43" selection-end-column="27" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/logic.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="26" column="21" selection-start-line="26" selection-start-column="21" selection-end-line="26" selection-end-column="21" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/templates.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/events.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="9" column="40" selection-start-line="9" selection-start-column="40" selection-end-line="9" selection-end-column="40" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/data/data.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/studentById.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="6" column="7" selection-start-line="6" selection-start-column="7" selection-end-line="6" selection-end-column="7" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/allStudents.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="6" column="7" selection-start-line="6" selection-start-column="7" selection-end-line="6" selection-end-column="7" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="12" column="7" selection-start-line="12" selection-start-column="7" selection-end-line="12" selection-end-column="7" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/ui.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="21" column="0" selection-start-line="21" selection-start-column="0" selection-end-line="21" selection-end-column="0" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/templates.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/logic.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/events.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="3" column="0" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/allStudents.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="3" column="31" selection-start-line="3" selection-start-column="31" selection-end-line="3" selection-end-column="31" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/studentById.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/navigation.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="18" column="5" selection-start-line="18" selection-start-column="5" selection-end-line="18" selection-end-column="5" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/app.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="16" column="0" selection-start-line="16" selection-start-column="0" selection-end-line="16" selection-end-column="0" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/libs/chai.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/bower_components/system.js/dist/system.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-0.6851211">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/hoverMenu.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-0.68">
          <caret line="1" column="129" selection-start-line="1" selection-start-column="17" selection-end-line="1" selection-end-column="129" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/grid.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.29982364">
          <caret line="10" column="0" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/navigation.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="18" column="13" selection-start-line="18" selection-start-column="13" selection-end-line="18" selection-end-column="13" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/data/data.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="29" column="0" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/templates.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="54" column="5" selection-start-line="54" selection-start-column="5" selection-end-line="54" selection-end-column="5" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/studentById.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="29" selection-start-line="0" selection-start-column="29" selection-end-line="0" selection-end-column="29" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/templates/allStudents.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="8" column="29" selection-start-line="8" selection-start-column="29" selection-end-line="8" selection-end-column="29" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/events.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="42" column="0" selection-start-line="42" selection-start-column="0" selection-end-line="42" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/ui.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="48" column="0" selection-start-line="48" selection-start-column="0" selection-end-line="48" selection-end-column="0" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/logic.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="21" column="17" selection-start-line="21" selection-start-column="17" selection-end-line="21" selection-end-column="17" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/scripts/app.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="46" column="51" selection-start-line="46" selection-start-column="51" selection-end-line="46" selection-end-column="51" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/config.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="11" column="3" selection-start-line="11" selection-start-column="3" selection-end-line="11" selection-end-column="3" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/index.html">
      <provider selected="true" editor-type-id="text-editor">
<<<<<<< HEAD
        <state vertical-scroll-proportion="0.6266892">
          <caret line="74" column="5" selection-start-line="74" selection-start-column="5" selection-end-line="74" selection-end-column="5" />
          <folding>
            <element signature="n#!!doc" expanded="true" />
          </folding>
=======
        <state vertical-scroll-proportion="0.41081703">
          <caret line="21" column="7" selection-start-line="21" selection-start-column="7" selection-end-line="21" selection-end-column="7" />
          <folding />
>>>>>>> ff56a9cf990f8a078d3213ba88e1fb65b8c3ea9a
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
(function simpleWalkInit(module) {
    'use strict';

    var _ = require('underscore');
    var fs = require('fs');

    var obj = {
        match: function (path, matchRule) {
            var result = [];

            if (path.indexOf('**') >= 0) {
                var paths = path.split('**') || [];
                // TODO for all the cases not only === 2
                if (paths.length === 2) {
                    var list = fs.readdirSync(paths[0]) || [];
                    result = _.reduce(list, function (memo, item) {
                        var itemPath = paths[0] + item;
                        var itemStat = fs.statSync(itemPath);
                        if (itemStat.isDirectory()) {
                            memo = _.union(memo, obj.match(itemPath + paths[1], matchRule));
                        }
                        return memo;
                    }, []);
                }
            } else if (fs.existsSync(path)) {
                var stats = fs.statSync(path);
                if (stats.isFile()) {
                    var match = path.match(matchRule) || [];
                    if (match.length === 1) {
                        result.push(path);
                    }
                } else if (stats.isDirectory()) {
                    var list = fs.readdirSync(path) || [];
                    list.forEach(function (dir) {
                        result = _.union(result, obj.match(path + '/' + dir, matchRule));
                    });
                }
            }

            return result;
        }
    };

    module.exports = {
        match: function (path, matchRule) {
            return obj.match(path, matchRule);
        }
    };
})(module);


text:
import {Example} from "./Example";

const title: string = 'Input. A replacement for the "prompt" function';

const snippet: string = `
<SweetAlert
  input
  showCancel
  cancelBtnBsStyle="light"
  title="An input!"
  placeHolder="Write something"
  onConfirm={(response) => this.onReceiveInput(response)}
  onCancel={this.onCancel}
>
  Write something interesting:
</SweetAlert>
`;

export default new Example(title, snippet);


text: <link rel="import" href="theme/lumo/vaadin-password-field.html">


text:
using Castle.Components.Validator;

namespace Cuyahoga.Core.Validation
{
	public class CuyDateTimeValidator : DateTimeValidator
	{
		public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, System.Collections.IDictionary attributes, string target)
		{
			base.ApplyBrowserValidation(config, inputType, generator, attributes, target);
			generator.SetDate(target, BuildErrorMessage());
		}
	}
}


text:
package uk.gov.nationalarchives.droid.export;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang.time.StopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import uk.gov.nationalarchives.droid.core.interfaces.filter.Filter;
import uk.gov.nationalarchives.droid.export.interfaces.ExportOptions;
import uk.gov.nationalarchives.droid.export.interfaces.ItemReader;
import uk.gov.nationalarchives.droid.export.interfaces.ItemReaderCallback;
import uk.gov.nationalarchives.droid.export.interfaces.ItemWriter;
import uk.gov.nationalarchives.droid.export.interfaces.JobCancellationException;
import uk.gov.nationalarchives.droid.profile.ProfileContextLocator;
import uk.gov.nationalarchives.droid.profile.ProfileInstance;
import uk.gov.nationalarchives.droid.profile.ProfileInstanceManager;
import uk.gov.nationalarchives.droid.profile.ProfileResourceNode;

/**
 * @author rflitcroft, Brian O'Reilly
 *
 */
public class ExportTask implements Runnable {

    private static final String PROJECT_NOT_AVAILABLE_FOR_EXPORT = "Profile not available for export: %s";
    private static final int BOM_1 = 0xEF;
    private static final int BOM_2 = 0xBB;
    private static final int BOM_3 = 0xBF;

    private final Logger log = LoggerFactory.getLogger(getClass());

    private final String destination;
    private final List<String> profileIds;
    private final Filter filterOverride;
    private final ExportOptions options;
    private final String outputEncoding;
    private final boolean bom;
    private final ItemWriter<ProfileResourceNode> itemWriter;
    private final ProfileContextLocator profileContextLocator;

    private volatile boolean cancelled;

    /**
     * @param destination Output file path
     * @param profileIds ids of the profiles to export
     * @param filterOverride the override filter
     * @param options options for the export file format
     * @param outputEncoding A charset encoding for the output file, or null indicates platform locale encoding
     * @param bom Add bom to the file.
     * @param itemWriter The writer for writing the export items
     * @param profileContextLocator locator of the profile context
     */
    public ExportTask(final String destination, final List<String> profileIds,
            final Filter filterOverride, final ExportOptions options,
            final String outputEncoding, final boolean bom, final ItemWriter<ProfileResourceNode> itemWriter,
            final ProfileContextLocator profileContextLocator) {
        this.destination = destination;
        this.profileIds = profileIds;
        this.filterOverride = filterOverride;
        this.options = options;
        this.outputEncoding = outputEncoding;
        this.bom = bom;
        this.itemWriter = itemWriter;
        this.profileContextLocator = profileContextLocator;
    }

    /**
     * Cancels the task.
     */
    public void cancel() {
        cancelled = true;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void run() {
        final Writer writer;
        final String destinationDescription = destination == null ? "System.out" : destination;
        if (destination == null) {
            writer = new PrintWriter(System.out);
        } else {
            try {
                writer = newOutputFileWriter();
            } catch (IOException e) {
                String message = String.format("IO exception occurred trying to read from: %s",
                        destinationDescription);
                log.error(message, e);
                throw new RuntimeException(message, e);
            }
        }
        doExport(writer, destinationDescription);
    }

    /**
     * Creates a new writer for the output file.
     *
     * @return The writer for the output file
     * @throws IOException if an IO error occurs during establishing
     *  a writer for the file
     */
    protected Writer newOutputFileWriter() throws IOException {
        final Writer writer;

        //set encoding of output file
        if (outputEncoding != null) {
            writer = newOutputFileWriterEncoded(outputEncoding, Paths.get(destination));
        } else {
            writer = newOutputFileWriterEncoded(Charset.defaultCharset().name(), Paths.get(destination));
        }

        return writer;
    }

    /**
     * Creates a new writer for the output file using a specific encoding for
     * the file content.
     *
     * @param encoding The character encoding for the output file content
     * @param f The file to create a writer for
     *
     * @return The writer for the output file
     * @throws IOException if an IO error occurs during establishing
     *  a writer for the file
     */
    protected Writer newOutputFileWriterEncoded(final String encoding, final Path f) throws IOException {
        final OutputStream outputStream = Files.newOutputStream(f);
        if (bom) {
            outputStream.write(BOM_1);
            outputStream.write(BOM_2);
            outputStream.write(BOM_3);
            outputStream.flush();
        }
        return new BufferedWriter(new OutputStreamWriter(outputStream, encoding));
    }

    private void doExport(final Writer writer, final String destinationDescription) {
        log.info(String.format("Exporting profiles to: [%s]", destinationDescription));

        //BNO - amended to add header customisations for different hash algorithms
        Map<String, String> headerCustomisations = getHeaderCustomisationsFromProfiles();
        itemWriter.setHeaders(headerCustomisations);
        itemWriter.setOptions(options);
        itemWriter.open(writer);

        StopWatch stopWatch = new StopWatch();
        try {
            for (String profileId : profileIds) {
                stopWatch.start();
                if (!profileContextLocator.hasProfileContext(profileId)) {
                    final String message = String.format(PROJECT_NOT_AVAILABLE_FOR_EXPORT, profileId);
                    log.warn(message);
                    throw new RuntimeException(message);
                }
                ProfileInstance profile = profileContextLocator.getProfileInstance(profileId);
                ProfileInstanceManager profileContext = profileContextLocator.openProfileInstanceManager(profile);
                ItemReader<ProfileResourceNode> reader = profileContext.getNodeItemReader();
                ItemReaderCallback<ProfileResourceNode> callback = new ItemReaderCallback<ProfileResourceNode>() {
                    @Override
                    public void onItem(List<? extends ProfileResourceNode> itemChunk)
                        throws JobCancellationException {
                        itemWriter.write(itemChunk);
                        if (cancelled) {
                            log.info("Export interrupted");
                            throw new JobCancellationException("Cancelled");
                        }
                    }
                };

                Filter filter = filterOverride != null ? filterOverride : profile.getFilter();
                reader.readAll(callback, filter);
                stopWatch.stop();
                log.info(String.format("Time for export [%s]: %s ms", profileId, stopWatch.getTime()));
                stopWatch.reset();
            }
        } catch (JobCancellationException e) {
            String message = String.format("Export cancelled - deleting export destination: %s",
                    destinationDescription);
            log.info(message);
            cancelled = true;
        } finally {
            log.info(String.format("Closing export file: %s", destinationDescription));
            itemWriter.close();
            if (cancelled && destination != null) {
                final Path toDelete = Paths.get(destination);

                if (Files.exists(toDelete)) {
                    try {
                        Files.deleteIfExists(toDelete);
                    } catch (final IOException ioe) {
                        log.warn(String.format("Could not delete export file: %s. "
                                + "Will try to delete on exit.", destination));
                        toDelete.toFile().deleteOnExit();
                    }
                }
            }
        }
    }

    private Map<String, String> getHeaderCustomisationsFromProfiles() {

        // Brian O'Reilly, July 2014:
        // Customises the column headers for the export output.  Currently (July 2014), only the column header
        // for the hash algorithm needs to be customised depending on whether or not the profile(s) selected
        // for export contain hash algorithms, and if so
        // whether all the selected profiles use the same algorithm.
        Map<String, String> map = new HashMap<String, String>();
        String hashAlgorithmHeader = "HASH";
        Set<String> algorithmsFound = new HashSet<String>();

        for (String profileId : this.profileIds) {
            if (!this.profileContextLocator.hasProfileContext(profileId)) {
                final String message = String.format(PROJECT_NOT_AVAILABLE_FOR_EXPORT, profileId);
                log.warn(message);
                throw new RuntimeException(message);
            }
            ProfileInstance profile = profileContextLocator.getProfileInstance(profileId);
            if (profile.getGenerateHash()) {
                algorithmsFound.add(profile.getHashAlgorithm().toUpperCase());
            }
        }

        // If the count is 1, this means that at least one profile in the export cohort was run with hash generation,
        // and that only a single hash algorithm was used for all the profiles in the export (e.g. not one with MD5
        // and one with SHa256). If so, we can set the column header to reflect the specific hash - otherwise we use
        //the generic "HASH" header.
        if (algorithmsFound.size() == 1) {
            hashAlgorithmHeader = algorithmsFound.iterator().next() + "_HASH";
        }

        map.put("hash", hashAlgorithmHeader);
        return map;
    }
}