text:
require 'rails_helper'

describe "questions/show.html.erb", type: :view do
  # question must be created (instead builded) because the hashtags are used
  # in show view, and they are created only when the question is saved.
  let(:question) { create(:question) }
  before do
    assign(:question, question)
    assign(:user, build(:user))
    assign(:answer, build(:answer))
    render template: "questions/show", layout: "layouts/application"
  end

  describe "Title tag" do
    it "displays 'question first tag - question title - project name'" do
      expect(rendered).to have_title("ruby - This is the question title - StackHelper")
    end
  end

  describe "Meta description" do
    it "displays truncated question text" do
      meta_description = truncate_question_text(question.text)
      expect(rendered).to have_selector("meta[name='description'][content='#{meta_description}']",
                                        visible: false)
    end
  end
end


text:
<?xml version="1.0"?>
<!--

-->
<tabs>
    <general_information>
        <class>\Mage\Adminhtml\Test\Block\Widget\Tab</class>
        <selector>.//ul[contains(@id, "category_info_tabs")]/li[1]/a</selector>
        <strategy>xpath</strategy>
        <wrapper>general</wrapper>
        <fields>
            <is_active>
                <input>select</input>
            </is_active>
            <description />
            <include_in_menu>
                <input>select</input>
            </include_in_menu>
        </fields>
    </general_information>
    <display_setting>
        <class>\Mage\Adminhtml\Test\Block\Widget\Tab</class>
        <selector>.//ul[contains(@id, "category_info_tabs")]/li[2]/a</selector>
        <strategy>xpath</strategy>
        <wrapper>general</wrapper>
        <fields>
            <is_active>
                <input>select</input>
            </is_active>
            <include_in_menu>
                <input>select</input>
            </include_in_menu>
            <available_product_listing_config>
                <selector>#use_config_group_5available_sort_by</selector>
                <input>checkbox</input>
            </available_product_listing_config>
            <available_sort_by>
                <selector>#group_5available_sort_by</selector>
                <input>multiselect</input>
            </available_sort_by>
            <default_product_listing_config>
                <selector>#use_config_group_5default_sort_by</selector>
                <input>checkbox</input>
            </default_product_listing_config>
            <default_sort_by>
                <input>select</input>
            </default_sort_by>
            <display_mode>
                <input>select</input>
            </display_mode>
            <landing_page>
                <input>select</input>
            </landing_page>
            <is_anchor>
                <input>select</input>
            </is_anchor>
        </fields>
    </display_setting>
    <custom_design>
        <class>\Mage\Adminhtml\Test\Block\Widget\Tab</class>
        <selector>.//ul[contains(@id, "category_info_tabs")]/li[3]/a</selector>
        <strategy>xpath</strategy>
        <wrapper>general</wrapper>
    </custom_design>
    <category_products>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Category\Edit\Tab\Product</class>
        <selector>#category_info_tabs_products</selector>
        <strategy>css selector</strategy>
    </category_products>
</tabs>

redpajama_set_name: RedPajamaGithub


text:
"use strict";
var tap = require("tap"),
    test = tap.test,
    plan = tap.plan,
    _ = require("lodash"),
    idlFrontends = require("../lib/idl-frontend");

var Transformer = idlFrontends.Transformer,
    Frontend = idlFrontends.Frontend;

var classes,
    transformer;
function setup () {
    classes = {};
    transformer = new Transformer(classes);
}

test("Transform parameter", function (t) {
    setup();
    var p0 = transformer.transformParameter({ arg0 : "object" });
    t.deepEqual(p0, {name: "arg0", type: "object"});

    var p1 = transformer.transformParameter({ arg1 : "AnotherType" });
    t.deepEqual(p1, {name: "arg1", type: classes.AnotherType });

    t.end();
});

test("Transform methods", function (t) {
    setup();

    var idlMethods = {
        noArg: [],
        oneArg: [{myArg: "int"}],
        twoArgs: [{arg0: "object"}, {arg1: "int"}]
    };

    var methods = transformer.transformMethods(idlMethods);
    t.ok(_.isArray(methods));

    t.equal(_.size(methods), _.size(idlMethods));

    var map = {};
    _.each(methods, function (m) {
        t.ok(m.name, m.name + " is represented");
        t.ok(idlMethods[m.name], m.name + " is part of the input IDL");
        map[m.name] = m;
    });

    t.deepEqual(map.noArg.params, []);
    t.deepEqual(map.oneArg.params, [{name: "myArg", type: "int"}]);
    t.deepEqual(map.twoArgs.params, [{name: "arg0", type: "object"}, {name: "arg1", type: "int"}]);
    t.end();
});

test("Transform properties", function (t) {
    setup();

    var idlProperties = {
        myDictionary: "object",
        myInt: "int",
        myBoolean: "boolean"
    };

    var properties = transformer.transformProperties(idlProperties);
    t.ok(_.isArray(properties));

    t.equal(_.size(properties), _.size(idlProperties));

    var map = {};
    _.each(properties, function (m) {
        t.ok(m.name, m.name + " is represented");
        t.ok(idlProperties[m.name], m.name + " is part of the input IDL");
        map[m.name] = m;
    });

    t.equal(map.myDictionary.name, "myDictionary");
    t.equal(map.myInt.name, "myInt");
    t.equal(map.myBoolean.name, "myBoolean");

    t.equal(map.myDictionary.type, idlProperties.myDictionary);
    t.equal(map.myInt.type, idlProperties.myInt);
    t.equal(map.myBoolean.type, idlProperties.myBoolean);

    t.end();
});

test("Transform screens and modules classes", function (t) {
    setup();
    var idl = {
        namespace: "com.example.kirin.bridge",
        classes: {
                "MyScreen": {
                    implementedBy: "native",
                    namespace: ".screens",
                    methods: {
                        // only methods allowed
                        "do:times:plus": [{ x : "integer" }, { y : "integer" }, { z : "integer" }], // capitalise properly
                        "setTitle:": [{ title: "string" }]
                    }
                },
                "MyScreenPresenter": {
                    implementedBy: "javascript", // || gwt
                    namespace: "org.example.modules", // overrides above.
                    methods: {
                        // no non methods allowed
                        "onOkButtonTappedWithKey:andValue": [{ key : "string" }, { value : "string" }]
                    }
                }
            }
        };

    transformer.transformClasses(idl);
    var classes = transformer.classes;
    console.dir(_.keys(classes));
    t.ok(classes.MyScreen);
    t.ok(!classes[undefined]);

    var c = classes.MyScreen;
    t.equal(c.namespace, "com.example.kirin.bridge.screens");

    t.ok(c.methods);
    t.equal(c.methods.length, 2);

    t.ok(!c.properties);

    // presenter
    c = classes.MyScreenPresenter;
    t.ok(c);
    t.equal(c.namespace, "org.example.modules");
    t.ok(c.methods);
    t.equal(c.methods.length, 1);
    t.end();
});

test("Transform super classes", function (t) {
    setup();
    var idl = {
        namespace: "com.example.kirin.bridge",
        classes: {
                "MySubDTO": {
                    superClass: "MySuperDTO",
                    role: "request",
                    properties: {
                        "bar": "int"
                    }
                },
                "MyRequest": {
                    role: "request",
                    properties: {
                        "baz": "int"
                    }
                },
                "MySuperDTO": {
                    superClass: "MyRequest",
                    role: "request",
                    properties: {
                        "foo": "int"
                    }
                }
            }
        };

    transformer.transformClasses(idl);
    var classes = transformer.classes;

    t.equal(_.size(classes), 3);
    var classOrder = transformer.classOrder;

    t.deepEqual(_.pluck(classOrder, "name"), ["MyRequest", "MySuperDTO", "MySubDTO"]);

    t.equal(classes.MySubDTO.imports.MySuperDTO.name, "MySuperDTO");
    t.equal(classes.MySuperDTO.imports.MyRequest.name, "MyRequest");
    t.equal(classes.MyRequest.imports.int, "int");

    t.end();
});

test("Transform bridge types as params", function (t) {
    setup();
    var idl = {
        namespace: "com.example.kirin.bridge",
        classes: {
                "Module": {
                    implementedBy: "javascript",
                    methods: []
                },
                "Screen": {
                    implementedBy: "native",
                    methods: {
                        "sendRequest": [{request: "Request"}]
                    }
                },
                "Request": {
                    role: "request",
                    properties: {
                        "foo": "int"
                    }
                }
            }
        };

    transformer.transformClasses(idl);
    var classes = transformer.classes;

    t.equal(_.size(classes), 3);
    var classOrder = transformer.classOrder;

    var order = _.pluck(classOrder, "name");
    console.dir(order);
    t.ok(_.indexOf(order, "Request") < _.indexOf(order, "Screen"));

    t.equal(classes.Screen.imports.Request.name, "Request");
    t.ok(!classes.Module.imports);
    t.equal(classes.Request.imports.int, "int");

    t.end();
});

