text:
// Tests for the Font class.

#include "sky/engine/platform/fonts/Character.h"
#include "sky/engine/platform/fonts/Font.h"

#include <gtest/gtest.h>

namespace blink {

static void TestSpecificUCharRange(UChar rangeStart, UChar rangeEnd)
{
    UChar below[1];
    UChar start[1];
    UChar midway[1];
    UChar end[1];
    UChar above[1];

    below[0] = rangeStart - 1;
    start[0] = rangeStart;
    midway[0] = ((int)rangeStart + (int)rangeEnd) / 2;
    end[0] = rangeEnd;
    above[0] = rangeEnd + 1;

    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(below, 1));
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(start, 1));
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(midway, 1));
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(end, 1));
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(above, 1));
}

TEST(FontTest, TestCharacterRangeCodePath)
{
    static UChar c1[] = { 0x0 };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c1, 1));

    TestSpecificUCharRange(0x2E5, 0x2E9);
    TestSpecificUCharRange(0x300, 0x36F);
    TestSpecificUCharRange(0x0591, 0x05BD);
    TestSpecificUCharRange(0x05BF, 0x05CF);
    TestSpecificUCharRange(0x0600, 0x109F);
    TestSpecificUCharRange(0x1100, 0x11FF);
    TestSpecificUCharRange(0x135D, 0x135F);
    TestSpecificUCharRange(0x1700, 0x18AF);
    TestSpecificUCharRange(0x1900, 0x194F);
    TestSpecificUCharRange(0x1980, 0x19DF);
    TestSpecificUCharRange(0x1A00, 0x1CFF);

    static UChar c2[] = { 0x1DBF };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c2, 1));
    static UChar c3[] = { 0x1DC0 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c3, 1));
    static UChar c4[] = { 0x1DD0 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c4, 1));
    static UChar c5[] = { 0x1DFF };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c5, 1));
    static UChar c6[] = { 0x1E00 };
    EXPECT_EQ(SimpleWithGlyphOverflowPath, Character::characterRangeCodePath(c6, 1));
    static UChar c7[] = { 0x2000 };
    EXPECT_EQ(SimpleWithGlyphOverflowPath, Character::characterRangeCodePath(c7, 1));
    static UChar c8[] = { 0x2001 };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c8, 1));

    TestSpecificUCharRange(0x20D0, 0x20FF);
    TestSpecificUCharRange(0x2CEF, 0x2CF1);
    TestSpecificUCharRange(0x302A, 0x302F);

    TestSpecificUCharRange(0xA67C, 0xA67D);
    TestSpecificUCharRange(0xA6F0, 0xA6F1);
    TestSpecificUCharRange(0xA800, 0xABFF);

    TestSpecificUCharRange(0xD7B0, 0xD7FF);
    TestSpecificUCharRange(0xFE00, 0xFE0F);
    TestSpecificUCharRange(0xFE20, 0xFE2F);
}

TEST(FontTest, TestCharacterRangeCodePathSurrogate1)
{
    /* To be surrogate ... */
    /* 1st character must be 0xD800 .. 0xDBFF */
    /* 2nd character must be 0xdc00 .. 0xdfff */

    /* The following 5 should all be Simple because they are not surrogate. */
    static UChar c1[] = { 0xD800, 0xDBFE };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c1, 2));
    static UChar c2[] = { 0xD800, 0xE000 };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c2, 2));
    static UChar c3[] = { 0xDBFF, 0xDBFE };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c3, 2));
    static UChar c4[] = { 0xDBFF, 0xE000 };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c4, 2));
    static UChar c5[] = { 0xDC00, 0xDBFF };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c5, 2));

    /* To be Complex, the Supplementary Character must be in either */
    /* U+1F1E6 through U+1F1FF or U+E0100 through U+E01EF. */
    /* That is, a lead of 0xD83C with trail 0xDDE6 .. 0xDDFF or */
    /* a lead of 0xDB40 with trail 0xDD00 .. 0xDDEF. */
    static UChar c6[] = { 0xD83C, 0xDDE5 };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c6, 2));
    static UChar c7[] = { 0xD83C, 0xDDE6 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c7, 2));
    static UChar c8[] = { 0xD83C, 0xDDF0 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c8, 2));
    static UChar c9[] = { 0xD83C, 0xDDFF };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c9, 2));
    static UChar c10[] = { 0xD83C, 0xDE00 };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c10, 2));

    static UChar c11[] = { 0xDB40, 0xDCFF };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c11, 2));
    static UChar c12[] = { 0xDB40, 0xDD00 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c12, 2));
    static UChar c13[] = { 0xDB40, 0xDDED };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c13, 2));
    static UChar c14[] = { 0xDB40, 0xDDEF };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c14, 2));
    static UChar c15[] = { 0xDB40, 0xDDF0 };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c15, 2));
}

TEST(FontTest, TestCharacterRangeCodePathString)
{
    // Simple-Simple is still simple
    static UChar c1[] = { 0x2FF, 0x2FF };
    EXPECT_EQ(SimplePath, Character::characterRangeCodePath(c1, 2));
    // Complex-Simple is Complex
    static UChar c2[] = { 0x300, 0x2FF };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c2, 2));
    // Simple-Complex is Complex
    static UChar c3[] = { 0x2FF, 0x330 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c3, 2));
    // Complex-Complex is Complex
    static UChar c4[] = { 0x36F, 0x330 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c4, 2));
    // SimpleWithGlyphOverflow-Simple is SimpleWithGlyphOverflow
    static UChar c5[] = { 0x1E00, 0x2FF };
    EXPECT_EQ(SimpleWithGlyphOverflowPath, Character::characterRangeCodePath(c5, 2));
    // Simple-SimpleWithGlyphOverflow is SimpleWithGlyphOverflow
    static UChar c6[] = { 0x2FF, 0x2000 };
    EXPECT_EQ(SimpleWithGlyphOverflowPath, Character::characterRangeCodePath(c6, 2));
    // SimpleWithGlyphOverflow-Complex is Complex
    static UChar c7[] = { 0x1E00, 0x330 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c7, 2));
    // Complex-SimpleWithGlyphOverflow is Complex
    static UChar c8[] = { 0x330, 0x2000 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c8, 2));
    // Surrogate-Complex is Complex
    static UChar c9[] = { 0xD83C, 0xDDE5, 0x330 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c9, 3));
    // Complex-Surrogate is Complex
    static UChar c10[] = { 0x330, 0xD83C, 0xDDE5 };
    EXPECT_EQ(ComplexPath, Character::characterRangeCodePath(c10, 3));
}

static void TestSpecificUChar32RangeIdeograph(UChar32 rangeStart, UChar32 rangeEnd)
{
    EXPECT_FALSE(Character::isCJKIdeograph(rangeStart - 1));
    EXPECT_TRUE(Character::isCJKIdeograph(rangeStart));
    EXPECT_TRUE(Character::isCJKIdeograph((UChar32)((uint64_t)rangeStart + (uint64_t)rangeEnd) / 2));
    EXPECT_TRUE(Character::isCJKIdeograph(rangeEnd));
    EXPECT_FALSE(Character::isCJKIdeograph(rangeEnd + 1));
}

TEST(FontTest, TestIsCJKIdeograph)
{
    // The basic CJK Unified Ideographs block.
    TestSpecificUChar32RangeIdeograph(0x4E00, 0x9FFF);
    // CJK Unified Ideographs Extension A.
    TestSpecificUChar32RangeIdeograph(0x3400, 0x4DBF);
    // CJK Unified Ideographs Extension A and Kangxi Radicals.
    TestSpecificUChar32RangeIdeograph(0x2E80, 0x2FDF);
    // CJK Strokes.
    TestSpecificUChar32RangeIdeograph(0x31C0, 0x31EF);
    // CJK Compatibility Ideographs.
    TestSpecificUChar32RangeIdeograph(0xF900, 0xFAFF);
    // CJK Unified Ideographs Extension B.
    TestSpecificUChar32RangeIdeograph(0x20000, 0x2A6DF);
    // CJK Unified Ideographs Extension C.
    // CJK Unified Ideographs Extension D.
    TestSpecificUChar32RangeIdeograph(0x2A700, 0x2B81F);
    // CJK Compatibility Ideographs Supplement.
    TestSpecificUChar32RangeIdeograph(0x2F800, 0x2FA1F);
}

static void TestSpecificUChar32RangeIdeographSymbol(UChar32 rangeStart, UChar32 rangeEnd)
{
    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(rangeStart - 1));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(rangeStart));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol((UChar32)((uint64_t)rangeStart + (uint64_t)rangeEnd) / 2));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(rangeEnd));
    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(rangeEnd + 1));
}

TEST(FontTest, TestIsCJKIdeographOrSymbol)
{
    // CJK Compatibility Ideographs Supplement.
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2C7));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2CA));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2CB));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2D9));

    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2020));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2021));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2030));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x203B));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x203C));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2042));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2047));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2048));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2049));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2051));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x20DD));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x20DE));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2100));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2103));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2105));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2109));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x210A));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2113));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2116));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2121));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x212B));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x213B));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2150));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2151));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2152));

    TestSpecificUChar32RangeIdeographSymbol(0x2156, 0x215A);
    TestSpecificUChar32RangeIdeographSymbol(0x2160, 0x216B);
    TestSpecificUChar32RangeIdeographSymbol(0x2170, 0x217B);

    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x217F));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2189));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2307));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2312));

    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(0x23BD));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x23BE));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x23C4));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x23CC));
    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(0x23CD));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x23CE));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2423));

    TestSpecificUChar32RangeIdeographSymbol(0x2460, 0x2492);
    TestSpecificUChar32RangeIdeographSymbol(0x249C, 0x24FF);

    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25A0));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25A1));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25A2));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25AA));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25AB));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25B1));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25B2));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25B3));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25B6));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25B7));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25BC));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25BD));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25C0));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25C1));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25C6));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25C7));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25C9));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25CB));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25CC));

    TestSpecificUChar32RangeIdeographSymbol(0x25CE, 0x25D3);
    TestSpecificUChar32RangeIdeographSymbol(0x25E2, 0x25E6);

    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x25EF));

    TestSpecificUChar32RangeIdeographSymbol(0x2600, 0x2603);

    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2605));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2606));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x260E));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2616));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2617));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2640));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2642));

    TestSpecificUChar32RangeIdeographSymbol(0x2660, 0x266F);
    TestSpecificUChar32RangeIdeographSymbol(0x2672, 0x267D);

    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x26A0));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x26BD));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x26BE));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2713));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x271A));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x273F));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2740));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2756));

    TestSpecificUChar32RangeIdeographSymbol(0x2776, 0x277F);

    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x2B1A));

    TestSpecificUChar32RangeIdeographSymbol(0x2FF0, 0x302F);
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x3031));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x312F));
    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(0x3130));

    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(0x318F));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x3190));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x319F));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x31BF));

    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(0x31FF));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x3200));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x3300));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x33FF));

    TestSpecificUChar32RangeIdeographSymbol(0xF860, 0xF862);
    TestSpecificUChar32RangeIdeographSymbol(0xFE30, 0xFE4F);

    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0xFE10));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0xFE11));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0xFE12));
    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0xFE19));

    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(0xFF0D));
    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(0xFF1B));
    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(0xFF1C));
    EXPECT_FALSE(Character::isCJKIdeographOrSymbol(0xFF1E));

    TestSpecificUChar32RangeIdeographSymbol(0xFF00, 0xFFEF);

    EXPECT_TRUE(Character::isCJKIdeographOrSymbol(0x1F100));

    TestSpecificUChar32RangeIdeographSymbol(0x1F110, 0x1F129);
    TestSpecificUChar32RangeIdeographSymbol(0x1F130, 0x1F149);
    TestSpecificUChar32RangeIdeographSymbol(0x1F150, 0x1F169);
    TestSpecificUChar32RangeIdeographSymbol(0x1F170, 0x1F189);
    TestSpecificUChar32RangeIdeographSymbol(0x1F200, 0x1F6FF);
}

} // namespace blink


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.inco5.slf4j.it</groupId>
    <artifactId>it</artifactId>
    <version>1.0.0-SNAPSHOT</version>
  </parent>
  <artifactId>slf4j-simple-17</artifactId>
  <packaging>jar</packaging>

  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>${slf4j-simple-17.version}</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <type>test-jar</type>
    </dependency>
    <dependency>
      <groupId>com.inco5.slf4j.it</groupId>
      <artifactId>tests</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <failIfNoTests>true</failIfNoTests>
          <dependenciesToScan>
            <dependency>org.slf4j:slf4j-api</dependency>
            <dependency>com.inco5.slf4j.it:tests</dependency>
          </dependenciesToScan>
          <excludes>
            <exclude>**org/slf4j/NoBindingTest**</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