test("Load from file", function (t) {
    var frontend = new Frontend(__dirname + "/dummies/DummyIDL.js"),
        ir = frontend.generateIR();
    t.ok(ir);
    t.ok(_.isArray(ir));
    t.equal(ir.length, 4);

    t.end();
});


text:
package ma.glasnost.orika.impl.generator;

import static java.lang.String.format;
import static ma.glasnost.orika.impl.generator.SourceCodeContext.append;

import java.util.LinkedHashSet;
import java.util.Set;

import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.MappingContext;
import ma.glasnost.orika.MappingException;
import ma.glasnost.orika.impl.GeneratedMapperBase;
import ma.glasnost.orika.impl.util.ClassUtil;
import ma.glasnost.orika.metadata.ClassMap;
import ma.glasnost.orika.metadata.FieldMap;
import ma.glasnost.orika.metadata.MapperKey;
import ma.glasnost.orika.metadata.Type;
import ma.glasnost.orika.metadata.TypeFactory;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class MapperGenerator {

    private static Logger LOGGER = LoggerFactory.getLogger(MapperGenerator.class);

    private final MapperFactory mapperFactory;
    private final CompilerStrategy compilerStrategy;

    public MapperGenerator(MapperFactory mapperFactory, CompilerStrategy compilerStrategy) {
        this.mapperFactory = mapperFactory;
        this.compilerStrategy = compilerStrategy;
    }

    public GeneratedMapperBase build(ClassMap<?, ?> classMap, MappingContext context) {

        StringBuilder logDetails = null;
        try {
            compilerStrategy.assureTypeIsAccessible(classMap.getAType().getRawType());
            compilerStrategy.assureTypeIsAccessible(classMap.getBType().getRawType());

            if (LOGGER.isDebugEnabled()) {
                logDetails = new StringBuilder();
                String srcName = TypeFactory.nameOf(classMap.getAType(), classMap.getBType());
                String dstName = TypeFactory.nameOf(classMap.getBType(), classMap.getAType());
                logDetails.append("Generating new mapper for (" + srcName + ", " + dstName + ")");
            }

            final SourceCodeContext mapperCode = new SourceCodeContext(classMap.getMapperClassName(), GeneratedMapperBase.class, context,
                    logDetails);

            Set<FieldMap> mappedFields = new LinkedHashSet<FieldMap>();
            mappedFields.addAll(addMapMethod(mapperCode, true, classMap, logDetails));
            mappedFields.addAll(addMapMethod(mapperCode, false, classMap, logDetails));

            GeneratedMapperBase instance = mapperCode.getInstance();
            instance.setAType(classMap.getAType());
            instance.setBType(classMap.getBType());
            instance.setFavorsExtension(classMap.favorsExtension());

            if (logDetails != null) {
                LOGGER.debug(logDetails.toString());
                logDetails = null;
            }

            /*
             * Add a copy of the ClassMap to the current mapping context, which
             * only contains the field maps that were processed by this mapper
             * generation; this can later be used by ObjectFactory generation
             * when selecting a constructor -- since we only need a constructor
             * which handles the fields not mapped by the generated mapper
             */
            classMap = classMap.copy(mappedFields);
            context.registerMapperGeneration(classMap);

            return instance;

        } catch (final Exception e) {
            if (logDetails != null) {
                /*
                 * Print out the partial progress of the code generation, as it
                 * can help to pinpoint the location of the internal error
                 */
                logDetails.append("\n<---- ERROR occurred here");
                LOGGER.debug(logDetails.toString());
            }
            throw new MappingException(e);
        }
    }

    private Set<FieldMap> addMapMethod(SourceCodeContext code, boolean aToB, ClassMap<?, ?> classMap, StringBuilder logDetails) {

        Set<FieldMap> mappedFields = new LinkedHashSet<FieldMap>();
        if (logDetails != null) {
            if (aToB) {
                logDetails.append("\n\t" + code.getClassSimpleName() + ".mapAToB(" + classMap.getAType() + ", " + classMap.getBTypeName()
                        + ") {");
            } else {
                logDetails.append("\n\t" + code.getClassSimpleName() + ".mapBToA(" + classMap.getBType() + ", " + classMap.getATypeName()
                        + ") {");
            }
        }

        final StringBuilder out = new StringBuilder();
        final String mapMethod = "map" + (aToB ? "AtoB" : "BtoA");
        out.append("\tpublic void ");
        out.append(mapMethod);
        out.append(format("(java.lang.Object a, java.lang.Object b, %s mappingContext) {\n\n", MappingContext.class.getCanonicalName()));

        VariableRef source;
        VariableRef destination;
        if (aToB) {
            source = new VariableRef(classMap.getAType(), "source");
            destination = new VariableRef(classMap.getBType(), "destination");
        } else {
            source = new VariableRef(classMap.getBType(), "source");
            destination = new VariableRef(classMap.getAType(), "destination");
        }

        append(out, format("super.%s(a, b, mappingContext);", mapMethod), "\n\n", "// sourceType: " + source.type() + source.declare("a"),
                "// destinationType: " + destination.type() + destination.declare("b"), "\n\n");

        for (FieldMap currentFieldMap : classMap.getFieldsMapping()) {

            if (currentFieldMap.isExcluded()) {
                if (logDetails != null) {
                    code.debugField(currentFieldMap, "excuding (explicitly)");
                }
                continue;
            }

            if (isAlreadyExistsInUsedMappers(currentFieldMap, classMap)) {
                if (logDetails != null) {
                    code.debugField(currentFieldMap, "excluding because it is already handled by another mapper in this hierarchy");
                }
                continue;
            }

            FieldMap fieldMap = currentFieldMap;
            if (!aToB) {
                fieldMap = fieldMap.flip();
            }

            if (!fieldMap.isIgnored()) {
                if (code.aggregateSpecsApply(fieldMap)) {
                    continue;
                }
                try {
                    mappedFields.add(currentFieldMap);
                    String sourceCode = generateFieldMapCode(code, fieldMap, classMap, destination, logDetails);
                    out.append(sourceCode);
                } catch (final Exception e) {
                    MappingException me = new MappingException(e);
                    me.setSourceProperty(fieldMap.getSource());
                    me.setDestinationProperty(fieldMap.getDestination());
                    me.setSourceType(source.type());
                    me.setDestinationType(destination.type());
                    throw me;
                }
            } else if (logDetails != null) {
                code.debugField(fieldMap, "ignored for this mapping direction");
            }
        }

        out.append(code.mapAggregateFields());

        out.append("\n\t\tif(customMapper != null) { \n\t\t\t customMapper.")
                .append(mapMethod)
                .append("(source, destination, mappingContext);\n\t\t}");

        out.append("\n\t}");

        if (logDetails != null) {
            logDetails.append("\n\t}");
        }

        code.addMethod(out.toString());

        return mappedFields;
    }

    private boolean isAlreadyExistsInUsedMappers(FieldMap fieldMap, ClassMap<?, ?> classMap) {

        Set<ClassMap<Object, Object>> usedClassMapSet = mapperFactory.lookupUsedClassMap(new MapperKey(classMap.getAType(),
                classMap.getBType()));

        if (!fieldMap.isByDefault()) {
            return false;
        }

        for (ClassMap<Object, Object> usedClassMap : usedClassMapSet) {
            for (FieldMap usedFieldMap : usedClassMap.getFieldsMapping()) {
                if (usedFieldMap.getSource().equals(fieldMap.getSource())
                        && usedFieldMap.getDestination().equals(fieldMap.getDestination())) {
                    return true;
                }
            }
        }

        return false;
    }

    private String generateFieldMapCode(SourceCodeContext code, FieldMap fieldMap, ClassMap<?, ?> classMap, VariableRef destination,
            StringBuilder logDetails) throws Exception {

        final VariableRef sourceProperty = new VariableRef(fieldMap.getSource(), "source");
        final VariableRef destinationProperty = new VariableRef(fieldMap.getDestination(), "destination");
        destinationProperty.setOwner(destination);

        if (!sourceProperty.isReadable() || ((!destinationProperty.isAssignable()) && ClassUtil.isImmutable(destinationProperty.type()))) {
            if (logDetails != null) {
                code.debugField(fieldMap, "excluding because ");
                if (!sourceProperty.isReadable()) {
                    Type<?> sourceType = classMap.getAType().equals(destination.type()) ? classMap.getBType() : classMap.getAType();
                    logDetails.append(sourceType + "." + fieldMap.getSource().getName() + "(" + fieldMap.getSource().getType()
                            + ") is not readable");
                } else {
                    logDetails.append(destination.type() + "." + fieldMap.getDestination().getName() + "("
                            + fieldMap.getDestination().getType() + ") is not assignable and cannot be mapped in-place");
                }
            }
            return "";
        }

        // Make sure the source and destination types are accessible to the
        // builder
        compilerStrategy.assureTypeIsAccessible(sourceProperty.rawType());
        compilerStrategy.assureTypeIsAccessible(destinationProperty.rawType());

        return code.mapFields(fieldMap, sourceProperty, destinationProperty, destination.type(), logDetails);
    }

}


text:
package dk.brics.tajs.test;

import dk.brics.tajs.Main;
import dk.brics.tajs.options.Options;
import org.junit.Before;
import org.junit.Test;

public class TestJQueryLoad {

    @Test
    public void load_1_0() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.0.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_1() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.1.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_2() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.2.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_3() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.3.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_4() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.4.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_5() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.5.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_6() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.6.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_7() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.7.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_8() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.8.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_9() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.9.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_10() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.10.js");
        Misc.checkSystemOutput();
    }

    @Test
    public void load_1_11() {
        Misc.run("benchmarks/tajs/src/jquery/libraries/jquery-1.11.js");
        Misc.checkSystemOutput();
    }

    @Before
    public void before() {
        Main.reset();
        Options.get().enableDeterminacy();
        Options.get().enableIncludeDom();
        Options.get().enableUnevalizer();
        Options.get().enableTest();
        Options.get().enableNoStrict(); // soundness testing does not work properly with strict mode
        // Each tests runs in less than 30 seconds on `Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz`
        Options.get().setAnalysisTimeLimit(90);
        //Options.get().enableNoStrict(); // soundness testing does not work properly with strict mode
        Options.get().getUnsoundness().setUseFixedRandom(true);
        Options.get().getUnsoundness().setShowUnsoundnessUsage(true);
    }
}


text:
import requests
payload = { 'q': 'Gen1',
            'include-css-link': 'true',
            'inline-styles': 'true',
            'wrapping-div': 'true',
            'include-passage-references': 'true',
            'include-verse-anchors': 'true',
            'include-chapter-numbers': 'true',
            'include-first-verse-numbers': 'true',
            'include-verse-numbers': 'true',
            'include-headings': 'true'
            }
r = requests.get('https://api.esv.org/v3/passage/html/', params = payload, headers={'Authorization': 'Token cbf78308c748ab16c2bf250961ba5e1d5e619e56'})
print(r.json()['passages'])


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>sTestWebDriverFactory</title>
<meta name="date" content="2016-06-09">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.common.core

Class sTestWebDriverFactory

java.lang.Object

com.common.core.sTestWebDriverFactory

Direct Known Subclasses:

sampleWebDriverFactory

public class sTestWebDriverFactory
extends java.lang.Object

Sub-class from sTestWebDriverFactory to include defined page objects to be used in creating testNG tests.

Version:

1.0

Author:

davidwramer

Nested Class Summary

Nested Classes

Modifier and Type
Class and Description

static class
sTestWebDriverFactory.Test

Field Summary

Fields

Modifier and Type
Field and Description

(package private) static java.lang.String
android

private java.lang.String
browserStackKey

private java.lang.String
browserStackLoginName

private java.lang.String
browserStackURL

(package private) static java.lang.String
browserStackWebDriver

private org.openqa.selenium.remote.DesiredCapabilities
capabillities

(package private) static java.lang.String
chrome

protected org.openqa.selenium.remote.RemoteWebDriver
driver

private boolean
enableSMS

private java.util.concurrent.Executor
executor

private boolean
failProxyToLocalWebDriver

private static int
FALSE_STATE

(package private) static java.lang.String
firefox

private sTestHilitePageElementFactory
helem

(package private) static java.lang.String
ie

(package private) static java.lang.String
ipad

(package private) static java.lang.String
iphone

(package private) static java.lang.String
jbrowser

private sTestJiraFactory
jiraFactory

static java.lang.String
landscape

(package private) static java.lang.String
linux

protected org.openqa.selenium.WebDriver
localDriver

private java.lang.String
localPathToSauceConnectJarFile

(package private) static java.lang.String
localWebDriver

private logFileFactory
logger

(package private) static java.lang.String
mac

(package private) java.lang.String
macChromeWebDriverDirectory

(package private) java.lang.String
macIEWebDriverDirectory

private java.lang.String
methodName

private sTestOSInformationFactory
osInfo

private java.lang.String
osName

static java.lang.String
portrait

private java.lang.String
proxy

private org.openqa.selenium.remote.DesiredCapabilities
proxyCap

(package private) static java.lang.String
proxyWebDriver

private boolean
referenceCheck

private boolean
remoteServerRunning

protected static java.util.ResourceBundle
resources

(package private) static java.lang.String
safari

private java.lang.String
sauceConnectAccessKey

private java.lang.String
sauceConnectLoginName

private com.saucelabs.ci.sauceconnect.SauceConnectTwoManager
sauceConnectManager

(package private) static java.lang.String
sauceLabWebDriver

private sTestScreenCaptureFactory
screencapture

private scrollIntoViewFactory
siv

private sTestSlackFactory
slackFactory

private static int
TRUE_STATE

private static int
UNDEFINED_STATE

private org.openqa.selenium.support.ui.WebDriverWait
wait

(package private) java.lang.String
winChromeWebDriverDirectory

(package private) static java.lang.String
windows

(package private) java.lang.String
winIEWebDriverDirectory

private sTestZipFileFactory
zipFile

Constructor Summary

Constructors

Modifier
Constructor and Description

private
sTestWebDriverFactory()

method sTestWebDriverFactory() constructor
 constructor for the sTestWebDriverFactory This is the heart of Bichromate

sTestWebDriverFactory(java.util.ResourceBundle remoteResources)

This method sTestWebDriverFactory() constructor
 Constructor for the sTestWebDriverFactory This is the heart of Bichromate

Method Summary

All Methods Static Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

org.openqa.selenium.remote.RemoteWebDriver
buildNewAndroidRemoteDriver(org.openqa.selenium.Platform platform,
                           java.lang.String version)

method buildNewAndroidRemoteDriver()
 This function setsup the DesiredCapabilities for the saucelab web driver

org.openqa.selenium.remote.RemoteWebDriver
buildNewBrowserStackWebDriver(java.lang.String BrowserVersion,
                             org.openqa.selenium.Platform platform,
                             java.lang.String browser,
                             java.lang.String setupString)

method buildNewBrowserStackWebDriver()
 This function setsup the DesiredCapabilities for the browserStack cloud.

org.openqa.selenium.remote.RemoteWebDriver
buildNewChromeLocalDriver()

method buildNewChromeLocalDriver()
 This function setsup the local chrome web driver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewChromeLocalDriver(org.openqa.selenium.chrome.ChromeOptions options)

method buildNewChromeLocalDriver()

 This function setsup the local chrome web driver, with ChromeOptions passsed in

org.openqa.selenium.remote.RemoteWebDriver
buildNewChromeProxyDriver(java.lang.String proxyInfo,
                         org.openqa.selenium.Platform os,
                         java.lang.String browserVersion)

method buildNewChromeProxyDriver()
 This function setsup the selenium grid webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewChromeRemoteDriver(org.openqa.selenium.Platform platform,
                          java.lang.String version)

method buildNewChromeRemoteDriver()
 This function setsup the saucelabs webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewConfiguredRemoteDriver(java.lang.String browser,
                              java.lang.String browserVersion,
                              java.lang.String platformOS)

method buildNewConfiguredRemoteDriver()
 This function setsup the DesiredCapabilities for the saucelab web driver

org.openqa.selenium.remote.RemoteWebDriver
buildNewFireFoxLocalDriver()

buildNewFireFoxLocalDriver()

 This function setsup local firefox webdriver

org.openqa.selenium.remote.RemoteWebDriver
buildNewFireFoxProxyDriver(java.lang.String proxyInfo,
                          org.openqa.selenium.Platform os,
                          java.lang.String browserVersion)

method buildNewFireFoxProxyDriver()
 This function setsup the selenium grid webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewFireFoxRemoteDriver(org.openqa.selenium.Platform platform,
                           java.lang.String version)

method buildNewFireFoxRemoteDriver()
 description This function setsup the saucelabs webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewFoxLocalDriver()

method buildNewFoxLocalDriver()
 This function setsup local firefox webdriver

org.openqa.selenium.remote.RemoteWebDriver
buildNewIELocalDriver()

buildNewIELocalDriver()

 This function sets up the IE local webDriver with the following capabilities: INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS

 and IGNORE_ZOOM_SETTING

org.openqa.selenium.remote.RemoteWebDriver
buildNewIELocalDriver(org.openqa.selenium.remote.DesiredCapabilities caps)

method buildNewIELocalDriver()
 This function sets up the IE local webDriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewIEProxyDriver(java.lang.String proxyInfo,
                     org.openqa.selenium.Platform os,
                     java.lang.String browserVersion)

method buildNewIEProxyDriver()
 This function setsup the selenium grid webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewIERemoteDriver(org.openqa.selenium.Platform platform,
                      java.lang.String version)