redpajama_set_name: RedPajamaGithub


text:
package jlibs.xml.xsd.sequences;

import jlibs.core.graph.sequences.AbstractSequence;
import org.apache.xerces.xs.XSNamespaceItem;
import org.apache.xerces.xs.XSNamespaceItemList;

/**
 * @author Santhosh Kumar T
 */
public class XSNamespaceItemListSequence extends AbstractSequence<XSNamespaceItem>{
    private XSNamespaceItemList list;

    public XSNamespaceItemListSequence(XSNamespaceItemList list){
        this.list = list;
        _reset();
    }

    /*-------------------------------------------------[ Advancing ]---------------------------------------------------*/

    private int i;

    @Override
    protected XSNamespaceItem findNext(){
        return list.item(++i);
    }

    /*-------------------------------------------------[ Reuse ]---------------------------------------------------*/

    @Override
    public void reset(){
        super.reset();
        _reset();
    }

    private void _reset(){
        i = -1;
    }

    @Override
    public XSNamespaceItemListSequence copy(){
        return new XSNamespaceItemListSequence(list);
    }

    /*-------------------------------------------------[ Optimization ]---------------------------------------------------*/

    @Override
    public int length(){
        return list.getLength();
    }
}


text:
package graphql.java.generator.field.reflect;

import graphql.java.generator.UnsharableBuildContextStorer;
import graphql.java.generator.datafetcher.ArgumentExtractingDataFetcher;
import graphql.java.generator.datafetcher.GraphQLInputAwareDataFetcher;
import graphql.java.generator.datafetcher.MethodInvokingDataFetcher;
import graphql.java.generator.field.strategies.FieldDataFetcherStrategy;
import graphql.schema.FieldDataFetcher;
import graphql.schema.GraphQLArgument;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.List;

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

/**
 * For a given {@link java.lang.reflect.Field} or {@link java.lang.reflect.Method}
 * return a DataFetcher that obtains data through that.
 * @author dwinsor
 *
 */
public class FieldDataFetcher_Reflection
        extends UnsharableBuildContextStorer
        implements FieldDataFetcherStrategy {
    private static Logger logger = LoggerFactory.getLogger(
            FieldDataFetcher_Reflection.class);

    @Override
    public Object getFieldFetcher(Object object) {
        if (object instanceof Field) {
            return getFieldFetcherFromField((Field) object);
        }
        if (object instanceof Method) {
            return getFieldFetcherFromMethod((Method) object);
        }
        return null;
    }

    protected Object getFieldFetcherFromField(Field field) {
        Class<?> clazz = field.getDeclaringClass();
        Method getter = getGetterMethod(field, clazz);
        if (getter != null) {
            //This is commented out because it is redundant, but included
            //here for documentation, to be changed later
            //fieldBuilder.dataFetcher(new PropertyDataFetcher(field.getName()));
        }
        else {
            if (!Modifier.isPublic(field.getModifiers())) {
                logger.debug("field [{}] is not public and has no getter", field);
                return null;
            }
            logger.debug("Direct field access Class [{}], field [{}], type [{}]",
                    clazz, field.getName(), field.getType());
            return new FieldDataFetcher(field.getName());
        }
        return null;
    }

    protected Object getFieldFetcherFromMethod(Method method) {
        return getFieldFetcherFromMethod(method, null);
    }

    protected Object getFieldFetcherFromMethod(Method method, Object methodSource) {
        MethodInvokingDataFetcher methodInvoker = new MethodInvokingDataFetcher(method);
        methodInvoker.setSource(methodSource);
        List<GraphQLArgument> arguments = getContext()
                .getArgumentsGeneratorStrategy().getArguments(method);
        if (arguments == null || arguments.isEmpty()) {
            return methodInvoker;
        }
        return new GraphQLInputAwareDataFetcher(
                new ArgumentExtractingDataFetcher(methodInvoker), arguments);
    }

    /**
     * @param field
     * @param clazzContainingField
     * @return
     */
    protected Method getGetterMethod(Field field, Class<?> clazzContainingField) {
        Class<?> type = field.getType();
        String fieldName = field.getName();
        String prefix = (type.isAssignableFrom(Boolean.class) || type.isAssignableFrom(boolean.class))
                ? "is" : "get";
        String getterName = prefix + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
        try {
            Method getter = clazzContainingField.getMethod(getterName);
            return getter;
        }
        catch (NoSuchMethodException e) {
        }

        //TODO Be more permissive in the name, allowing getobject() or isboolean()
        //something like getterName = prefix + fieldName;
        //this requires updated DataFetchers, so will not be done yet.

        return null;
    }
}


text:
namespace CodeVisualizer.Controls.PropertiesForm
{
    partial class FunctionPicker
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.functionPickerBox = new System.Windows.Forms.ComboBox();
            this.ConfirmButton = new MetroFramework.Controls.MetroButton();
            this.SuspendLayout();
            //
            // functionPickerBox
            //
            this.functionPickerBox.Dock = System.Windows.Forms.DockStyle.Top;
            this.functionPickerBox.FormattingEnabled = true;
            this.functionPickerBox.Location = new System.Drawing.Point(20, 60);
            this.functionPickerBox.Name = "functionPickerBox";
            this.functionPickerBox.Size = new System.Drawing.Size(228, 21);
            this.functionPickerBox.TabIndex = 0;
            this.functionPickerBox.SelectedIndexChanged += new System.EventHandler(this.functionPickerBox_SelectedIndexChanged);
            //
            // ConfirmButton
            //
            this.ConfirmButton.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.ConfirmButton.Location = new System.Drawing.Point(20, 83);
            this.ConfirmButton.Name = "ConfirmButton";
            this.ConfirmButton.Size = new System.Drawing.Size(228, 23);
            this.ConfirmButton.TabIndex = 1;
            this.ConfirmButton.Text = "Confirm";
            this.ConfirmButton.UseSelectable = true;
            this.ConfirmButton.Click += new System.EventHandler(this.ConfirmButton_Click);
            //
            // FunctionPicker
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(268, 126);
            this.Controls.Add(this.ConfirmButton);
            this.Controls.Add(this.functionPickerBox);
            this.Name = "FunctionPicker";
            this.Text = "FunctionPicker";
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.ComboBox functionPickerBox;
        private MetroFramework.Controls.MetroButton ConfirmButton;
    }
}


text:
import Model from '../models/notification';

import preSave from './utils';

preSave(Model);


text:
package com.reactivetechnologies.mq.ops;

import com.reactivetechnologies.blaze.struct.QRecord;

public interface ProducerOperations extends BaseOperations{

	/**
		 * Enqueue items by head (left). Along with the destination queue (termed SOURCE), another surrogate queue (termed SINK) is used
		 * for reliability and guaranteed message delivery. See explanation.
		 * <pre>
		 *       == == == == ==
	   Right --> ||	 ||	 ||  || <-- Left
	(tail)       == == == == ==      (head)
		 * </pre>
		 *
		 * We do a LPUSH to enqueue items, which is push from head. So the 'first in' item will always be at tail.
		 * While dequeuing, thus the tail has to be popped by a RPOP. To achieve data safety on dequeue
		 * operation, we would do an atomic RPOPLPUSH (POP from tail of a SOURCE queue and push to head of a SINK queue)
		 *
		 * @see {@link https://redis.io/commands/rpoplpush#pattern-reliable-queue}
		 * @param exchange
		 * @param key the destination queue
		 * @param values
		 */
	void enqueue(String preparedKey, QRecord... values);

	/**
	 * Perform a plain LPUSH operation. This is generally a part of the more comprehensive {@link #enqueue()} operation.
	 * @param preparedKey
	 * @param items
	 */
	void lpushAll(String preparedKey, QRecord[] items);

	String prepareListKey(String exchange, String key);

}


text:
EXEC_PATH="`dirname $0`"
BUILD_TYPE="$1"
RA_TYPE="$2"
FS_TYPE="$3"

# Source the configuration file.
. "$EXEC_PATH/svntest-config.sh"

# Compute local vars
LOG_FILE="$LOG_FILE_PREFIX.$BUILD_TYPE.$RA_TYPE.$FS_TYPE"
TEST="`$GUESS` $BUILD_TYPE $RA_TYPE $FS_TYPE"
REV="`$SVN st -v $SVN_SOURCE/README | $CUT -c 12-17 | $SED -e 's/^ *//'`"

# Prime and initialize the log file
$CP_F "$LOG_FILE_PREFIX.$BUILD_TYPE" $LOG_FILE
echo >> $LOG_FILE
echo "TEST: $REVPREFIX$REV on $TEST" >> $LOG_FILE
echo "TIME: $($DATE '+%Y-%m-%d %H:%M:%S %z')" >> $LOG_FILE
echo >> $LOG_FILE

# Check the build type
START "check build type" "Checking build type..."
case $BUILD_TYPE in
    shared) OBJ="$OBJ_SHARED" ;;
    static) OBJ="$OBJ_STATIC" ;;
    *)  echo "$BUILD_TYPE: unknown build type"
        echo "$BUILD_TYPE: unknown build type" >> $LOG_FILE
        FAIL ;;
esac
PASS

# Check the test type
START "check RA type" "Checking RA methd..."
case $RA_TYPE in
    ra_local) CHECK_TARGET="check" ;;
    ra_svn)   CHECK_TARGET="svncheck" ;;
    ra_dav)   CHECK_TARGET="davcheck" ;;
    *)  echo "$RA_TYPE: unknown RA type"
        echo "$RA_TYPE: unknown RA type" >> $LOG_FILE
        FAIL ;;
esac
PASS

# Check the FS type
START "check FS type" "Checking FS type..."
case $FS_TYPE in
    bdb)  CHECK_ARGS="FS_TYPE=bdb" ;;
    fsfs) CHECK_ARGS="FS_TYPE=fsfs" ;;
    *)  echo "$FS_TYPE: unknown FS type"
        echo "$FS_TYPE: unknown FS type" >> $LOG_FILE
        FAIL ;;
esac
PASS

# Check that the object directory exists, and that it contains the
# necessary executable files
START "check object directory" "Checking object directory..."
test -d $TEST_ROOT/$OBJ || FAIL; PASS
START "check svn executable" "Checking svn executable..."
test -x $INST_DIR/$SVN_NAME/bin/svn || FAIL; PASS
START "check svnadmin executable" "Checking svnadmin executable..."
test -x $INST_DIR/$SVN_NAME/bin/svnadmin || FAIL; PASS
START "check svnlook executable" "Checking svnlook executable..."
test -x $INST_DIR/$SVN_NAME/bin/svnlook || FAIL; PASS
START "check svnserve executable" "Checking svnserve executable..."
test -x $INST_DIR/$SVN_NAME/bin/svnserve || FAIL; PASS
START "check svnversion executable" "Checking svnversion executable..."
test -x $INST_DIR/$SVN_NAME/bin/svnversion || FAIL; PASS

# Build has initially mounted ramdisk for us, but this
# script will at the end to do unmount, so check if it is mounted or not
# and if it is not, do initial fire up for it
if test "xyes" = "x$RAMDISK";
then
    reinitialize_ramdisk
fi

if test "xyes" = "x$INTERMEDIATE_CLEANUP";
then
    # Flag the tests to cleanup after themselves to avoid requiring
    # hundreds of MBs of storage at once for test data.
    CHECK_ARGS="$CHECK_ARGS CLEANUP=1"
fi

# Prepare the server
case $CHECK_TARGET in
    check)
        # Nothing to do here
        ;;
    svncheck)
        START "run svnserve" "Running svnserve..."
        $TEST_ROOT/$OBJ/subversion/svnserve/svnserve -d \
            --listen-port $SVNSERVE_PORT \
            -r $TEST_ROOT/$OBJ/$RA_SVN_REPO_ROOT \
            >> $LOG_FILE 2>&1
        test $? = 0 || FAIL
        PASS

        START "get svnserve pid" "Getting svnserve process ID..."
        USER_NAME="`$ID_UN`"
        SVNSERVE_PID="`$PS_U $USER_NAME | $GREP '[s]vnserve' \
                       | $SED -e 's/^ *//' | $CUT -f 1 -d ' ' -s`"
        test -n "$SVNSERVE_PID" || FAIL
        PASS
        CHECK_ARGS="$CHECK_ARGS $RA_SVN_CHECK_ARGS"
        ;;
    davcheck)
        START "run $HTTPD_NAME" "Running $HTTPD_NAME..."
        $CP_F "$TEST_ROOT/$HTTPD_NAME.conf" \
            "$INST_DIR/$HTTPD_NAME/conf/httpd.conf" || FAIL

        $CP_F "$TEST_ROOT/mod_dav_${SVN_NAME}.conf" \
            "$INST_DIR/$HTTPD_NAME/conf/mod_dav_svn.conf" || FAIL

        "$INST_DIR/$HTTPD_NAME/bin/apachectl" start \
            >> $LOG_FILE 2>&1
        test $? = 0 || FAIL
        PASS
        CHECK_ARGS="$CHECK_ARGS $RA_DAV_CHECK_ARGS"
        ;;
esac

# Kill the server
kill_svnserve() {
    case $CHECK_TARGET in
        check)
            # Nothing to do here
            ;;
        svncheck)
            START "kill svnserve" "Stopping svnserve..."
            $KILL $SVNSERVE_PID || FAIL
            PASS
            ;;
        davcheck)
            START "kill $HTTPD_NAME" "Stopping $HTTPD_NAME..."
            "$INST_DIR/$HTTPD_NAME/bin/apachectl" stop || \
                FAIL
            PASS
            ;;
    esac

    umount_ramdisk "$TEST_ROOT/$OBJ/subversion/tests"
}

# Test
ts_start=`$DATE +"%s"`

START "make $CHECK_TARGET" "Testing $RA_TYPE on $FS_TYPE..."
CHECK_LOG_FILE="$LOG_FILE_DIR/LOG_svn_check_${BUILD_TYPE}_${RA_TYPE}_${FS_TYPE}"
cd $TEST_ROOT/$OBJ
if test "$CHECK_TARGET" = "davcheck";
then
    # At the moment we can't give repository url with
    # make davcheck, so use check & BASE_URL here for the present
    $MAKE check $CHECK_ARGS > $CHECK_LOG_FILE 2>&1
elif test "$CHECK_TARGET" = "svncheck";
then
    $MAKE check $CHECK_ARGS > $CHECK_LOG_FILE 2>&1
else
    $MAKE $CHECK_TARGET $CHECK_ARGS > $CHECK_LOG_FILE 2>&1
fi
test $? = 0 || {
    FAIL_LOG $CHECK_LOG_FILE
    $CP "tests.log" \
        "$LOG_FILE_PREFIX.log.$BUILD_TYPE.$RA_TYPE.$FS_TYPE.$REV.failed" \
        >> $LOG_FILE 2>&1

    # Prepare the log file for the mailer
    $GZIP_C < "tests.log" \
            > "$LOG_FILE_DIR/tests.$BUILD_TYPE.$RA_TYPE.$FS_TYPE.log.gz"
    FAIL kill_svnserve
}
PASS
ts_stop=`$DATE +"%s"`

START "Timer: make $CHECK_TARGET $(($ts_stop - $ts_start)) sec" \
      "Timer: make $CHECK_TARGET $(($ts_stop - $ts_start)) sec"
PASS

kill_svnserve
echo "TIME: $($DATE '+%Y-%m-%d %H:%M:%S %z')" >> $LOG_FILE


text:
import { Component } from '@angular/core';
import { PopoverConfig } from 'ngx-bootstrap/popover';

// such override allows to keep some initial values

export function getPopoverConfig(): PopoverConfig {
  return Object.assign(new PopoverConfig(), {
    placement: 'right',
    container: 'body',
    triggers: 'focus',
    delay: 500
  });
}

@Component({
  // eslint-disable-next-line @angular-eslint/component-selector
  selector: 'demo-popover-config',
  templateUrl: './config.html',
  providers: [{ provide: PopoverConfig, useFactory: getPopoverConfig }]
})
export class DemoPopoverConfigComponent {}


text:
package com.ckfinder.connector.data;

import java.util.List;

/**
 *
 */
public class PluginInfo {

	private String name;
	private String className;
	private List<PluginParam> params;
	private boolean enabled;
	private boolean internal;

	/**
	 * @return the enabled
	 */
	public final boolean isEnabled() {
		return enabled;
	}

	/**
	 * @param enabled the enabled to set
	 */
	public final void setEnabled(final boolean enabled) {
		this.enabled = enabled;
	}

	/**
	 * @return the internal
	 */
	public final boolean isInternal() {
		return internal;
	}

	/**
	 * @param internal the internal to set
	 */
	public final void setInternal(final boolean internal) {
		this.internal = internal;
	}

	/**
	 * @return the name
	 */
	public final String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public final void setName(final String name) {
		this.name = name;
	}

	/**
	 * @return the className
	 */
	public final String getClassName() {
		return className;
	}

	/**
	 * @param className the className to set
	 */
	public final void setClassName(final String className) {
		this.className = className;
	}

	/**
	 * @return the params
	 */
	public final List<PluginParam> getParams() {
		return params;
	}

	/**
	 * @param params the params to set
	 */
	public final void setParams(final List<PluginParam> params) {
		this.params = params;
	}

	/**
	 * copy constructor.
	 *
	 * @param info source plugin info
	 */
	public PluginInfo(final PluginInfo info) {
		super();
		this.name = info.name;
		this.className = info.className;
		this.params = info.params;
		this.enabled = info.enabled;
		this.internal = info.internal;
	}

	/**
	 * standard constructor.
	 */
	public PluginInfo() {
	}
}


text:
package org.tmt.csw.eventservice.exception;

/**
 * EventService API would throw EventSubscriptionException while subscribing to a topic
 *
 * @author amit_harsola
 *
 */
public class EventUnSubscriptionException extends Exception {

	private static final long serialVersionUID = -9128498484368193411L;

	public EventUnSubscriptionException() {
		super();
	}

	public EventUnSubscriptionException(String message, Throwable cause) {
		super(message, cause);
	}

	public EventUnSubscriptionException(String message) {
		super(message);
	}

	public EventUnSubscriptionException(Throwable cause) {
		super(cause);
	}
}


text:
class CreateSources < ActiveRecord::Migration
  def self.up
    create_table :sources, :options => 'ENGINE=MyISAM, CHARACTER SET=utf8 COLLATE=utf8_general_ci' do |t|
      t.integer :resource_id
      t.string  :resource_type
      t.integer :mms_id
      t.integer :volume_number
      t.integer :start_page
      t.integer :start_line
      t.integer :end_page
      t.integer :end_line
      t.text    :passage
      t.integer :language_id, :null => false
      t.text    :note
      t.references :creator, :null => false  # Creator is a User

      t.timestamps
    end
  end

  def self.down
    drop_table :sources
  end
end


text:
#import "UIView.h"

@interface _SBMaskingContainerView : UIView
{
}

- (id)initWithFrame:(struct CGRect)arg1;

@end


text:
"use strict";
var ckeditor_module_1 = require("./ckeditor.module");
exports.CKEditorModule = ckeditor_module_1.CKEditorModule;
var ckeditor_component_1 = require("./ckeditor.component");
exports.CKEditorComponent = ckeditor_component_1.CKEditorComponent;
var ckbutton_directive_1 = require("./ckbutton.directive");
exports.CKButtonDirective = ckbutton_directive_1.CKButtonDirective;
var ckgroup_directive_1 = require("./ckgroup.directive");
exports.CKGroupDirective = ckgroup_directive_1.CKGroupDirective;
//# sourceMappingURL=index.js.map


text:
package com.lucidworks.hadoop.hive;