method buildNewIERemoteDriver()
 This function setsup the saucelabs webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewIPadRemoteDriver(org.openqa.selenium.Platform platform,
                        java.lang.String version)

methodbuildNewIPadRemoteDriver()
 This function setsup the saucelabs webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewIPhoneRemoteDriver(org.openqa.selenium.Platform platform,
                          java.lang.String version)

method buildNewIPhoneRemoteDriver()
 This function setsup the saucelabs webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewIphoneRemoteDriver(java.lang.String platform,
                          java.lang.String version)

method buildNewIphoneRemoteDriver()
 This function setsup the saucelabs webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewPhantomRemoteDriver(java.lang.String platform,
                           java.lang.String version)

method buildNewPhantomRemoteDriver()
 This function setsup the phantomJS webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewSafariLocalDriver()

buildNewSafariLocalDriver()

 This function setsup local Safari webdriver

org.openqa.selenium.remote.RemoteWebDriver
buildNewSafariProxyDriver(java.lang.String proxyInfo,
                         org.openqa.selenium.Platform os,
                         java.lang.String browserVersion)

method buildNewSafariProxyDriver()
 This function setsup the selenium grid webdriver.

org.openqa.selenium.remote.RemoteWebDriver
buildNewSafariRemoteDriver(org.openqa.selenium.Platform platform,
                          java.lang.String version)

method buildNewSafariRemoteDriver()
 This function setsup the saucelabs webdriver.

private static java.util.regex.Pattern
buildPatternFromURL(java.lang.String URL)

method buildPatternFromURL()
 Takes a string and turns it into a URL

org.openqa.selenium.remote.RemoteWebDriver
ceateJBrowserDriver()

ceateJBrowserDriver() Main class that creates the ceateJBrowserDriver

- Headless webDriver for testing on machines that do not have any browsers installed

- See https://github.com/MachinePublishers/jBrowserDriver/

- download from https://github.com/MachinePublishers/jBrowserDriver/

void
cleanUpAfterTest()

methodcleanUpAfterTest()
 Closes sauce connection when test is done

void
closeSauceLabsConnectionServer()

method closeSauceLabsConnectionServer()
 This function when called terminates the connection to the saucelab

org.openqa.selenium.remote.RemoteWebDriver
createFireFoxNetPanelWebDriver()

method createFireFoxNetPanelWebDriver()
 CreateFireFoxNetPanelWebDriver creates a FireFox web driver with Firbug and NetPanel installed

 and active.

org.sikuli.webdriver.SikuliFirefoxDriver
createSilukiWebDriver()

createSilukiWebDriver() Main class that creates the createSilukiWebDriver

- This webDrive extends the FireFox webdriver that runs on local host

- See https://answers.launchpad.net/sikuli

- download jar file from http://www.java2s.com/Code/Jar/s/Downloadsikuliwebdriver101jar.htm

org.openqa.selenium.remote.RemoteWebDriver
createWebDriver(java.lang.String remote,
               java.lang.String version,
               org.openqa.selenium.Platform platform,
               java.lang.String browser,
               java.lang.String setupString)

method createWebDriver()
 Main class that creates the selenium web driver

org.openqa.selenium.remote.RemoteWebDriver
createWebDriver(java.lang.String remote,
               java.lang.String version,
               java.lang.String platform,
               java.lang.String browser,
               java.lang.String setupString)

createWebDriver()
 Main class that creates the selenium web drivers, This is wrapper method that allows you to pass in a string for the platform.

sTestJiraFactory
getJiraFactory()

method getJiraFactory()
 Returns the sTestJiraFactory class

logFileFactory
getLoggerFactory()

method getLoggerFactory()
 Returns the logFileFactory class

java.lang.String
getProxyName()

method getProxyName()
 Returns the name of the proxy for the Grid Console machine (hub)

scrollIntoViewFactory
getScrollIntoViewFactory()

method getScrollIntoViewFactory()
 Returns the scrollIntoView class

sTestHilitePageElementFactory
getSTestHilitePageElementFactory()

method getSTestHilitePageElementFactory()
 Return the sTestHilitePageElementFactory

sTestZipFileFactory
getSTestJiraFactory()

getSTestJiraFactory()
 Return the sTestZipFileFactory class

sTestScreenCaptureFactory
getSTestScreenCaptureFactory()

method getScreenGrabber()
 Returns the getScreenGrabber class

sTestSlackFactory
getSTestSlackFactory()

sTestSlackFactory()
 Returns the sTestSlackFactory class

org.openqa.selenium.remote.RemoteWebDriver
getWebDriver()

method getWebDriver()
 Returns the RemoteWebDriver

sTestJiraFactory
getZipFileFactory()

getSTestJiraFactory()
 Returns the jiraFactory class

boolean
isSauceConnectionServerRunning()

method isSauceConnectionServerRunning()
 Returns true if connection is open

java.lang.String
obtainTestStatusInformations()

obtainTestStatusInformation()

 This function when called will return the test status from saucelabs for the currently running test

void
selfTest()

method selfTest()
 base selfTest that calls the appropriate test for the current running OS

void
selfTestBrowser(java.lang.String browserName,
               java.lang.String testNumber)

method selfTestBrowser()
 selfTest, used to validate all aspects of the sTestWebDriverFactory

void
selfTestMac()

method selfTestMac()
 unit test for mac platform

void
selfTestWindows()

method selfTestWindows()
 Unit Test for windows platform

void
startSauceConnectionServer()

method startSauceConnectionServer()
 Manually launch the Sauce Connect C:\Program
 Files\eclipse\sauce-connect-plugin-1.0.14 java -jar Sauce-Connect.jar
 dramer c0d25cce-6def-4404-809c-311a2b90f0fb Debug messages will be
 sent to sauce_connect.log 2013-02-23
 18:08:58.303:INFO::jetty-7.x.y-SNAPSHOT 2013-02-23
 18:08:58.356:INFO::Started SelectChannelConnector@0.0.0.0:49992
 .---------------------------------------------------.

void
sTestWait(int milliseconds)

method sTestWait()
 used to explicitly wait during a test run

boolean
verifyFoundPageByURL(int waitTime,
                    java.lang.String URL,
                    java.lang.String testName)

verifyFoundPageByURL()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

FALSE_STATE

private static int FALSE_STATE

UNDEFINED_STATE

private static int UNDEFINED_STATE

TRUE_STATE

private static int TRUE_STATE

localWebDriver

static java.lang.String localWebDriver

sauceLabWebDriver

static java.lang.String sauceLabWebDriver

proxyWebDriver

static java.lang.String proxyWebDriver

browserStackWebDriver

static java.lang.String browserStackWebDriver

windows

static java.lang.String windows

mac

static java.lang.String mac

linux

static java.lang.String linux

firefox

static java.lang.String firefox

ipad

static java.lang.String ipad

ie

static java.lang.String ie

chrome

static java.lang.String chrome

safari

static java.lang.String safari

jbrowser

static java.lang.String jbrowser

winChromeWebDriverDirectory

java.lang.String winChromeWebDriverDirectory

macChromeWebDriverDirectory

java.lang.String macChromeWebDriverDirectory

winIEWebDriverDirectory

java.lang.String winIEWebDriverDirectory

macIEWebDriverDirectory

java.lang.String macIEWebDriverDirectory

iphone

static java.lang.String iphone

android

static java.lang.String android

sauceConnectManager

private com.saucelabs.ci.sauceconnect.SauceConnectTwoManager sauceConnectManager

sauceConnectLoginName

private java.lang.String sauceConnectLoginName

sauceConnectAccessKey

private java.lang.String sauceConnectAccessKey

localPathToSauceConnectJarFile

private java.lang.String localPathToSauceConnectJarFile

browserStackLoginName

private java.lang.String browserStackLoginName

browserStackKey

private java.lang.String browserStackKey

browserStackURL

private java.lang.String browserStackURL

wait

private org.openqa.selenium.support.ui.WebDriverWait wait

driver

protected org.openqa.selenium.remote.RemoteWebDriver driver

localDriver

protected org.openqa.selenium.WebDriver localDriver

proxyCap

private org.openqa.selenium.remote.DesiredCapabilities proxyCap

portrait

public static final java.lang.String portrait

See Also:

Constant Field Values

landscape

public static final java.lang.String landscape

See Also:

Constant Field Values

remoteServerRunning

private boolean remoteServerRunning

capabillities

private org.openqa.selenium.remote.DesiredCapabilities capabillities

proxy

private java.lang.String proxy

referenceCheck

private boolean referenceCheck

resources

protected static java.util.ResourceBundle resources

executor

private java.util.concurrent.Executor executor

osName

private java.lang.String osName

failProxyToLocalWebDriver

private boolean failProxyToLocalWebDriver

enableSMS

private boolean enableSMS

methodName

private java.lang.String methodName

jiraFactory

private sTestJiraFactory jiraFactory

osInfo