import com.lucidworks.hadoop.io.LWDocument;
import com.lucidworks.hadoop.io.LWDocumentProvider;
import com.lucidworks.hadoop.io.LWDocumentWritable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.serde.Constants;
import org.apache.hadoop.hive.serde2.SerDe;
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.SerDeStats;
import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
import org.apache.hadoop.hive.serde2.objectinspector.StructField;
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
import org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapred.JobConf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LWSerDe implements SerDe {

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

  protected StructTypeInfo typeInfo;
  protected ObjectInspector inspector;
  protected List<String> colNames;
  protected List<TypeInfo> colTypes;
  protected List<Object> row;

  @Override
  public void initialize(Configuration conf, Properties tblProperties) throws SerDeException {

    colNames = Arrays.asList(tblProperties.getProperty(Constants.LIST_COLUMNS).split(","));
    colTypes = TypeInfoUtils
        .getTypeInfosFromTypeString(tblProperties.getProperty(Constants.LIST_COLUMN_TYPES));
    typeInfo = (StructTypeInfo) TypeInfoFactory.getStructTypeInfo(colNames, colTypes);
    inspector = TypeInfoUtils.getStandardJavaObjectInspectorFromTypeInfo(typeInfo);
    row = new ArrayList<>();
  }

  @Override
  public Object deserialize(Writable data) throws SerDeException {
    if (!(data instanceof LWDocumentWritable)) {
      return null;
    }

    row.clear();
    LWDocument doc = ((LWDocumentWritable) data).getLWDocument();

    for (String fieldName : typeInfo.getAllStructFieldNames()) {
      if (fieldName.equalsIgnoreCase("id")) {
        String id = doc.getId();
        if (id != null) {
          row.add(doc.getId());
          continue;
        }
      }
      // Just add first element for now
      Object firstField = doc.getFirstFieldValue(fieldName);
      if (firstField != null) {
        row.add(firstField);

      }
    }

    return row;
  }

  @Override
  public ObjectInspector getObjectInspector() throws SerDeException {
    return inspector;
  }

  @Override
  public Class<? extends Writable> getSerializedClass() {
    return LWDocumentWritable.class;
  }

  @Override
  public SerDeStats getSerDeStats() {
    // Nothing for now
    return null;
  }

  @Override
  public Writable serialize(Object data, ObjectInspector objInspector) throws SerDeException {

    // Make sure we have a struct, as Hive "root" fields should be a struct
    if (objInspector.getCategory() != Category.STRUCT) {
      throw new SerDeException("Unable to serialize root type of " + objInspector.getTypeName());
    }

    // Our doc
    LWDocument doc = LWDocumentProvider.createDocument();

    // Fields...
    StructObjectInspector inspector = (StructObjectInspector) objInspector;
    List<? extends StructField> fields = inspector.getAllStructFieldRefs();

    for (int i = 0; i < fields.size(); i++) {
      StructField f = fields.get(i);
      String docFieldName = colNames.get(i);

      if (docFieldName.equalsIgnoreCase("id")) {
        if (f.getFieldObjectInspector().getCategory() == Category.PRIMITIVE) {
          Object id = inspector.getStructFieldData(data, f);
          doc.setId(id.toString()); // We're making a lot of assumption here that this is a string

        } else {
          throw new SerDeException("id field must be a primitive [String] type");
        }

      } else {
	    ObjectInspector foi = f.getFieldObjectInspector();
        Category foiCategory = foi.getCategory();
        if (!foiCategory.equals(Category.PRIMITIVE) && !foiCategory.equals(Category.LIST)) {
		  throw new SerDeException("We don't yet support nested types (found "
            + f.getFieldObjectInspector().getTypeName() + ")");
        }
        Object value = ObjectInspectorUtils.copyToStandardJavaObject(inspector.getStructFieldData(data, f),
        f.getFieldObjectInspector());
        if (foiCategory.equals(Category.PRIMITIVE)) {
          doc.addField(docFieldName, value);
        } else {
          ListObjectInspector loi = (ListObjectInspector) f.getFieldObjectInspector();
          if (loi.getListElementObjectInspector().getCategory() != Category.PRIMITIVE) {
            throw new SerDeException("We don't support arrays of non-primitive types (found "
              + f.getFieldObjectInspector().getTypeName() + ")");
          }
          for (int j = 0; j < loi.getListLength(value); j++) {
            Object itemValue = ObjectInspectorUtils.copyToStandardJavaObject(loi.getListElement(value, j),
              loi.getListElementObjectInspector());
            doc.addField(docFieldName, itemValue);
          }
        }
      }
    }

    return new LWDocumentWritable(doc);
  }
}


text:
/*
 * File that contains the endpoint to get states info.
 */

var Promise = require('bluebird');
var _ = require('lodash');

var db = require('../lib/db');
var ObjectId = db.ObjectId;

// router to create citie routes...
var router = require('express').Router();

/*
 * Get an array of all states
 */
var getAll = function getAll(req, res){
	db.models.States.find({})
		.sort('name')
		.then(function(states){
			return res.json(states);
		});
}
router.get('', getAll);

/*
 * Get an array of states by name
 */
var getByName = function getByName (req, res){
	if(!req.params.name) return req.status(404).send('Not Found');
	db.models.States.find({ name: req.params.name })
		.sort('-date.to')
		.limit(27)
		.then(function(states){
			res.json(states);
		})
};

router.get('/name/:name', getByName);

/*
 * Get a state by id
 */
var getById = function getById (req, res){

	if(!req.params.id) return req.status(404).send('Not Found');
	db.models.States.findById(ObjectId(req.params.id))
		.sort('name')
		.populate('cities')
		.then(function(states){
			res.json(states);
		})
};

router.get('/id/:id', getById);

module.exports = router;


text:
package com.adobe.acs.commons.httpcache.engine.impl.delegate;

import com.adobe.acs.commons.httpcache.config.HttpCacheConfig;
import com.adobe.acs.commons.httpcache.config.impl.HttpCacheConfigComparator;
import com.adobe.acs.commons.httpcache.engine.impl.HttpCacheEngineImpl;
import com.adobe.acs.commons.httpcache.rule.HttpCacheHandlingRule;
import com.adobe.acs.commons.httpcache.store.HttpCacheStore;
import org.apache.commons.lang.StringUtils;
import org.apache.sling.commons.osgi.PropertiesUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * HttpCacheEngineBindingsDelegate
 * <p>
 * Handles the bulk of the bindings logic for the HttpCacheEngineImpl
 * </p>
 */
public class HttpCacheEngineBindingsDelegate {

    private static final Logger log = LoggerFactory.getLogger(HttpCacheEngineImpl.class);

    /** Thread safe list to contain the registered HttpCacheConfig references. */
    private CopyOnWriteArrayList<HttpCacheConfig> cacheConfigs = new CopyOnWriteArrayList<>();

    /** Thread safe hash map to contain the registered cache store references. */
    private final ConcurrentHashMap<String, HttpCacheStore> cacheStoresMap = new ConcurrentHashMap<>();

    /** Thread safe map to contain the registered HttpCacheHandlingRule references. */
    private final ConcurrentHashMap<String, HttpCacheHandlingRule> cacheHandlingRules = new
            ConcurrentHashMap<>();

    /** Thread safe list containing the OSGi configurations for the registered httpCacheConfigs. Used only for mbean.*/
    private final ConcurrentHashMap<HttpCacheConfig, Map<String, Object>> cacheConfigConfigs = new
            ConcurrentHashMap<>();

    /**
     * Binds cache config. Cache config could come and go at run time.
     *
     * @param cacheConfig
     * @param configs
     */
    public void bindHttpCacheConfig(final HttpCacheConfig cacheConfig, final Map<String, Object> configs) {

        // Validate cache config object
        if (!cacheConfig.isValid()) {
            log.info("Http cache config rejected as the request uri is absent.");
            return;
        }

        // Check if the same object is already there in the map.
        if (cacheConfigs.contains(cacheConfig)) {
            log.trace("Http cache config object already exists in the cacheConfigs map and hence ignored.");
            return;
        }

        // Sort cacheConfigs by order
        final CopyOnWriteArrayList<HttpCacheConfig> tmp = new CopyOnWriteArrayList<HttpCacheConfig>(this.cacheConfigs);
        tmp.add(cacheConfig);

        Collections.sort(tmp, new HttpCacheConfigComparator());
        this.cacheConfigs = tmp;

        this.cacheConfigConfigs.put(cacheConfig, configs);

        log.debug("Total number of cache configs added: {}", cacheConfigs.size());
    }

    /**
     * Unbinds cache config.
     *
     * @param cacheConfig
     */
    public void unbindHttpCacheConfig(final HttpCacheConfig cacheConfig) {

        if (cacheConfigs.contains(cacheConfig)) {
            // Remove the associated cached items from the cache store.
            if (cacheStoresMap.containsKey(cacheConfig.getCacheStoreName())) {
                cacheStoresMap.get(cacheConfig.getCacheStoreName()).invalidate(cacheConfig);
            } else {
                log.debug("Configured cache store is unavailable and hence nothing to invalidate.");
            }

            // Remove the entry from the map.
            cacheConfigs.remove(cacheConfig);
            cacheConfigConfigs.remove(cacheConfig);

            log.debug("Total number of cache configs after removal: {}", cacheConfigs.size());
            return;
        }
        log.debug("This cache config entry was not bound and hence nothing to unbind.");
    }

    /**
     * Binds cache store implementation
     *
     * @param cacheStore
     */
    public void bindHttpCacheStore(final HttpCacheStore cacheStore) {
        final String cacheStoreType = cacheStore.getStoreType();
        if (cacheStoreType != null && cacheStoresMap.putIfAbsent(cacheStoreType, cacheStore) == null) {
            log.debug("HTTP Cache Store [ {} -> ADDED ] for a total of [ {} ]", cacheStore.getStoreType(), cacheStoresMap.size());
        }
    }

    /**
     * Unbinds cache store.
     *
     * @param cacheStore
     */
    public void unbindHttpCacheStore(final HttpCacheStore cacheStore) {
        final String cacheStoreType = cacheStore.getStoreType();
        if (cacheStoreType != null && cacheStoresMap.remove(cacheStoreType) != null) {
            log.debug("HTTP Cache Store [ {} -> REMOVED ] for a total of [ {} ]", cacheStore.getStoreType(), cacheStoresMap.size());
        }
    }

    /**
     * Binds cache handling rule
     *
     * @param cacheHandlingRule
     * @param properties
     */
    public void bindHttpCacheHandlingRule(final HttpCacheHandlingRule cacheHandlingRule, final Map<String, Object>
            properties) {

        // Get the service pid and make it as key.
        if (cacheHandlingRules.putIfAbsent(getServicePid(properties), cacheHandlingRule) == null) {
            log.debug("Cache handling rule implementation {} has been added", cacheHandlingRule.getClass().getName());
            log.debug("Total number of cache handling rule available after addition: {}", cacheHandlingRules.size());
        }
    }

    /**
     * Unbinds handling rule.
     *
     * @param cacheHandlingRule
     * @param configs
     */
    public void unbindHttpCacheHandlingRule(final HttpCacheHandlingRule cacheHandlingRule, final Map<String,
            Object> configs) {

        if (cacheHandlingRules.remove(getServicePid(configs) ) != null) {
            log.debug("Cache handling rule removed - {}.", cacheHandlingRule.getClass().getName());
            log.debug("Total number of cache handling rules available after removal: {}", cacheHandlingRules.size());
        }
    }

    public List<HttpCacheConfig> getCacheConfigs() {
        return Collections.unmodifiableList(cacheConfigs);
    }

    public Map<String, HttpCacheStore> getCacheStoresMap() {
        return cacheStoresMap;
    }

    public Map<String, HttpCacheHandlingRule> getCacheHandlingRules() {
        return cacheHandlingRules;
    }

    public Map<HttpCacheConfig, Map<String, Object>> getCacheConfigConfigs() {
        return cacheConfigConfigs;
    }

    private String getServicePid(Map<String, Object> configs) {
        String servicePid = PropertiesUtil.toString(configs.get("service.pid"), StringUtils.EMPTY);

        if(StringUtils.isBlank(servicePid)){
            servicePid =PropertiesUtil.toString(configs.get("component.name"), StringUtils.EMPTY);
        }
        return servicePid;
    }

}


text:
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//These APIs provide services for manipulating Harbor project.

package api

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"net/http/httptest"
	"path/filepath"
	"runtime"

	"github.com/vmware/harbor/src/common/dao"
	"github.com/vmware/harbor/src/common/models"
	"github.com/vmware/harbor/src/common/utils"
	"github.com/vmware/harbor/src/ui/config"
	"github.com/vmware/harbor/src/ui/filter"
	"github.com/vmware/harbor/tests/apitests/apilib"
	//	"strconv"
	//	"strings"

	"github.com/astaxie/beego"
	"github.com/dghubble/sling"

	//for test env prepare
	_ "github.com/vmware/harbor/src/ui/auth/db"
	_ "github.com/vmware/harbor/src/ui/auth/ldap"
)

const (
	jsonAcceptHeader = "application/json"
	testAcceptHeader = "text/plain"
	adminName        = "admin"
	adminPwd         = "Harbor12345"
)

var admin, unknownUsr, testUser *usrInfo

type testapi struct {
	basePath string
}

func newHarborAPI() *testapi {
	return &testapi{
		basePath: "",
	}
}

func newHarborAPIWithBasePath(basePath string) *testapi {
	return &testapi{
		basePath: basePath,
	}
}

type usrInfo struct {
	Name   string
	Passwd string
}

func init() {
	if err := config.Init(); err != nil {
		log.Fatalf("failed to initialize configurations: %v", err)
	}
	database, err := config.Database()
	if err != nil {
		log.Fatalf("failed to get database configurations: %v", err)
	}
	dao.InitDatabase(database)
	_, file, _, _ := runtime.Caller(1)
	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
	beego.BConfig.WebConfig.Session.SessionOn = true
	beego.TestBeegoInit(apppath)

	filter.Init()
	beego.InsertFilter("/*", beego.BeforeRouter, filter.SecurityFilter)

	beego.Router("/api/search/", &SearchAPI{})
	beego.Router("/api/projects/", &ProjectAPI{}, "get:List;post:Post;head:Head")
	beego.Router("/api/projects/:id", &ProjectAPI{}, "delete:Delete;get:Get")
	beego.Router("/api/users/:id", &UserAPI{}, "get:Get")
	beego.Router("/api/users", &UserAPI{}, "get:List;post:Post;delete:Delete;put:Put")
	beego.Router("/api/users/:id([0-9]+)/password", &UserAPI{}, "put:ChangePassword")
	beego.Router("/api/users/:id/sysadmin", &UserAPI{}, "put:ToggleUserAdminRole")
	beego.Router("/api/projects/:id/publicity", &ProjectAPI{}, "put:ToggleProjectPublic")
	beego.Router("/api/projects/:id([0-9]+)/logs", &ProjectAPI{}, "get:Logs")
	beego.Router("/api/projects/:pid([0-9]+)/members/?:mid", &ProjectMemberAPI{}, "get:Get;post:Post;delete:Delete;put:Put")
	beego.Router("/api/repositories", &RepositoryAPI{})
	beego.Router("/api/statistics", &StatisticAPI{})
	beego.Router("/api/users/?:id", &UserAPI{})
	beego.Router("/api/logs", &LogAPI{})
	beego.Router("/api/repositories/*/tags/:tag", &RepositoryAPI{}, "delete:Delete;get:GetTag")
	beego.Router("/api/repositories/*/tags", &RepositoryAPI{}, "get:GetTags")
	beego.Router("/api/repositories/*/tags/:tag/manifest", &RepositoryAPI{}, "get:GetManifests")
	beego.Router("/api/repositories/*/signatures", &RepositoryAPI{}, "get:GetSignatures")
	beego.Router("/api/repositories/top", &RepositoryAPI{}, "get:GetTopRepos")
	beego.Router("/api/targets/", &TargetAPI{}, "get:List")
	beego.Router("/api/targets/", &TargetAPI{}, "post:Post")
	beego.Router("/api/targets/:id([0-9]+)", &TargetAPI{})
	beego.Router("/api/targets/:id([0-9]+)/policies/", &TargetAPI{}, "get:ListPolicies")
	beego.Router("/api/targets/ping", &TargetAPI{}, "post:Ping")
	beego.Router("/api/targets/:id([0-9]+)/ping", &TargetAPI{}, "post:PingByID")
	beego.Router("/api/policies/replication/:id([0-9]+)", &RepPolicyAPI{})
	beego.Router("/api/policies/replication", &RepPolicyAPI{}, "get:List")
	beego.Router("/api/policies/replication", &RepPolicyAPI{}, "post:Post;delete:Delete")
	beego.Router("/api/policies/replication/:id([0-9]+)/enablement", &RepPolicyAPI{}, "put:UpdateEnablement")
	beego.Router("/api/systeminfo", &SystemInfoAPI{}, "get:GetGeneralInfo")
	beego.Router("/api/systeminfo/volumes", &SystemInfoAPI{}, "get:GetVolumeInfo")
	beego.Router("/api/systeminfo/getcert", &SystemInfoAPI{}, "get:GetCert")
	beego.Router("/api/ldap/ping", &LdapAPI{}, "post:Ping")
	beego.Router("/api/configurations", &ConfigAPI{})
	beego.Router("/api/configurations/reset", &ConfigAPI{}, "post:Reset")
	beego.Router("/api/email/ping", &EmailAPI{}, "post:Ping")

	_ = updateInitPassword(1, "Harbor12345")

	//syncRegistry
	if err := SyncRegistry(config.GlobalProjectMgr); err != nil {
		log.Fatalf("failed to sync repositories from registry: %v", err)
	}

	//Init user Info
	admin = &usrInfo{adminName, adminPwd}
	unknownUsr = &usrInfo{"unknown", "unknown"}
	testUser = &usrInfo{TestUserName, TestUserPwd}

}

func request(_sling *sling.Sling, acceptHeader string, authInfo ...usrInfo) (int, []byte, error) {
	_sling = _sling.Set("Accept", acceptHeader)
	req, err := _sling.Request()
	if err != nil {
		return 400, nil, err
	}
	if len(authInfo) > 0 {
		req.SetBasicAuth(authInfo[0].Name, authInfo[0].Passwd)
	}
	w := httptest.NewRecorder()
	beego.BeeApp.Handlers.ServeHTTP(w, req)
	body, err := ioutil.ReadAll(w.Body)
	return w.Code, body, err
}

//Search for projects and repositories
//Implementation Notes
//The Search endpoint returns information about the projects and repositories
//offered at public status or related to the current logged in user.
//The response includes the project and repository list in a proper display order.
//@param q Search parameter for project and repository name.
//@return []Search
func (a testapi) SearchGet(q string, authInfo ...usrInfo) (int, apilib.Search, error) {
	var httpCode int
	var body []byte
	var err error

	_sling := sling.New().Get(a.basePath)

	// create path and map variables
	path := "/api/search"
	_sling = _sling.Path(path)

	type QueryParams struct {
		Query string `url:"q,omitempty"`
	}

	_sling = _sling.QueryStruct(&QueryParams{Query: q})

	if len(authInfo) > 0 {
		httpCode, body, err = request(_sling, jsonAcceptHeader, authInfo[0])
	} else {
		httpCode, body, err = request(_sling, jsonAcceptHeader)
	}

	var successPayload = new(apilib.Search)
	err = json.Unmarshal(body, &successPayload)
	return httpCode, *successPayload, err
}

//Create a new project.
//Implementation Notes
//This endpoint is for user to create a new project.
//@param project New created project.
//@return void
//func (a testapi) ProjectsPost (prjUsr usrInfo, project apilib.Project) (int, error) {
func (a testapi) ProjectsPost(prjUsr usrInfo, project apilib.ProjectReq) (int, error) {

	_sling := sling.New().Post(a.basePath)

	// create path and map variables
	path := "/api/projects/"

	_sling = _sling.Path(path)

	// body params
	_sling = _sling.BodyJSON(project)
	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, prjUsr)
	return httpStatusCode, err
}

func (a testapi) StatisticGet(user usrInfo) (int, apilib.StatisticMap, error) {
	_sling := sling.New().Get(a.basePath)

	// create path and map variables
	path := "/api/statistics/"

	_sling = _sling.Path(path)
	var successPayload apilib.StatisticMap
	httpStatusCode, body, err := request(_sling, jsonAcceptHeader, user)

	if err == nil && httpStatusCode == 200 {
		err = json.Unmarshal(body, &successPayload)
	}
	return httpStatusCode, successPayload, err
}

func (a testapi) LogGet(user usrInfo) (int, []apilib.AccessLog, error) {
	_sling := sling.New().Get(a.basePath)

	// create path and map variables
	path := "/api/logs/"
	fmt.Printf("logs path: %s\n", path)
	_sling = _sling.Path(path)

	var successPayload []apilib.AccessLog
	code, body, err := request(_sling, jsonAcceptHeader, user)
	if 200 == code && nil == err {
		err = json.Unmarshal(body, &successPayload)
	}
	return code, successPayload, err
}

////Delete a repository or a tag in a repository.
////Delete a repository or a tag in a repository.
////This endpoint let user delete repositories and tags with repo name and tag.\n
////@param repoName The name of repository which will be deleted.
////@param tag Tag of a repository.
////@return void
////func (a testapi) RepositoriesDelete(prjUsr UsrInfo, repoName string, tag string) (int, error) {
//func (a testapi) RepositoriesDelete(prjUsr UsrInfo, repoName string, tag string) (int, error) {
//	_sling := sling.New().Delete(a.basePath)

//	// create path and map variables
//	path := "/api/repositories"

//	_sling = _sling.Path(path)

//	type QueryParams struct {
//		RepoName string `url:"repo_name,omitempty"`
//		Tag      string `url:"tag,omitempty"`
//	}

//	_sling = _sling.QueryStruct(&QueryParams{RepoName: repoName, Tag: tag})
//	// accept header
//	accepts := []string{"application/json", "text/plain"}
//	for key := range accepts {
//		_sling = _sling.Set("Accept", accepts[key])
//		break // only use the first Accept
//	}

//	req, err := _sling.Request()
//	req.SetBasicAuth(prjUsr.Name, prjUsr.Passwd)
//	//fmt.Printf("request %+v", req)

//	client := &http.Client{}
//	httpResponse, err := client.Do(req)
//	defer httpResponse.Body.Close()

//	if err != nil {
//		// handle error
//	}
//	return httpResponse.StatusCode, err
//}

//Delete project by projectID
func (a testapi) ProjectsDelete(prjUsr usrInfo, projectID string) (int, error) {
	_sling := sling.New().Delete(a.basePath)

	//create api path
	path := "api/projects/" + projectID
	_sling = _sling.Path(path)
	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, prjUsr)
	return httpStatusCode, err
}

//Check if the project name user provided already exists
func (a testapi) ProjectsHead(prjUsr usrInfo, projectName string) (int, error) {
	_sling := sling.New().Head(a.basePath)

	//create api path
	path := "api/projects"
	_sling = _sling.Path(path)
	type QueryParams struct {
		ProjectName string `url:"project_name,omitempty"`
	}
	_sling = _sling.QueryStruct(&QueryParams{ProjectName: projectName})

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, prjUsr)
	return httpStatusCode, err
}

//Return specific project detail infomation
func (a testapi) ProjectsGetByPID(projectID string) (int, apilib.Project, error) {
	_sling := sling.New().Get(a.basePath)

	//create api path
	path := "api/projects/" + projectID
	_sling = _sling.Path(path)

	var successPayload apilib.Project

	httpStatusCode, body, err := request(_sling, jsonAcceptHeader)
	if err == nil && httpStatusCode == 200 {
		err = json.Unmarshal(body, &successPayload)
	}
	return httpStatusCode, successPayload, err
}

//Search projects by projectName and isPublic
func (a testapi) ProjectsGet(query *apilib.ProjectQuery, authInfo ...usrInfo) (int, []apilib.Project, error) {
	_sling := sling.New().Get(a.basePath).
		Path("api/projects").
		QueryStruct(query)

	var successPayload []apilib.Project

	var httpStatusCode int
	var err error
	var body []byte
	if len(authInfo) > 0 {
		httpStatusCode, body, err = request(_sling, jsonAcceptHeader, authInfo[0])
	} else {
		httpStatusCode, body, err = request(_sling, jsonAcceptHeader)
	}

	if err == nil && httpStatusCode == 200 {
		err = json.Unmarshal(body, &successPayload)
	} else {
		log.Println(string(body))
	}

	return httpStatusCode, successPayload, err
}

//Update properties for a selected project.
func (a testapi) ToggleProjectPublicity(prjUsr usrInfo, projectID string, ispublic int32) (int, error) {
	// create path and map variables
	path := "/api/projects/" + projectID + "/publicity/"
	_sling := sling.New().Put(a.basePath)

	_sling = _sling.Path(path)

	type QueryParams struct {
		Public int32 `json:"public,omitempty"`
	}

	_sling = _sling.BodyJSON(&QueryParams{Public: ispublic})

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, prjUsr)
	return httpStatusCode, err

}