private sTestOSInformationFactory osInfo

logger

private logFileFactory logger

siv

private scrollIntoViewFactory siv

helem

private sTestHilitePageElementFactory helem

screencapture

private sTestScreenCaptureFactory screencapture

zipFile

private sTestZipFileFactory zipFile

slackFactory

private sTestSlackFactory slackFactory

Constructor Detail

sTestWebDriverFactory

private sTestWebDriverFactory()

method sTestWebDriverFactory() constructor
 constructor for the sTestWebDriverFactory This is the heart of Bichromate

sTestWebDriverFactory

public sTestWebDriverFactory(java.util.ResourceBundle remoteResources)

This method sTestWebDriverFactory() constructor
 Constructor for the sTestWebDriverFactory This is the heart of Bichromate

Parameters:

remoteResources - to initialize all Factories, you can pass in Bichromate.properties

Method Detail

getSTestSlackFactory

public sTestSlackFactory getSTestSlackFactory()

sTestSlackFactory()
 Returns the sTestSlackFactory class

Returns:

slackFactory

See Also:

sTestSlackFactory

getZipFileFactory

public sTestJiraFactory getZipFileFactory()

getSTestJiraFactory()
 Returns the jiraFactory class

Returns:

jiraFactory factory for entering jira updates

See Also:

sTestJiraFactory

getSTestJiraFactory

public sTestZipFileFactory getSTestJiraFactory()

getSTestJiraFactory()
 Return the sTestZipFileFactory class

Returns:

zipFile zip file factory for zipping up screen shots

See Also:

sTestZipFileFactory

getSTestScreenCaptureFactory

public sTestScreenCaptureFactory getSTestScreenCaptureFactory()

method getScreenGrabber()
 Returns the getScreenGrabber class

Returns:

screencapture sTestScreenCaptureFactory to take screen shots

See Also:

sTestScreenCaptureFactory

cleanUpAfterTest

public void cleanUpAfterTest()

methodcleanUpAfterTest()
 Closes sauce connection when test is done

getScrollIntoViewFactory

public scrollIntoViewFactory getScrollIntoViewFactory()

method getScrollIntoViewFactory()
 Returns the scrollIntoView class

Returns:

siv factory to scroll elements into view

See Also:

scrollIntoViewFactory

getSTestHilitePageElementFactory

public sTestHilitePageElementFactory getSTestHilitePageElementFactory()

method getSTestHilitePageElementFactory()
 Return the sTestHilitePageElementFactory

Returns:

helem  hilite factory to hilite elements on a page

See Also:

sTestHilitePageElementFactory

getJiraFactory

public sTestJiraFactory getJiraFactory()

method getJiraFactory()
 Returns the sTestJiraFactory class

Returns:

jiraFactory  factory to enter jira updates

See Also:

sTestJiraFactory

getLoggerFactory

public logFileFactory getLoggerFactory()

method getLoggerFactory()
 Returns the logFileFactory class

Returns:

logger   log file for entering log entries

See Also:

logFileFactory

getWebDriver

public org.openqa.selenium.remote.RemoteWebDriver getWebDriver()

method getWebDriver()
 Returns the RemoteWebDriver

Returns:

driver  Selenium remote webDriver

See Also:

RemoteWebDriver

sTestWait

public void sTestWait(int milliseconds)

method sTestWait()
 used to explicitly wait during a test run

Parameters:

milliseconds - - 60000 is equal to one minute

verifyFoundPageByURL

public boolean verifyFoundPageByURL(int waitTime,
                                    java.lang.String URL,
                                    java.lang.String testName)

verifyFoundPageByURL()

Parameters:

waitTime - How long to wait for page to respond

URL - - URL of the page loading

testName - - Name of the test running

Returns:

true if page URL was found.

See Also:

WebDriverWait

buildPatternFromURL

private static java.util.regex.Pattern buildPatternFromURL(java.lang.String URL)

method buildPatternFromURL()
 Takes a string and turns it into a URL

Parameters:

URL - - URL with embedded URL

Returns:

pattern  pattern builder

getProxyName

public java.lang.String getProxyName()

method getProxyName()
 Returns the name of the proxy for the Grid Console machine (hub)

Returns:

proxy - name of Selenium grid hub

createSilukiWebDriver

public org.sikuli.webdriver.SikuliFirefoxDriver createSilukiWebDriver()

createSilukiWebDriver() Main class that creates the createSilukiWebDriver

- This webDrive extends the FireFox webdriver that runs on local host

- See https://answers.launchpad.net/sikuli

- download jar file from http://www.java2s.com/Code/Jar/s/Downloadsikuliwebdriver101jar.htm

Returns:

SikuliFirefoxDriver webdriver to pinpoint map items

See Also:

SikuliFirefoxDriver

ceateJBrowserDriver

public org.openqa.selenium.remote.RemoteWebDriver ceateJBrowserDriver()

ceateJBrowserDriver() Main class that creates the ceateJBrowserDriver

- Headless webDriver for testing on machines that do not have any browsers installed

- See https://github.com/MachinePublishers/jBrowserDriver/

- download from https://github.com/MachinePublishers/jBrowserDriver/

Returns:

driver  remote web driver

See Also:

RemoteWebDriver,
JBrowserDriver

createFireFoxNetPanelWebDriver

public org.openqa.selenium.remote.RemoteWebDriver createFireFoxNetPanelWebDriver()

method createFireFoxNetPanelWebDriver()
 CreateFireFoxNetPanelWebDriver creates a FireFox web driver with Firbug and NetPanel installed

 and active. This web driver is used to test page load times with firerox

Returns:

driver  remote selenium web driver

See Also:

RemoteWebDriver

isSauceConnectionServerRunning

public boolean isSauceConnectionServerRunning()

method isSauceConnectionServerRunning()
 Returns true if connection is open

Returns:

True if connection is open

obtainTestStatusInformations

public java.lang.String obtainTestStatusInformations()

obtainTestStatusInformation()

 This function when called will return the test status from saucelabs for the currently running test

Returns:

jobInfo with the status

startSauceConnectionServer

public void startSauceConnectionServer()

method startSauceConnectionServer()
 Manually launch the Sauce Connect C:\Program
 Files\eclipse\sauce-connect-plugin-1.0.14 java -jar Sauce-Connect.jar
 dramer c0d25cce-6def-4404-809c-311a2b90f0fb Debug messages will be
 sent to sauce_connect.log 2013-02-23
 18:08:58.303:INFO::jetty-7.x.y-SNAPSHOT 2013-02-23
 18:08:58.356:INFO::Started SelectChannelConnector@0.0.0.0:49992
 .---------------------------------------------------. | Have
 questions or need help with Sauce Connect? | | Contact us:
 http://support.saucelabs.com/forums | | Terms of Service:
 http://saucelabs.com/tos |
 http://support.saucelabs.com/forums

closeSauceLabsConnectionServer

public void closeSauceLabsConnectionServer()

method closeSauceLabsConnectionServer()
 This function when called terminates the connection to the saucelab

createWebDriver

public org.openqa.selenium.remote.RemoteWebDriver createWebDriver(java.lang.String remote,
                                                                  java.lang.String version,
                                                                  java.lang.String platform,
                                                                  java.lang.String browser,
                                                                  java.lang.String setupString)

createWebDriver()
 Main class that creates the selenium web drivers, This is wrapper method that allows you to pass in a string for the platform.

Parameters:

remote - - Local, proxy,saucelabs must use

version - = browser version only used when connecting to saucelabs

platform - - windows,Linux,Mac. Used when connecting to proxy, or browser stack, or saucelabs

browser - - (Firefox,Chrome,IOS,Android,IE)

setupString - - Test description

Returns:

RemoteWebDriver

See Also:

RemoteWebDriver

createWebDriver

public org.openqa.selenium.remote.RemoteWebDriver createWebDriver(java.lang.String remote,
                                                                  java.lang.String version,
                                                                  org.openqa.selenium.Platform platform,
                                                                  java.lang.String browser,
                                                                  java.lang.String setupString)

method createWebDriver()
 Main class that creates the selenium web driver

Parameters:

remote - - Local, proxy,saucelabs must use

version - = browser version only used when connecting to saucelabs

platform - - Only used when connecting to proxy, saucelabs, browser stack

browser - - (Firefox,Chrome,IOS,Android,IE)

setupString - - Test description

Returns:

RemoteWebDriver

See Also:

RemoteWebDriver

buildNewIELocalDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewIELocalDriver()

buildNewIELocalDriver()

 This function sets up the IE local webDriver with the following capabilities: INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS

 and IGNORE_ZOOM_SETTING

Returns:

RemoteWebDriver

See Also:

RemoteWebDriver

buildNewIELocalDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewIELocalDriver(org.openqa.selenium.remote.DesiredCapabilities caps)

method buildNewIELocalDriver()
 This function sets up the IE local webDriver.

Parameters:

caps - browser capabilities

Returns:

RemoteWebDriver

See Also:

RemoteWebDriver

buildNewSafariProxyDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewSafariProxyDriver(java.lang.String proxyInfo,
                                                                            org.openqa.selenium.Platform os,
                                                                            java.lang.String browserVersion)

method buildNewSafariProxyDriver()
 This function setsup the selenium grid webdriver.

Parameters:

proxyInfo - - browser version

os - - OS to create

browserVersion - - version of the browser

Returns:

RemoteWebDriver

See Also:

RemoteWebDriver,
Platform

buildNewIEProxyDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewIEProxyDriver(java.lang.String proxyInfo,
                                                                        org.openqa.selenium.Platform os,
                                                                        java.lang.String browserVersion)

method buildNewIEProxyDriver()
 This function setsup the selenium grid webdriver.

Parameters:

proxyInfo - - browser version

os - - not used, default is linux

browserVersion - - version of the browser

Returns:

RemoteWebDriver

See Also:

RemoteWebDriver

buildNewSafariLocalDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewSafariLocalDriver()

buildNewSafariLocalDriver()

 This function setsup local Safari webdriver

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewFireFoxLocalDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewFireFoxLocalDriver()

buildNewFireFoxLocalDriver()

 This function setsup local firefox webdriver

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewFoxLocalDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewFoxLocalDriver()

method buildNewFoxLocalDriver()
 This function setsup local firefox webdriver

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewFireFoxProxyDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewFireFoxProxyDriver(java.lang.String proxyInfo,
                                                                             org.openqa.selenium.Platform os,
                                                                             java.lang.String browserVersion)

method buildNewFireFoxProxyDriver()
 This function setsup the selenium grid webdriver.

Parameters:

proxyInfo - - browser version

os - - windows, linux, mac

browserVersion - - version of the browser

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewChromeLocalDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewChromeLocalDriver()

method buildNewChromeLocalDriver()
 This function setsup the local chrome web driver.

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewChromeLocalDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewChromeLocalDriver(org.openqa.selenium.chrome.ChromeOptions options)

method buildNewChromeLocalDriver()

 This function setsup the local chrome web driver, with ChromeOptions passsed in

Parameters:

options - - ChromeOptions

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver,
ChromeOptions

buildNewChromeProxyDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewChromeProxyDriver(java.lang.String proxyInfo,
                                                                            org.openqa.selenium.Platform os,
                                                                            java.lang.String browserVersion)

method buildNewChromeProxyDriver()
 This function setsup the selenium grid webdriver.

Parameters:

proxyInfo - - browser version

os - - Operating system to use when creating remote webDriver

browserVersion - - version of the browser

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewIERemoteDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewIERemoteDriver(org.openqa.selenium.Platform platform,
                                                                         java.lang.String version)

method buildNewIERemoteDriver()
 This function setsup the saucelabs webdriver.

Parameters:

version - - browser version

platform - - windows, mac, linux

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewChromeRemoteDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewChromeRemoteDriver(org.openqa.selenium.Platform platform,
                                                                             java.lang.String version)

method buildNewChromeRemoteDriver()
 This function setsup the saucelabs webdriver.

Parameters:

version - - browser version

platform - - windows, mac, linux

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewSafariRemoteDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewSafariRemoteDriver(org.openqa.selenium.Platform platform,
                                                                             java.lang.String version)

method buildNewSafariRemoteDriver()
 This function setsup the saucelabs webdriver.

Parameters:

version - - browser version

platform - - windows, mac,Linux

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewIPadRemoteDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewIPadRemoteDriver(org.openqa.selenium.Platform platform,
                                                                           java.lang.String version)

methodbuildNewIPadRemoteDriver()
 This function setsup the saucelabs webdriver.

Parameters:

version - - browser version

platform - - must be mac

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewIPhoneRemoteDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewIPhoneRemoteDriver(org.openqa.selenium.Platform platform,
                                                                             java.lang.String version)

method buildNewIPhoneRemoteDriver()
 This function setsup the saucelabs webdriver.

Parameters:

version - - browser version

platform - - must be mac

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewFireFoxRemoteDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewFireFoxRemoteDriver(org.openqa.selenium.Platform platform,
                                                                              java.lang.String version)

method buildNewFireFoxRemoteDriver()
 description This function setsup the saucelabs webdriver.

Parameters:

version - - browser version

platform - - windows, linux, mac

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewIphoneRemoteDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewIphoneRemoteDriver(java.lang.String platform,
                                                                             java.lang.String version)

method buildNewIphoneRemoteDriver()
 This function setsup the saucelabs webdriver.

Parameters:

version - - browser version

platform - - must be mac

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewPhantomRemoteDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewPhantomRemoteDriver(java.lang.String platform,
                                                                              java.lang.String version)

method buildNewPhantomRemoteDriver()
 This function setsup the phantomJS webdriver.

Parameters:

version - - browser version

platform - - windows, mac, linux

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewAndroidRemoteDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewAndroidRemoteDriver(org.openqa.selenium.Platform platform,
                                                                              java.lang.String version)

method buildNewAndroidRemoteDriver()
 This function setsup the DesiredCapabilities for the saucelab web driver

Parameters:

version - - browser version

platform - - windows,linux

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewBrowserStackWebDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewBrowserStackWebDriver(java.lang.String BrowserVersion,
                                                                                org.openqa.selenium.Platform platform,
                                                                                java.lang.String browser,
                                                                                java.lang.String setupString)

method buildNewBrowserStackWebDriver()
 This function setsup the DesiredCapabilities for the browserStack cloud.
 See: https://www.browserstack.com

Parameters:

BrowserVersion - - browser version

platform - - not used, default is linux

browser - - type of browser IE,FireFox,Chrome

setupString - - data about the test

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

buildNewConfiguredRemoteDriver

public org.openqa.selenium.remote.RemoteWebDriver buildNewConfiguredRemoteDriver(java.lang.String browser,
                                                                                java.lang.String browserVersion,
                                                                                java.lang.String platformOS)

method buildNewConfiguredRemoteDriver()
 This function setsup the DesiredCapabilities for the saucelab web driver

Parameters:

browser - - browser name

browserVersion - - browser version

platformOS - - platform (Mac, Windows, linux)

Returns:

driver RemoteWebDriver

See Also:

RemoteWebDriver

selfTestBrowser

public void selfTestBrowser(java.lang.String browserName,
                            java.lang.String testNumber)

method selfTestBrowser()
 selfTest, used to validate all aspects of the sTestWebDriverFactory

Parameters:

browserName - name of the browser to test

testNumber - sequential number for selfTest

selfTestWindows

public void selfTestWindows()

method selfTestWindows()
 Unit Test for windows platform

selfTestMac

public void selfTestMac()

method selfTestMac()
 unit test for mac platform

selfTest

public void selfTest()

method selfTest()
 base selfTest that calls the appropriate test for the current running OS

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
@font-face {
    font-family: 'text-security-circle';
    src: url('text-security-circle.eot');
    src: url('text-security-circle.eot?#iefix') format('embedded-opentype'),
        url('text-security-circle.woff2') format('woff2'),
        url('text-security-circle.woff') format('woff'),
        url('text-security-circle.ttf') format('truetype'),
        url('text-security-circle.svg#text-security') format('svg');
}
@font-face {
    font-family: 'text-security-square';
    src: url('text-security-square.eot');
    src: url('text-security-square.eot?#iefix') format('embedded-opentype'),
        url('text-security-square.woff2') format('woff2'),
        url('text-security-square.woff') format('woff'),
        url('text-security-square.ttf') format('truetype'),
        url('text-security-square.svg#text-security') format('svg');
}
@font-face {
    font-family: 'text-security-disc';
    src: url('text-security-disc.eot');
    src: url('text-security-disc.eot?#iefix') format('embedded-opentype'),
        url('text-security-disc.woff2') format('woff2'),
        url('text-security-disc.woff') format('woff'),
        url('text-security-disc.ttf') format('truetype'),
        url('text-security-disc.svg#text-security') format('svg');
}


text:
package org.olat.course.nodes.projectbroker;

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

import org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory;
import org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.download.DisplayOrDownloadComponent;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.gui.control.creator.ControllerCreator;
import org.olat.core.gui.control.generic.modal.DialogBoxController;
import org.olat.core.gui.control.generic.modal.DialogBoxUIFactory;
import org.olat.core.id.Identity;
import org.olat.core.id.OLATResourceable;
import org.olat.core.id.UserConstants;
import org.olat.core.util.coordinate.CoordinatorManager;
import org.olat.core.util.coordinate.LockResult;
import org.olat.core.util.resource.OresHelper;
import org.olat.core.util.vfs.VFSContainerMapper;
import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.projectbroker.datamodel.CustomField;
import org.olat.course.nodes.projectbroker.datamodel.Project;
import org.olat.course.nodes.projectbroker.datamodel.ProjectEvent;
import org.olat.course.nodes.projectbroker.service.ProjectBrokerManagerFactory;
import org.olat.course.nodes.projectbroker.service.ProjectBrokerModuleConfiguration;
import org.olat.course.run.environment.CourseEnvironment;
import org.olat.user.UserInfoMainController;
import org.olat.user.UserManager;