//Get access logs accompany with a relevant project.
func (a testapi) ProjectLogs(prjUsr usrInfo, projectID string, query *apilib.LogQuery) (int, []byte, error) {
	_sling := sling.New().Get(a.basePath).
		Path("/api/projects/" + projectID + "/logs").
		QueryStruct(query)

	return request(_sling, jsonAcceptHeader, prjUsr)
}

//-------------------------Member Test---------------------------------------//

//Return relevant role members of projectID
func (a testapi) GetProjectMembersByProID(prjUsr usrInfo, projectID string) (int, []apilib.User, error) {
	_sling := sling.New().Get(a.basePath)

	path := "/api/projects/" + projectID + "/members/"

	_sling = _sling.Path(path)

	var successPayload []apilib.User

	httpStatusCode, body, err := request(_sling, jsonAcceptHeader, prjUsr)
	if err == nil && httpStatusCode == 200 {
		err = json.Unmarshal(body, &successPayload)
	}
	return httpStatusCode, successPayload, err
}

//Add project role member accompany with  projectID
func (a testapi) AddProjectMember(prjUsr usrInfo, projectID string, roles apilib.RoleParam) (int, error) {
	_sling := sling.New().Post(a.basePath)

	path := "/api/projects/" + projectID + "/members/"
	_sling = _sling.Path(path)
	_sling = _sling.BodyJSON(roles)
	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, prjUsr)
	return httpStatusCode, err

}

//Delete project role member accompany with  projectID
func (a testapi) DeleteProjectMember(authInfo usrInfo, projectID string, userID string) (int, error) {
	_sling := sling.New().Delete(a.basePath)

	path := "/api/projects/" + projectID + "/members/" + userID
	_sling = _sling.Path(path)
	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err

}