/**
 *
 * @author guretzki
 *
 */
public class ProjectDetailsDisplayController extends BasicController {

	private final String CMD_OPEN_PROJECT_LEADER_DETAIL = "cmd_open_projectleader_detail";
	private VelocityContainer myContent;
	private Link editProjectButton;
	private Link deleteProjectButton;
	private DialogBoxController deleteConfirmController;
	private List projectLeaderLinkNameList;
	private Link attachedFileLink;

	private Project project;
	private CourseEnvironment courseEnv;
	private CourseNode courseNode;
	private DialogBoxController deleteGroupConfirmController;
	private Link changeProjectStateToNotAssignButton;
	private Link changeProjectStateToAssignButton;
	private LockResult lock;

	/**
	 * @param ureq
	 * @param wControl
	 * @param hpc
	 */
	public ProjectDetailsDisplayController(UserRequest ureq, WindowControl wControl, Project project, CourseEnvironment courseEnv, CourseNode courseNode, ProjectBrokerModuleConfiguration projectBrokerModuleConfiguration) {
		super(ureq, wControl);
		this.project = project;
		this.courseEnv = courseEnv;
		this.courseNode = courseNode;

		// use property handler translator for translating of user fields
		setTranslator(UserManager.getInstance().getPropertyHandlerTranslator(getTranslator()));
		myContent = createVelocityContainer("projectdetailsdisplay");
		if (projectBrokerModuleConfiguration.isAcceptSelectionManually()) {
			myContent.contextPut("keyMaxLabel", "detailsform.places.candidates.label");
		} else {
			myContent.contextPut("keyMaxLabel", "detailsform.places.label");
		}

		if ( ProjectBrokerManagerFactory.getProjectGroupManager().isProjectManagerOrAdministrator(ureq, courseEnv, project) ) {
			myContent.contextPut("isProjectManager", true);
			editProjectButton = LinkFactory.createButtonSmall("edit.project.button", myContent, this);
			deleteProjectButton = LinkFactory.createButtonSmall("delete.project.button", myContent, this);
			if (projectBrokerModuleConfiguration.isAcceptSelectionManually()) {
				// ProjectBroker run in accept-manually mode => add button to reset/set project-state
				if ( project.getState().equals(Project.STATE_ASSIGNED) ) {
					changeProjectStateToNotAssignButton = LinkFactory.createButtonSmall("change.project.state.not_assign.button", myContent, this);
				} else {
					changeProjectStateToAssignButton = LinkFactory.createButtonSmall("change.project.state.assign.button", myContent, this);
				}
			}
		} else {
			myContent.contextPut("isProjectManager", false);
		}

		myContent.contextPut("title", project.getTitle());
		// account-Managers
		int i = 0;
		projectLeaderLinkNameList = new ArrayList();
		for (Iterator iterator = project.getProjectLeaders().iterator(); iterator.hasNext();) {
			Identity identity = (Identity) iterator.next();
			String last = identity.getUser().getProperty(UserConstants.LASTNAME, getLocale());
			String first= identity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale());
			StringBuilder projectLeaderString = new StringBuilder();
			projectLeaderString.append(first);
			projectLeaderString.append(" ");
			projectLeaderString.append(last);
			String linkName = "projectLeaderLink_" + i;
			Link projectLeaderLink = LinkFactory.createCustomLink(linkName, CMD_OPEN_PROJECT_LEADER_DETAIL, projectLeaderString.toString() , Link.NONTRANSLATED, myContent, this);
			projectLeaderLink.setUserObject(identity);
			projectLeaderLink.setTarget("_blank");
			projectLeaderLinkNameList.add(linkName);
			i++;
		}
		myContent.contextPut("projectLeaderLinkNameList", projectLeaderLinkNameList);

		myContent.contextPut("description", project.getDescription());
		// Custom-fields
		List customFieldList = new ArrayList();
		int customFieldIndex = 0;
		for (Iterator<CustomField> iterator =  projectBrokerModuleConfiguration.getCustomFields().iterator(); iterator.hasNext();) {
			CustomField customField = iterator.next();
			getLogger().debug("customField=" + customField);
			String name = customField.getName();
			String value = project.getCustomFieldValue(customFieldIndex++);
			getLogger().debug("customField  name=" + name + "  value=" + value);
			customFieldList.add(new CustomField(name,value));
		}
		myContent.contextPut("customFieldList", customFieldList);

		// events
		List eventList = new ArrayList();
		for (Project.EventType eventType : Project.EventType.values()) {
			if (projectBrokerModuleConfiguration.isProjectEventEnabled(eventType) ) {
				ProjectEvent projectEvent = project.getProjectEvent(eventType);
				eventList.add(projectEvent);
				getLogger().debug("eventList add event=" + projectEvent);
			}
		}
		myContent.contextPut("eventList", eventList);

		String stateValue = getTranslator().translate(ProjectBrokerManagerFactory.getProjectBrokerManager().getStateFor(project,ureq.getIdentity(),projectBrokerModuleConfiguration));
		myContent.contextPut("state", stateValue);
		if (project.getMaxMembers() == Project.MAX_MEMBERS_UNLIMITED) {
			myContent.contextPut("projectPlaces", this.getTranslator().translate("detailsform.unlimited.project.members") );
		} else {
			String placesValue = ProjectBrokerManagerFactory.getProjectBrokerManager().getSelectedPlaces(project) + " " + this.getTranslator().translate("detailsform.places.of") + " " + project.getMaxMembers();
			myContent.contextPut("projectPlaces", placesValue);
		}

		attachedFileLink = LinkFactory.createCustomLink("attachedFileLink", "cmd.donwload.attachment", project.getAttachmentFileName(), Link.NONTRANSLATED, myContent, this);
		putInitialPanel(myContent);
	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
	 *      org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
	 */
	public void event(UserRequest ureq, Controller source, Event event) {
		if (source == deleteConfirmController) {
			if (DialogBoxUIFactory.isOkEvent(event)) {
				// ok group should be deleted, ask to delete group too
				deleteGroupConfirmController = this.activateYesNoDialog(ureq, null, translate("delete.group.confirm",project.getTitle()), deleteConfirmController);
			}
		} else if (source == deleteGroupConfirmController) {
			boolean deleteGroup;
			if (DialogBoxUIFactory.isOkEvent(event)) {
				deleteGroup = true;
			} else {
				deleteGroup = false;
			}
			// send email before delete project with group
			ProjectBrokerManagerFactory.getProjectBrokerEmailer().sendProjectDeletedEmailToParticipants(ureq.getIdentity(), project, this.getTranslator());
			ProjectBrokerManagerFactory.getProjectBrokerEmailer().sendProjectDeletedEmailToManager(ureq.getIdentity(), project, this.getTranslator());
			//now send email to PB-accountmanager
			ProjectBrokerManagerFactory.getProjectBrokerEmailer().sendProjectDeletedEmailToAccountManagers(ureq.getIdentity(), project, courseEnv, courseNode, getTranslator());

			ProjectBrokerManagerFactory.getProjectBrokerManager().deleteProject(project, deleteGroup, courseEnv, courseNode);
			ProjectBrokerManagerFactory.getProjectGroupManager().sendGroupChangeEvent(project, courseEnv.getCourseResourceableId(), ureq.getIdentity());
			showInfo("project.deleted.msg", project.getTitle());
			fireEvent(ureq, new ProjectBrokerEditorEvent(project, ProjectBrokerEditorEvent.DELETED_PROJECT));
			CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(lock);
		}

	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
	 */
	public void event(UserRequest ureq, Component source, Event event) {
		if ( ProjectBrokerManagerFactory.getProjectBrokerManager().existsProject(project.getKey()) ) {
			if (source == editProjectButton) {
				fireEvent(ureq, new Event("switchToEditMode"));
			} else if (source == deleteProjectButton) {
				OLATResourceable projectOres = OresHelper.createOLATResourceableInstance(Project.class, project.getKey());
				this.lock = CoordinatorManager.getInstance().getCoordinator().getLocker().acquireLock(projectOres, ureq.getIdentity(), null);
				if (lock.isSuccess()) {
					deleteConfirmController = activateOkCancelDialog(ureq, null, translate("delete.confirm",project.getTitle()), deleteConfirmController);
				} else {
					this.showInfo("info.project.already.edit", project.getTitle());
				}
				return;
			} else if (event.getCommand().equals(CMD_OPEN_PROJECT_LEADER_DETAIL)){
				if (source instanceof Link) {
					Link projectLeaderLink = (Link)source;
					final Identity identity = (Identity)projectLeaderLink.getUserObject();
					ControllerCreator ctrlCreator = new ControllerCreator() {
						public Controller createController(UserRequest lureq, WindowControl lwControl) {
							return new UserInfoMainController(lureq, lwControl, identity);
						}
					};
					// wrap the content controller into a full header layout
					ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
					// open in new browser window
					this.openInNewBrowserWindow(ureq, layoutCtrlr);
				}
			} else if (source == attachedFileLink) {
				doFileDelivery(ureq, project, courseEnv, courseNode);
			} else if (source == changeProjectStateToNotAssignButton) {
				ProjectBrokerManagerFactory.getProjectBrokerManager().setProjectState(project, Project.STATE_NOT_ASSIGNED);
				myContent.remove(changeProjectStateToNotAssignButton);
				changeProjectStateToAssignButton = LinkFactory.createButtonSmall("change.project.state.assign.button", myContent, this);
			} else if (source == changeProjectStateToAssignButton) {
				ProjectBrokerManagerFactory.getProjectBrokerManager().setProjectState(project, Project.STATE_ASSIGNED);
				myContent.remove(changeProjectStateToAssignButton);
				changeProjectStateToNotAssignButton = LinkFactory.createButtonSmall("change.project.state.not_assign.button", myContent, this);
			}
		} else {
			this.showInfo("info.project.nolonger.exist", project.getTitle());
		}
	}

	/**
	 *
	 * @see org.olat.core.gui.control.DefaultController#doDispose(boolean)
	 */
	protected void doDispose() {
		// child controller sposed by basic controller
		if (lock != null) {
			CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(lock);
		}
	}

	private void doFileDelivery(UserRequest ureq, final Project project, final CourseEnvironment courseEnv, final CourseNode cNode) {
		// Create a mapper to deliver the auto-download of the file. We have to
		// create a dedicated mapper here
		// and can not reuse the standard briefcase way of file delivering, some
		// very old fancy code
		// Mapper is cleaned up automatically by basic controller

		OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(ProjectBrokerManagerFactory.getProjectBrokerManager().getAttamchmentRelativeRootPath(project,courseEnv,cNode),null);
		String baseUrl = registerMapper(ureq, new VFSContainerMapper(rootFolder));

		// Trigger auto-download
		if(isLogDebugEnabled()) {
			logDebug("baseUrl=" + baseUrl, null);
		}
		DisplayOrDownloadComponent dordc = new DisplayOrDownloadComponent("downloadcomp",baseUrl + "/" + project.getAttachmentFileName());
		myContent.put("autoDownloadComp", dordc);
	}

}


text:
#!/usr/bin/env node

/******************************************************************************
 *                                                                            *
 * @file ssl.js                                                               *
 * @author Clément Désiles <main@jokester.fr>                                 *
 * @licence MIT (see LICENCE file)                                            *
 * @date 07/23/2012                                                           *
 *                                                                            *
 * Generate or regenerate the server certificate                              *
 * accordingly to `config.json` configuration file                            *
 *                                                                            *
 *****************************************************************************/

// -----------------------------  DEPENDENCIES  ---------------------------- //
var config  = require('./config').ssl,
    path    = require('path'),
    fs      = require('fs'),
    exec    = require('child_process').exec,
    cconsole = require('colorize').console;

if(!config){
	console.error('SSL is not configured in config.json file. \nAbort');
	process.exit(1);
}

//Create the default 'ssl' directory if it does not exist
var sslDefaultPath = path.join(__dirname,'ssl');
fs.exists(sslDefaultPath, function(exists){
	fs.mkdir(sslDefaultPath);
});

// -----------------------------  CONFIGURATION  ---------------------------- //
config.path.certificate = path.join(__dirname,config.path.certificate);
config.path.privatekey = path.join(__dirname,config.path.privatekey);
config.company.countryCode = config.company.countryCode.replace(' ','');
config.company.city = config.company.city.replace(' ','');
config.company.name= config.company.name.replace(' ','');

var cmd = 'openssl req -new -x509 -out ' + config.path.certificate +
          ' -newkey '+ config.key.algorithm +':'+ config.key.length +
          ' -keyout ' + config.path.privatekey +
          ' -nodes -subj ';

cmd += '/C=' + config.company.countryCode +
       '/ST='+ config.company.provinceCode +
       '/L=' + config.company.city +
       '/O=' + config.company.name +
       '/CN='+ config.company.domain +
       '/emailAddress=' + config.company.email;

// --------------------------  EXECUTING COMMAND  -------------------------- //
exec(cmd, function(err, stdout, stderr){
	if(!err){
		console.info('New private key:', config.path.privatekey);
		console.info('New certificate:', config.path.certificate);
		console.info('Certificate information:');
		console.info('\tCountry code:', config.company.countryCode);
		console.info('\tProvince code:', config.company.provinceCode);
		console.info('\tCompany city:' , config.company.city);
		console.info('\tCompany name:', config.company.name);
		console.info('\tDomain name server:', config.company.domain);
		console.info('\tCompany E-mail:', config.company.email);
		process.exit(0);
	} else {
		console.error('Check your configuration (config.json) or ' +
		            'that you have `openssl` installed on your system');
		cconsole.error('#yellow[',err,']');
		process.exit(1);
	}
});


text:
typedef struct Table_Entry
{
	uint32_t hash;
	char *string;
	Table_Entry *next;
} Table_Entry;

typedef struct String_Table
{
	uint32_t entry_count;
	Table_Entry *entries;
} String_Table;

uint32_t string_hash(const char *str)
{
	uint32_t hash = 1;
	char c;
	while (c = *str++)
	{
		hash = hash * 3 + c;
	}
	return hash;
}

String_Table *create_table()
{
	const uint32_t entry_count = 1024;

	String_Table *table = (String_Table*)malloc(sizeof(String_Table));
	Table_Entry *entries = (Table_Entry*)malloc(entry_count * sizeof(Table_Entry));

	if (!table || !entries)
	{
		free(table);
		free(entries);
		return NULL;
	}

	table->entry_count = entry_count;
	table->entries = entries;

	return table;
}

bool initialize_entry(String_Table *table, Table_Entry *entry, uint32_t hash, const char *string)
{
	unsigned size = (unsigned)strlen(string) + 1;
	char *canonical_string = (char*)malloc(size);
	if (canonical_string == NULL)
		return false;

	memcpy(canonical_string, string, size + 1);

	entry->hash = hash;
	entry->string = canonical_string;
	entry->next = NULL;
	return true;
}

Table_Entry *create_entry(String_Table *table, uint32_t hash, const char *string)
{
	Table_Entry *entry = (Table_Entry*)malloc(sizeof(Table_Entry));

	if (!initialize_entry(table, entry, hash, string))
	{
		free(entry);
		return NULL;
	}

	return entry;
}

const char *intern_string(String_Table *table, const char *string)
{
	uint32_t hash = string_hash(string);
	uint32_t index = hash % table->entry_count;

	Table_Entry *entry = &table->entries[index];

	if (entry->string == NULL)
	{
		if (initialize_entry(table, entry, hash, string))
			return entry->string;
		return NULL;
	}

	while (hash != entry->hash || strcmp(string, entry->string))
	{
		if (entry->next)
			entry = entry->next;
		else
		{
			Table_Entry *new_entry = create_entry(table, hash, string);
			if (!new_entry)
				return NULL;
			entry->next = new_entry;
			return new_entry->string;
		}
	}

	return entry->string;
}

const char *find_string(const String_Table *table, const char *string)
{
	uint32_t hash = string_hash(string);
	uint32_t index = hash % table->entry_count;

	Table_Entry *entry = &table->entries[index];

	if (entry->string == NULL)
		return NULL;

	while (hash != entry->hash || strcmp(string, entry->string))
	{
		if (entry->next)
			entry = entry->next;
		else
			return NULL;
	}

	return entry->string;
}


text:
#ifndef _LED_H_
#define _LED_H_

#include "gpio.h"

/*! \brief Turns off the specified LEDs.
 *
 * \param led_gpio LED to turn off (LEDx_GPIO).
 *
 * \note The pins of the specified LEDs are set to GPIO output mode.
 */
#define LED_Off(led_gpio)     gpio_set_pin_high(led_gpio)

/*! \brief Turns on the specified LEDs.
 *
 * \param led_gpio LED to turn on (LEDx_GPIO).
 *
 * \note The pins of the specified LEDs are set to GPIO output mode.
 */
#define LED_On(led_gpio)      gpio_set_pin_low(led_gpio)

/*! \brief Toggles the specified LEDs.
 *
 * \param led_gpio LED to toggle (LEDx_GPIO).
 *
 * \note The pins of the specified LEDs are set to GPIO output mode.
 */
#define LED_Toggle(led_gpio)  gpio_toggle_pin(led_gpio)

#endif  // _LED_H_