//Get role memberInfo by projectId and UserId
func (a testapi) GetMemByPIDUID(authInfo usrInfo, projectID string, userID string) (int, error) {
	_sling := sling.New().Get(a.basePath)

	path := "/api/projects/" + projectID + "/members/" + userID

	_sling = _sling.Path(path)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//Put:update current project role members accompany with relevant project and user
func (a testapi) PutProjectMember(authInfo usrInfo, projectID string, userID string, roles apilib.RoleParam) (int, error) {
	_sling := sling.New().Put(a.basePath)
	path := "/api/projects/" + projectID + "/members/" + userID

	_sling = _sling.Path(path)
	_sling = _sling.BodyJSON(roles)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//-------------------------Repositories Test---------------------------------------//
//Return relevant repos of projectID
func (a testapi) GetRepos(authInfo usrInfo, projectID, keyword string) (
	int, interface{}, error) {
	_sling := sling.New().Get(a.basePath)

	path := "/api/repositories/"

	_sling = _sling.Path(path)

	type QueryParams struct {
		ProjectID string `url:"project_id"`
		Keyword   string `url:"q"`
	}

	_sling = _sling.QueryStruct(&QueryParams{
		ProjectID: projectID,
		Keyword:   keyword,
	})
	code, body, err := request(_sling, jsonAcceptHeader, authInfo)
	if err != nil {
		return 0, nil, err
	}

	if code == http.StatusOK {
		repositories := []repoResp{}
		if err = json.Unmarshal(body, &repositories); err != nil {
			return 0, nil, err
		}
		return code, repositories, nil
	}

	return code, nil, nil
}

func (a testapi) GetTag(authInfo usrInfo, repository string, tag string) (int, *tagResp, error) {
	_sling := sling.New().Get(a.basePath).Path(fmt.Sprintf("/api/repositories/%s/tags/%s", repository, tag))
	code, data, err := request(_sling, jsonAcceptHeader, authInfo)
	if err != nil {
		return 0, nil, err
	}

	if code != http.StatusOK {
		log.Printf("failed to get tag of %s:%s: %d %s \n", repository, tag, code, string(data))
		return code, nil, nil
	}

	result := tagResp{}
	if err := json.Unmarshal(data, &result); err != nil {
		return 0, nil, err
	}
	return http.StatusOK, &result, nil
}

//Get tags of a relevant repository
func (a testapi) GetReposTags(authInfo usrInfo, repoName string) (int, interface{}, error) {
	_sling := sling.New().Get(a.basePath)

	path := fmt.Sprintf("/api/repositories/%s/tags", repoName)

	_sling = _sling.Path(path)

	httpStatusCode, body, err := request(_sling, jsonAcceptHeader, authInfo)
	if err != nil {
		return 0, nil, err
	}

	if httpStatusCode != http.StatusOK {
		return httpStatusCode, body, nil
	}

	result := []tagResp{}
	if err := json.Unmarshal(body, &result); err != nil {
		return 0, nil, err
	}
	return http.StatusOK, result, nil
}

//Get manifests of a relevant repository
func (a testapi) GetReposManifests(authInfo usrInfo, repoName string, tag string) (int, error) {
	_sling := sling.New().Get(a.basePath)

	path := fmt.Sprintf("/api/repositories/%s/tags/%s/manifest", repoName, tag)

	_sling = _sling.Path(path)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//Get public repositories which are accessed most
func (a testapi) GetReposTop(authInfo usrInfo, count string) (int, interface{}, error) {
	_sling := sling.New().Get(a.basePath)

	path := "/api/repositories/top"

	_sling = _sling.Path(path)

	type QueryParams struct {
		Count string `url:"count"`
	}

	_sling = _sling.QueryStruct(&QueryParams{
		Count: count,
	})
	code, body, err := request(_sling, jsonAcceptHeader, authInfo)
	if err != nil {
		return 0, nil, err
	}

	if code != http.StatusOK {
		return code, body, err
	}

	result := []*repoResp{}
	if err = json.Unmarshal(body, &result); err != nil {
		return 0, nil, err
	}
	return http.StatusOK, result, nil
}

//-------------------------Targets Test---------------------------------------//
//Create a new replication target
func (a testapi) AddTargets(authInfo usrInfo, repTarget apilib.RepTargetPost) (int, string, error) {
	_sling := sling.New().Post(a.basePath)

	path := "/api/targets"

	_sling = _sling.Path(path)
	_sling = _sling.BodyJSON(repTarget)

	httpStatusCode, body, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, string(body), err
}

//List filters targets by name
func (a testapi) ListTargets(authInfo usrInfo, targetName string) (int, []apilib.RepTarget, error) {
	_sling := sling.New().Get(a.basePath)

	path := "/api/targets?name=" + targetName

	_sling = _sling.Path(path)

	var successPayload []apilib.RepTarget

	httpStatusCode, body, err := request(_sling, jsonAcceptHeader, authInfo)
	if err == nil && httpStatusCode == 200 {
		err = json.Unmarshal(body, &successPayload)
	}

	return httpStatusCode, successPayload, err
}

//Ping target
func (a testapi) PingTarget(authInfo usrInfo, body interface{}) (int, error) {
	_sling := sling.New().Post(a.basePath)

	path := "/api/targets/ping"

	_sling = _sling.Path(path)
	_sling = _sling.BodyJSON(body)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//PingTargetByID ...
func (a testapi) PingTargetByID(authInfo usrInfo, id int) (int, error) {
	_sling := sling.New().Post(a.basePath)

	path := fmt.Sprintf("/api/targets/%d/ping", id)

	_sling = _sling.Path(path)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//Get target by targetID
func (a testapi) GetTargetByID(authInfo usrInfo, targetID string) (int, error) {
	_sling := sling.New().Get(a.basePath)

	path := "/api/targets/" + targetID

	_sling = _sling.Path(path)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)

	return httpStatusCode, err
}

//Update target by targetID
func (a testapi) PutTargetByID(authInfo usrInfo, targetID string, repTarget apilib.RepTargetPost) (int, error) {
	_sling := sling.New().Put(a.basePath)

	path := "/api/targets/" + targetID

	_sling = _sling.Path(path)
	_sling = _sling.BodyJSON(repTarget)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)

	return httpStatusCode, err
}

//List the target relevant policies by targetID
func (a testapi) GetTargetPoliciesByID(authInfo usrInfo, targetID string) (int, error) {
	_sling := sling.New().Get(a.basePath)

	path := "/api/targets/" + targetID + "/policies/"

	_sling = _sling.Path(path)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)

	return httpStatusCode, err
}

//Delete target by targetID
func (a testapi) DeleteTargetsByID(authInfo usrInfo, targetID string) (int, error) {
	_sling := sling.New().Delete(a.basePath)

	path := "/api/targets/" + targetID

	_sling = _sling.Path(path)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//--------------------Replication_Policy Test--------------------------------//

//Create a new replication policy
func (a testapi) AddPolicy(authInfo usrInfo, repPolicy apilib.RepPolicyPost) (int, error) {
	_sling := sling.New().Post(a.basePath)

	path := "/api/policies/replication/"

	_sling = _sling.Path(path)
	_sling = _sling.BodyJSON(repPolicy)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//List policies by policyName and projectID
func (a testapi) ListPolicies(authInfo usrInfo, policyName string, proID string) (int, []apilib.RepPolicy, error) {
	_sling := sling.New().Get(a.basePath)

	path := "/api/policies/replication/"

	_sling = _sling.Path(path)

	type QueryParams struct {
		PolicyName string `url:"name"`
		ProjectID  string `url:"project_id"`
	}
	_sling = _sling.QueryStruct(&QueryParams{PolicyName: policyName, ProjectID: proID})

	var successPayload []apilib.RepPolicy

	httpStatusCode, body, err := request(_sling, jsonAcceptHeader, authInfo)

	if err == nil && httpStatusCode == 200 {
		err = json.Unmarshal(body, &successPayload)
	}
	return httpStatusCode, successPayload, err
}

//Get replication policy by policyID
func (a testapi) GetPolicyByID(authInfo usrInfo, policyID string) (int, error) {
	_sling := sling.New().Get(a.basePath)

	path := "/api/policies/replication/" + policyID

	_sling = _sling.Path(path)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)

	return httpStatusCode, err
}

//Update policyInfo by policyID
func (a testapi) PutPolicyInfoByID(authInfo usrInfo, policyID string, policyUpdate apilib.RepPolicyUpdate) (int, error) {
	_sling := sling.New().Put(a.basePath)

	path := "/api/policies/replication/" + policyID

	_sling = _sling.Path(path)
	_sling = _sling.BodyJSON(policyUpdate)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//Update policy enablement flag by policyID
func (a testapi) PutPolicyEnableByID(authInfo usrInfo, policyID string, policyEnable apilib.RepPolicyEnablementReq) (int, error) {
	_sling := sling.New().Put(a.basePath)

	path := "/api/policies/replication/" + policyID + "/enablement"

	_sling = _sling.Path(path)
	_sling = _sling.BodyJSON(policyEnable)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//Delete policy by policyID
func (a testapi) DeletePolicyByID(authInfo usrInfo, policyID string) (int, error) {
	_sling := sling.New().Delete(a.basePath)

	path := "/api/policies/replication/" + policyID

	_sling = _sling.Path(path)

	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//Return projects created by Harbor
//func (a HarborApi) ProjectsGet (projectName string, isPublic int32) ([]Project, error) {
//    }

//Check if the project name user provided already exists.
//func (a HarborApi) ProjectsHead (projectName string) (error) {
//}

//Get access logs accompany with a relevant project.
//func (a HarborApi) ProjectsProjectIdLogsFilterPost (projectID int32, accessLog AccessLog) ([]AccessLog, error) {
//}

//Return a project's relevant role members.
//func (a HarborApi) ProjectsProjectIdMembersGet (projectID int32) ([]Role, error) {
//}

//Add project role member accompany with relevant project and user.
//func (a HarborApi) ProjectsProjectIdMembersPost (projectID int32, roles RoleParam) (error) {
//}

//Delete project role members accompany with relevant project and user.
//func (a HarborApi) ProjectsProjectIdMembersUserIdDelete (projectID int32, userId int32) (error) {
//}

//Return role members accompany with relevant project and user.
//func (a HarborApi) ProjectsProjectIdMembersUserIdGet (projectID int32, userId int32) ([]Role, error) {
//}

//Update project role members accompany with relevant project and user.
//func (a HarborApi) ProjectsProjectIdMembersUserIdPut (projectID int32, userId int32, roles RoleParam) (error) {
//}

//Update properties for a selected project.
//func (a HarborApi) ProjectsProjectIdPut (projectID int32, project Project) (error) {
//}

//Get repositories accompany with relevant project and repo name.
//func (a HarborApi) RepositoriesGet (projectID int32, q string) ([]Repository, error) {
//}

//Get manifests of a relevant repository.
//func (a HarborApi) RepositoriesManifestGet (repoName string, tag string) (error) {
//}

//Get tags of a relevant repository.
//func (a HarborApi) RepositoriesTagsGet (repoName string) (error) {
//}

//Get registered users of Harbor.
func (a testapi) UsersGet(userName string, authInfo usrInfo) (int, []apilib.User, error) {
	_sling := sling.New().Get(a.basePath)
	// create path and map variables
	path := "/api/users/"
	_sling = _sling.Path(path)
	// body params
	type QueryParams struct {
		UserName string `url:"username, omitempty"`
	}
	_sling = _sling.QueryStruct(&QueryParams{UserName: userName})
	httpStatusCode, body, err := request(_sling, jsonAcceptHeader, authInfo)
	var successPayLoad []apilib.User
	if 200 == httpStatusCode && nil == err {
		err = json.Unmarshal(body, &successPayLoad)
	}
	return httpStatusCode, successPayLoad, err
}

//Get registered users by userid.
func (a testapi) UsersGetByID(userName string, authInfo usrInfo, userID int) (int, apilib.User, error) {
	_sling := sling.New().Get(a.basePath)
	// create path and map variables
	path := "/api/users/" + fmt.Sprintf("%d", userID)
	_sling = _sling.Path(path)
	// body params
	type QueryParams struct {
		UserName string `url:"username, omitempty"`
	}
	_sling = _sling.QueryStruct(&QueryParams{UserName: userName})
	httpStatusCode, body, err := request(_sling, jsonAcceptHeader, authInfo)
	var successPayLoad apilib.User
	if 200 == httpStatusCode && nil == err {
		err = json.Unmarshal(body, &successPayLoad)
	}
	return httpStatusCode, successPayLoad, err
}

//Creates a new user account.
func (a testapi) UsersPost(user apilib.User, authInfo ...usrInfo) (int, error) {
	_sling := sling.New().Post(a.basePath)

	// create path and map variables
	path := "/api/users/"

	_sling = _sling.Path(path)

	// body params
	_sling = _sling.BodyJSON(user)
	var httpStatusCode int
	var err error
	if len(authInfo) > 0 {
		httpStatusCode, _, err = request(_sling, jsonAcceptHeader, authInfo[0])
	} else {
		httpStatusCode, _, err = request(_sling, jsonAcceptHeader)
	}
	return httpStatusCode, err

}

//Update a registered user to change profile.
func (a testapi) UsersPut(userID int, profile apilib.UserProfile, authInfo usrInfo) (int, error) {
	_sling := sling.New().Put(a.basePath)
	// create path and map variables
	path := "/api/users/" + fmt.Sprintf("%d", userID)
	_sling = _sling.Path(path)

	// body params
	_sling = _sling.BodyJSON(profile)
	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//Update a registered user to be an administrator of Harbor.
func (a testapi) UsersToggleAdminRole(userID int, authInfo usrInfo, hasAdminRole int32) (int, error) {
	_sling := sling.New().Put(a.basePath)
	// create path and map variables
	path := "/api/users/" + fmt.Sprintf("%d", userID) + "/sysadmin"
	_sling = _sling.Path(path)
	type QueryParams struct {
		HasAdminRole int32 `json:"has_admin_role,omitempty"`
	}

	_sling = _sling.BodyJSON(&QueryParams{HasAdminRole: hasAdminRole})
	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//Update password of a registered user.
func (a testapi) UsersUpdatePassword(userID int, password apilib.Password, authInfo usrInfo) (int, error) {
	_sling := sling.New().Put(a.basePath)
	// create path and map variables
	path := "/api/users/" + fmt.Sprintf("%d", userID) + "/password"
	_sling = _sling.Path(path)
	// body params
	_sling = _sling.BodyJSON(password)
	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

//Mark a registered user as be removed.
func (a testapi) UsersDelete(userID int, authInfo usrInfo) (int, error) {
	_sling := sling.New().Delete(a.basePath)
	// create path and map variables
	path := "/api/users/" + fmt.Sprintf("%d", userID)
	_sling = _sling.Path(path)
	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}
func updateInitPassword(userID int, password string) error {
	queryUser := models.User{UserID: userID}
	user, err := dao.GetUser(queryUser)
	if err != nil {
		return fmt.Errorf("Failed to get user, userID: %d %v", userID, err)
	}
	if user == nil {
		return fmt.Errorf("user id: %d does not exist", userID)
	}
	if user.Salt == "" {
		user.Salt = utils.GenerateRandomString()
		user.Password = password
		err = dao.ChangeUserPassword(*user)
		if err != nil {
			return fmt.Errorf("Failed to update user encrypted password, userID: %d, err: %v", userID, err)
		}

	} else {
	}
	return nil
}

//Get system volume info
func (a testapi) VolumeInfoGet(authInfo usrInfo) (int, apilib.SystemInfo, error) {
	_sling := sling.New().Get(a.basePath)
	path := "/api/systeminfo/volumes"
	_sling = _sling.Path(path)
	httpStatusCode, body, err := request(_sling, jsonAcceptHeader, authInfo)
	var successPayLoad apilib.SystemInfo
	if 200 == httpStatusCode && nil == err {
		err = json.Unmarshal(body, &successPayLoad)
	}

	return httpStatusCode, successPayLoad, err
}

func (a testapi) GetGeneralInfo() (int, []byte, error) {
	_sling := sling.New().Get(a.basePath).Path("/api/systeminfo")
	return request(_sling, jsonAcceptHeader)
}

//Get system cert
func (a testapi) CertGet(authInfo usrInfo) (int, []byte, error) {
	_sling := sling.New().Get(a.basePath)
	path := "/api/systeminfo/getcert"
	_sling = _sling.Path(path)
	httpStatusCode, body, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, body, err
}

//Post ldap test
func (a testapi) LdapPost(authInfo usrInfo, ldapConf apilib.LdapConf) (int, error) {

	_sling := sling.New().Post(a.basePath)

	// create path and map variables
	path := "/api/ldap/ping"

	_sling = _sling.Path(path)

	// body params
	_sling = _sling.BodyJSON(ldapConf)
	httpStatusCode, _, err := request(_sling, jsonAcceptHeader, authInfo)
	return httpStatusCode, err
}

func (a testapi) GetConfig(authInfo usrInfo) (int, map[string]*value, error) {
	_sling := sling.New().Base(a.basePath).Get("/api/configurations")

	cfg := map[string]*value{}

	code, body, err := request(_sling, jsonAcceptHeader, authInfo)
	if err == nil && code == 200 {
		err = json.Unmarshal(body, &cfg)
	}
	return code, cfg, err
}

func (a testapi) PutConfig(authInfo usrInfo, cfg map[string]string) (int, error) {
	_sling := sling.New().Base(a.basePath).Put("/api/configurations").BodyJSON(cfg)

	code, _, err := request(_sling, jsonAcceptHeader, authInfo)

	return code, err
}

func (a testapi) ResetConfig(authInfo usrInfo) (int, error) {
	_sling := sling.New().Base(a.basePath).Post("/api/configurations/reset")

	code, _, err := request(_sling, jsonAcceptHeader, authInfo)

	return code, err
}

func (a testapi) PingEmail(authInfo usrInfo, settings []byte) (int, string, error) {
	_sling := sling.New().Base(a.basePath).Post("/api/email/ping").Body(bytes.NewReader(settings))

	code, body, err := request(_sling, jsonAcceptHeader, authInfo)

	return code, string(body), err
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Thamnolia tenuissima Cretz.

### Remarks
null


text:
using Joyride.Platforms;

namespace Tests.Android.Native.SampleApp.ApiDemo.Screens
{
    public class NullApiDemoScreen : ApiDemoScreen
    {
        public override string Name
        {
            get { return "Null"; }
        }

        public override bool IsOnScreen(int timeOutSecs)
        {
            return false;
        }

        public override Screen GoBack()
        {
            Driver.Navigate().Back();
            return this;
        }
    }
}


text:
package ServerTests;

/**
*
* Simple (JUnit) tests that can call all parts of a play app.
* If you are interested in mocking a whole application, see the wiki for more details.
*
*/
public class ApplicationTest {
    @Test
    public void simpleCheck() {
        int a = 1 + 1;
        assertEquals(2, a);
    }
}


text:
import React from 'react'

class Timer extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      minutes: 5,
      seconds: 60
    }
  }

  render() {
    // Return JSX via render()
    const { minutes, seconds } = this.state
    return (

{minutes} : {seconds}

    );
  }
}

export default Timer


text:
/*
    This function will install event handlers for the modal ajax form:
    * 'submit' buttons will ajaxSubmit() the form
*/
function initModalForm(modal)
{
    var spinner = modal.find('.modal-footer .spinner'),
        button = modal.find('button[type=submit]');

    spinner.hide();

    button
        .removeClass('disabled')
        .prop('disabled', false)
        .off('click')
        .one('click', function () {
            spinner.show();

            $(this)
                .addClass('disabled')
                .prop('disabled', true);

            modal.find('form').ajaxSubmit({ // jQuery form plugin
                success: function (data) {
                    modal.find('.modal-body').html(data);
                }
            });
        });
}

/*
    This will initiate focus for the form
*/
function setFormFocus(form) {
    if (!form.is(':visible'))
        return;

    var parents = form.find('.has-error');
    if (parents.length == 0)
        parents = form;

    parents.find('.form-control, input')
          .each(function (index, element) {
                var el = $(element);
                if (el.is(':visible') && !el.prop('disabled') && !el.prop('readonly')) {
                    el.focus();
                    return false;
                }
          });
}

/*
    Validate a form field (server-side).

    We expect the form to be created like this:
    <form action="the/action/here">

                The label

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

    </form>

    The following will validate the field and display errors in the help-block div:
    validateFormField($('#my-input'));

    Validation request is sent as POST to form 'action' address with the following data:
    {
        query: 'validate',
        field: 'my-input',
        form: {
            'security': 'scrf value',
            'my-input': 'the value',
            'id': '123',
            // ... rest of the form controls
        }
    }
    'field' field is the name of the control to be validated, 'form' field is all the form controls.

    When the field is valid the server should respond with json data:
    {
        valid: true,
        messages: []
    }

    And when the field is invalid:
    {
        valid: false,
        messages: [
            'error message 1,
            'error message 2
        ]
    }
*/
function validateFormField(element) {
    var form = element.closest('form');
    var name = element.attr('name');
    var value = element.val();
    var timestamp = new Date().getTime();

    var hidden = {};
    form.find('[type=hidden]')
        .each(function (index, el) {
            el = $(el);
            hidden[el.attr('name')] = el.val();
        });

    var data = {};
    $.each(form.serializeArray(), function (index, item) {
        data[item['name']] = item['value'];
    });

    $.ajax({
        url: form.attr('action'),
        method: 'POST',
        data: {
            query: 'validate',
            field: name,
            form: data
        },
        success: function (data) {
            var validation = form.data('validation-' + name);
            if (typeof validation == 'undefined') {
                validation = {
                    valid: true,
                    timestamp: 0,
                    messages: []
                };
            }

            // Handle out-of-order replies
            if (timestamp < validation['timestamp'])
                return;

            validation = {
                valid: data.valid,
                timestamp: timestamp,
                messages: data.messages
            };
            form.data('validation-' + name, validation);

            var group = element.closest('.form-group');
            var helpBlock = group.find('div.help-block');

            if (validation['valid']) {
                group.removeClass('has-error');
                helpBlock.empty();
            } else {
                group.addClass('has-error');

                var newBlock = $('

');
                var ul = $('

');
                $.each(validation['messages'], function (index, item) {
                    $('

')
                        .text(item)
                        .appendTo(ul);
                });
                newBlock.append(ul);
                helpBlock.replaceWith(newBlock);
            }
        },
    });
}


text:
using System;
using dk.nita.saml20.Schema.Core;
using dk.nita.saml20.Schema.Protocol;
using dk.nita.saml20.Utils;

namespace dk.nita.saml20.Validation
{
    internal class Saml20AttributeValidator : ISaml20AttributeValidator
    {
        private Saml20XmlAnyAttributeValidator _anyAttrValidator;
        public Saml20XmlAnyAttributeValidator AnyAttrValidator
        {
            get
            {
                if (_anyAttrValidator != null)
                    return _anyAttrValidator;

                _anyAttrValidator = new Saml20XmlAnyAttributeValidator();
                return _anyAttrValidator;
            }
        }

        private Saml20EncryptedElementValidator _encElemValidator = new Saml20EncryptedElementValidator();
        public Saml20EncryptedElementValidator EncElemValidator
        {
            get
            {
                if (_encElemValidator != null)
                    return _encElemValidator;

                _encElemValidator = new Saml20EncryptedElementValidator();
                return _encElemValidator;
            }
        }

        /// <summary>
        /// [SAML2.0std] section 2.7.3.1
        /// </summary>
        public void ValidateAttribute(SamlAttribute samlAttribute)
        {
            if (samlAttribute == null) throw new ArgumentNullException("samlAttribute");

            if (!Saml20Utils.ValidateRequiredString(samlAttribute.Name))
                throw new Saml20FormatException("Name attribute of Attribute element MUST contain at least one non-whitespace character");

            if (samlAttribute.AttributeValue != null)
            {
                foreach (object o in samlAttribute.AttributeValue)
                {
                    if (o == null)
                        throw new Saml20FormatException("null-AttributeValue elements are not supported");
                }
            }

            if (samlAttribute.AnyAttr != null)
                AnyAttrValidator.ValidateXmlAnyAttributes(samlAttribute.AnyAttr);
        }

        /// <summary>
        /// [SAML2.0std] section 2.7.3.2
        /// </summary>
        public void ValidateEncryptedAttribute(EncryptedElement encryptedElement)
        {
            EncElemValidator.ValidateEncryptedElement(encryptedElement, "EncryptedAttribute");
        }
    }
}


text:
<!DOCTYPE html>

    <link rel="stylesheet" href="../css/missing.css" type="text/css">
    <link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css">

    <title>Computer Science Individual Project Experiment</title>

Please click on the image that was in the original set of images


text:
"""Test attach runs."""

import multiprocessing as mp

import wandb
import yea

def process_child(attach_id):
    run_child = wandb.attach(attach_id=attach_id)
    run_child.config.c2 = 22
    run_child.log({"s1": 21})
    run_child.log({"s2": 22})
    run_child.log({"s3": 23})
    print("child output")

def main():
    wandb.require("service")

    run = wandb.init()
    print("parent output")
    run.config.c1 = 11
    run.log(dict(s2=12, s4=14))

    # Start a new run in parallel in a child process
    attach_id = run.id
    p = mp.Process(target=process_child, kwargs=dict(attach_id=attach_id))
    p.start()
    p.join()

    # run can still be logged to after join (and eventually anytime?)
    run.log(dict(s3=13))
    print("more output from parent")

if __name__ == "__main__":
    yea.setup()  # Use ":yea:start_method:" to set mp.set_start_method()
    main()


text:
@implementation SCPurpleTextColorLabel

- (void)commonCoderAndFrameInitializer {
    [super commonCoderAndFrameInitializer];

    self.textColor = [UIColor SC_purple];
}

@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">

	<kbase name="dinnerPartyScoreRulesKBase" packages="org.optaplanner.examples.dinnerparty.solver" default="true">
		<ksession name="dinnerPartyScoreRulesKSession" default="true" />
	</kbase>

</kmodule>


text:
/*-----------------------------------------------------------------------------

- Revolution Slider 5.0 Navigatin Skin Style  -

 PERSEPHONE SKIN

author:  ThemePunch
email:      info@themepunch.com
website:    http://www.themepunch.com
-----------------------------------------------------------------------------*/
/* ARROWS */
.persephone.tparrows {
	cursor:pointer;
	background:#aaa;
	background:rgba(200,200,200,0.5);
	width:40px;
	height:40px;
	position:absolute;
	display:block;
	z-index:100;
  border:1px solid #f5f5f5;
}
.persephone.tparrows:hover {
	background:#333;
}
.persephone.tparrows:before {
	font-family: "revicons";
	font-size:15px;
	color:#fff;
	display:block;
	line-height: 40px;
	text-align: center;
}
.persephone.tparrows.tp-leftarrow:before {
	content: "\e824";
}
.persephone.tparrows.tp-rightarrow:before {
	content: "\e825";
}

/* BULLETS */
.persephone.tp-bullets {
}
.persephone.tp-bullets:before {
	content:" ";
	position:absolute;
	width:100%;
	height:100%;
	background:#transparent;
	padding:10px;
	margin-left:-10px;margin-top:-10px;
	box-sizing:content-box;
}
.persephone .tp-bullet {
	width:12px;
	height:12px;
	position:absolute;
	background:#aaa;
	border:1px solid #e5e5e5;
	cursor: pointer;
	box-sizing:content-box;
}
.persephone .tp-bullet:hover,
.persephone .tp-bullet.selected {
	background:#222;
}
.persephone .tp-bullet-image {
}
.persephone .tp-bullet-title {
}


text:
<?php

/**
 * Skeleton subclass for performing query and update operations on the 'courses_aliases' table.
 *
 *
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package    propel.generator.ip7website
 */
class CourseAliasPeer extends BaseCourseAliasPeer
{
}


text:
const fs = require('fs-extra')
const { SEARCH_FILE } = require('./config')

const json = [
  ['API Reference', [
    ['api-reference/neft', '@neft/core', [
      ['Properties', [
        ['#width', 'width'],
        ['#height', 'height'],
      ]],
    ]],
  ]],
]

// const pages = {}

// ref = marked.headings
// for (i = 0, len = ref.length; i < len; i++) {
//   heading = ref[i]
//   pageId = pages[heading.page]
//   if (pageId === void 0) {
//     jsonPages.push(heading.page)
//     pageId = jsonPages.length - 1
//     pages[heading.page] = pageId
//   }
//   text = [pageId, heading.level, heading.text]
//   jsonTexts.push(text)
// }

module.exports = async () => {
  const file = `var searchTexts = ${JSON.stringify(json)}`
  await fs.outputFile(SEARCH_FILE, file)
}


text:
<?php

namespace Wunderlist\Service;

use Wunderlist\Entity\Note;

class NoteService extends AbstractService
{
    protected $baseUrl = 'notes';
    protected $type = Note::class;
}


text:
var appBase = require("../app_base/app");

var config = {
	serverName: 'Cloud3'
};

appBase.init(config);


text:
package net.kuujo.vertigo.cluster.data;

import org.vertx.java.core.AsyncResult;
import org.vertx.java.core.Handler;

/**
 * Asynchronous cluster-wide counter.
 *
 * @author Jordan Halterman
 */
public interface AsyncCounter {

  /**
   * Returns the counter name.
   *
   * @return The counter name.
   */
  String name();

  /**
   * Gets the current counter value.
   *
   * @param doneHandler The current counter value.
   */
  void get(Handler<AsyncResult<Long>> doneHandler);

  /**
   * Increments the counter value.
   */
  void increment();

  /**
   * Increments the counter value.
   *
   * @param doneHandler An asynchronous handler to be called once complete.
   */
  void increment(Handler<AsyncResult<Void>> doneHandler);

  /**
   * Increments the counter and gets the new value.
   *
   * @param doneHandler An asynchronous handler to be called with the result.
   */
  void incrementAndGet(Handler<AsyncResult<Long>> doneHandler);

  /**
   * Decrements the counter value.
   */
  void decrement();

  /**
   * Decrements the counter value.
   *
   * @param doneHandler An asynchronous handler to be called once complete.
   */
  void decrement(Handler<AsyncResult<Void>> doneHandler);

  /**
   * Decrements the counter and gets the new value.
   *
   * @param doneHandler An asynchronous handler to be called with the result.
   */
  void decrementAndGet(Handler<AsyncResult<Long>> doneHandler);

}


text:
import cx from 'classnames';
import { isEmpty } from 'lodash';
import { useState } from 'react';
import Youtube from 'react-youtube';
import { Image } from 'app/components/Image';
import LoadingIndicator from 'app/components/LoadingIndicator';
import getParamsFromUrl from 'app/utils/getParamsFromUrl';
import Flex from '../Layout/Flex';
import styles from './Content.css';
import type { ReactNode } from 'react';

type Props = {
  banner?: string;
  bannerPlaceholder?: string;
  youtubeUrl?: string;
  className?: string;
  children: ReactNode;
};

/**
 * A white container which should be used for most pages.
 * Usuaully used with the other components in this folder:
 *
 * ```
 * <Content>
 *   <ContentHeader>Title</ContentHeader>
 *   <ContentSection>
 *     <ContentMain>
 *     </ContentMain>
 *     <ContentSidebar>
 *     </ContentSidebar>
 *   </ContentSection>
 * </Content>
 * ```
 */
function Content({
  banner,
  bannerPlaceholder,
  youtubeUrl,
  children,
  className,
}: Props) {
  const [isClicked, click] = useState(false);
  const [isLoading, setIsLoading] = useState(true);
  const youtubeParams = youtubeUrl && getParamsFromUrl(youtubeUrl);
  return (
    <Flex column alignItems="center">
      {!isEmpty(youtubeParams) ? (

          <LoadingIndicator
            loading={isLoading}
            className={isLoading ? {} : styles.hidden}
          />
          <Flex
            justifyContent="center"
            style={{
              maxHeight: isLoading ? '0' : isClicked ? '619px' : '358px',
            }}
            className={cx(styles.youtubeFrame, isLoading ? styles.hidden : {})}
          >
            <Youtube
              videoId={youtubeParams.v}
              opts={{
                playerVars: {
                  start: youtubeParams.t,
                },
              }}
              onStateChange={() => click(true)}
              onReady={() => setIsLoading(false)}
            />
          </Flex>

      ) : (
        banner && (

            <Image
              src={banner}
              placeholder={bannerPlaceholder}
              width={1667}
              height={500}
            />

        )
      )}

        {children}

    </Flex>
  );
}

export default Content;