package openperipheral.integration.thermalexpansion;

import java.util.Locale;

import openperipheral.api.*;
import cofh.api.tileentity.ISecureTile;
import cofh.api.tileentity.ISecureTile.AccessMode;

public class AdapterSecureTile implements IPeripheralAdapter {

	@Override
	public Class<?> getTargetClass() {
		return ISecureTile.class;
	}

	@LuaMethod(description = "Gets the owner of the machine.", returnType = LuaType.STRING)
	public String getOwnerName(ISecureTile tile) {
		return tile.getOwnerName();
	}

	@LuaMethod(description = "Is this username allowed to access the machine.", returnType = LuaType.BOOLEAN, args = {
			@Arg(name = "username", description = "The username to check for", type = LuaType.STRING)
	})
	public boolean canPlayerAccess(ISecureTile tile, String name) {
		return tile.canPlayerAccess(name);
	}

	@LuaMethod(description = "Gets the AccessMode of this machine.", returnType = LuaType.STRING)
	public String getAccess(ISecureTile tile) {
		return tile.getAccess().name();
	}

	@LuaMethod(description = "Sets the AccessMode of this machine.", returnType = LuaType.BOOLEAN, args = {
			@Arg(name = "accessMode", description = "The access mode you wish to set (can be PUBLIC,RESTRICTED or PRIVATE)", type = LuaType.STRING)
	})
	public boolean setAccess(ISecureTile tile, String access) {
		try {
			AccessMode mode = AccessMode.valueOf(access.toUpperCase(Locale.ENGLISH));
			return tile.setAccess(mode);
		} catch (IllegalArgumentException e) {}
		return false;
	}
}

package openperipheral.integration.thermalexpansion;

import java.util.Locale;

import openperipheral.api.*;
import cofh.api.tileentity.ISecureTile;
import cofh.api.tileentity.ISecureTile.AccessMode;

public class AdapterSecureTile implements IPeripheralAdapter {

	@Override
	public Class<?> getTargetClass() {
		return ISecureTile.class;
	}

	@LuaMethod(description = "Gets the owner of the machine.", returnType = LuaType.STRING)
	public String getOwnerName(ISecureTile tile) {
		return tile.getOwnerName();
	}

	@LuaMethod(description = "Is this username allowed to access the machine.", returnType = LuaType.BOOLEAN, args = {
			@Arg(name = "username", description = "The username to check for", type = LuaType.STRING)
	})
	public boolean canPlayerAccess(ISecureTile tile, String name) {
		return tile.canPlayerAccess(name);
	}

	@LuaMethod(description = "Gets the AccessMode of this machine.", returnType = LuaType.STRING)
	public String getAccess(ISecureTile tile) {
		return tile.getAccess().name();
	}

}

Remove setAccess from TE Strongboxes

Remove setAccess from TE Strongboxes

setAccess can be used on TE Strongboxes to unlock someone else's chest, and then steal their items.


package com.twu.biblioteca;

public class BibliotecaApp {

    public BibliotecaApp() {
        System.out.println(welcomeMessage());
    }

    public static void main(String[] args) {
        BibliotecaApp bibliotecaApp = new BibliotecaApp();
    }

    public String welcomeMessage() {
        StringBuilder sb = new StringBuilder();
        sb.append("Welcome to Biblioteca - A Library Management System\n");
        int length = sb.length();
        for (int i = 0; i < length; i++) {
            sb.append("-");
        }
        return sb.toString();
    }
}

package com.twu.biblioteca;

public class BibliotecaApp {

    public static void main(String[] args) {
        System.out.println("Hello, world!");
    }

    public String welcomeMessage() {
        return "";
    }
}

Revert "Added a proper welcome message"

Revert "Added a proper welcome message"

This reverts commit 507fe8ba38124c71b2c4c4dfe38c5b2679891d17.


package synapticloop.b2;

/*
 * Copyright (c) 2016 synapticloop.
 *
 * All rights reserved.
 *
 * This code may contain contributions from other parties which, where
 * applicable, will be listed in the default build file for the project
 * ~and/or~ in a file named CONTRIBUTORS.txt in the root of the project.
 *
 * This source code and any derived binaries are covered by the terms and
 * conditions of the Licence agreement ("the Licence").  You may not use this
 * source code or any derived binaries except in compliance with the Licence.
 * A copy of the Licence is available in the file named LICENSE.txt shipped with
 * this source code or binaries.
 */

/**
 * The action for an associated file, either 'hide' or 'upload', "upload" means
 * a file that was uploaded to B2 Cloud Storage. "hide" means a file version
 * marking the file as hidden, so that it will not show up in b2_list_file_names.
 *
 * The result of b2_list_file_names will contain only "upload". The result of
 * b2_list_file_versions may have both.
 *
 * @author synapticloop
 */
public enum Action {
	hide,
	upload
}

package synapticloop.b2;

/*
 * Copyright (c) 2016 synapticloop.
 *
 * All rights reserved.
 *
 * This code may contain contributions from other parties which, where
 * applicable, will be listed in the default build file for the project
 * ~and/or~ in a file named CONTRIBUTORS.txt in the root of the project.
 *
 * This source code and any derived binaries are covered by the terms and
 * conditions of the Licence agreement ("the Licence").  You may not use this
 * source code or any derived binaries except in compliance with the Licence.
 * A copy of the Licence is available in the file named LICENSE.txt shipped with
 * this source code or binaries.
 */

/**
 * The action for an associated file, either 'hide' or 'upload', "upload" means
 * a file that was uploaded to B2 Cloud Storage. "hide" means a file version
 * marking the file as hidden, so that it will not show up in b2_list_file_names.
 *
 * The result of b2_list_file_names will contain only "upload". The result of
 * b2_list_file_versions may have both.
 *
 * @author synapticloop
 */
public enum Action {
	hide,
	upload,
	start
}

Add enum value `start` used for files with pending multipart upload.


// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.flutter;

import android.app.Activity;
import android.os.Bundle;

import org.chromium.base.PathUtils;
import org.domokit.sky.shell.SkyApplication;
import org.domokit.sky.shell.SkyMain;
import org.domokit.sky.shell.PlatformViewAndroid;

import java.io.File;

public class FlutterActivity extends Activity {
    private PlatformViewAndroid flutterView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        SkyMain.ensureInitialized(getApplicationContext(), null);
        setContentView(R.layout.flutter_layout);

        flutterView = (PlatformViewAndroid) findViewById(R.id.flutter_view);
        File appBundle = new File(PathUtils.getDataDirectory(this), SkyApplication.APP_BUNDLE);
        flutterView.runFromBundle(appBundle.getPath(), null);
    }

    @Override
    protected void onDestroy() {
        if (flutterView != null) {
            flutterView.destroy();
        }
        super.onDestroy();
    }
}

// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.example.flutter;

import android.app.Activity;
import android.os.Bundle;

import org.chromium.base.PathUtils;
import org.domokit.sky.shell.SkyMain;
import org.domokit.sky.shell.PlatformViewAndroid;

import java.io.File;

public class FlutterActivity extends Activity {
    private PlatformViewAndroid flutterView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        SkyMain.ensureInitialized(getApplicationContext(), null);
        setContentView(R.layout.flutter_layout);

        flutterView = (PlatformViewAndroid) findViewById(R.id.flutter_view);
        File appBundle = new File(PathUtils.getDataDirectory(this), SkyMain.APP_BUNDLE);
        flutterView.runFromBundle(appBundle.getPath(), null);
    }

    @Override
    protected void onDestroy() {
        if (flutterView != null) {
            flutterView.destroy();
        }
        super.onDestroy();
    }
}

Update SkyApplication to SkyMain in the hello_android example


package uk.gov.dvla.domain;

import com.google.code.morphia.annotations.Embedded;

import java.lang.String;
import java.util.Date;

@Embedded
public class EntitlementRestriction {

    private String code;
    private String text;
    private Date validFrom;
    private Date validTo;
    private String categoryCode;

    public EntitlementRestriction() {
    }

    public EntitlementRestriction(String code, String categoryCode) {
        if (code == null) {
            throw new RuntimeException("code must be specified");
        }

        this.code = code;
        this.categoryCode = categoryCode;

    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Date getValidFrom() {
        return validFrom;
    }

    public void setValidFrom(Date validFrom) {
        this.validFrom = validFrom;
    }

    public Date getValidTo() {
        return validTo;
    }

    public void setValidTo(Date validTo) {
        this.validTo = validTo;
    }

    public String getCategoryCode() {
        return categoryCode;
    }

    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }
}

package uk.gov.dvla.domain;

import com.google.code.morphia.annotations.Embedded;

import java.lang.String;
import java.util.Date;

@Embedded
public class EntitlementRestriction {

    private String code;
    private String text;
    private String categoryCode;
    private Date validTo;

    public EntitlementRestriction() {
    }

    public EntitlementRestriction(String code, String categoryCode) {
        if (code == null) {
            throw new RuntimeException("code must be specified");
        }

        this.code = code;
        this.categoryCode = categoryCode;

    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getCategoryCode() {
        return categoryCode;
    }

    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }

    public Date getValidTo() {
        return validTo;
    }

    public void setValidTo(Date validTo) {
        this.validTo = validTo;
    }
}

Set validTo on Entitlement Restriction and calculated new directivestatus


package com.stanfy.images.decorator;

import android.graphics.Bitmap;
import android.graphics.Canvas;

/**
 * Chain of decorators.
 * @author Roman Mazur (Stanfy - http://www.stanfy.com)
 */
public class ChainDecorator extends ImageDecoratorAdapter {

  /** Internal decorators. */
  private final ImageDecorator[] chain;

  public ChainDecorator(final ImageDecorator... decorators) {
    this.chain = decorators;
  }

  @Override
  public Bitmap processBitmap(final Bitmap bitmap, final Canvas bitmapVanvas) {
    Bitmap result = bitmap;
    final ImageDecorator[] chain = this.chain;
    for (int i = 0; i < chain.length; i++) {
      final Bitmap next = chain[i].decorateBitmap(result, bitmapVanvas);
      if (next != result) { result.recycle(); }
      result = next;
    }
    return result;
  }

  @Override
  public void setup(final int width, final int height, final int[] state, final int level) {
    final ImageDecorator[] chain = this.chain;
    for (int i = 0; i < chain.length; i++) {
      chain[i].setup(width, height, state, level);
    }
  }

  public ImageDecorator[] getChain() {
    return chain;
  }

}

package com.stanfy.images.decorator;

import android.graphics.Bitmap;
import android.graphics.Canvas;

/**
 * Chain of decorators.
 * @author Roman Mazur (Stanfy - http://www.stanfy.com)
 */
public class ChainDecorator extends ImageDecoratorAdapter {

  /** Internal decorators. */
  private final ImageDecorator[] chain;

  /** Stateful flag. */
  private final boolean stateful;

  public ChainDecorator(final ImageDecorator... decorators) {
    this.chain = decorators;
    for (final ImageDecorator d : decorators) {
      if (d.dependsOnDrawableState()) {
        this.stateful = true;
        return;
      }
    }
    this.stateful = false;
  }

  @Override
  public Bitmap processBitmap(final Bitmap bitmap, final Canvas bitmapVanvas) {
    Bitmap result = bitmap;
    final ImageDecorator[] chain = this.chain;
    for (int i = 0; i < chain.length; i++) {
      final Bitmap next = chain[i].decorateBitmap(result, bitmapVanvas);
      if (next != result) { result.recycle(); }
      result = next;
    }
    return result;
  }

  @Override
  public boolean dependsOnDrawableState() { return stateful; }

  @Override
  public void setup(final int width, final int height, final int[] state, final int level) {
    final ImageDecorator[] chain = this.chain;
    for (int i = 0; i < chain.length; i++) {
      chain[i].setup(width, height, state, level);
    }
  }

  public ImageDecorator[] getChain() {
    return chain;
  }

}

Fix state in chain decorator

Fix state in chain decorator


package io.scalecube.gateway.websocket;

import io.scalecube.gateway.clientsdk.ClientMessage;
import io.scalecube.gateway.clientsdk.ClientSettings;
import io.scalecube.gateway.clientsdk.codec.WebsocketGatewayMessageCodec;
import io.scalecube.gateway.clientsdk.websocket.WebsocketClientTransport;
import io.scalecube.services.codec.DataCodec;
import java.time.Duration;
import reactor.core.publisher.Mono;
import reactor.ipc.netty.resources.LoopResources;

public class WebsocketClientTransportTest {

  public static void main(String[] args) {
    String contentType = "application/json";
    ClientSettings settings =
        ClientSettings.builder().contentType(contentType).host("localhost").port(7070).build();
    LoopResources loopResources = LoopResources.create("worker");

    WebsocketClientTransport transport =
        new WebsocketClientTransport(
            settings,
            new WebsocketGatewayMessageCodec(DataCodec.getInstance(contentType)),
            loopResources);

    ClientMessage request = ClientMessage.builder().qualifier("/greeting/one").build();

    Mono.delay(Duration.ofSeconds(10))
        .doOnTerminate(
            () -> {
              System.err.println("closing ...");
              transport.close().subscribe();
            })
        .subscribe();

    ClientMessage block = transport.requestResponse(request).block();

    System.out.println(block);
  }
}

package io.scalecube.gateway.websocket;

import io.scalecube.gateway.clientsdk.ClientMessage;
import io.scalecube.gateway.clientsdk.ClientSettings;
import io.scalecube.gateway.clientsdk.codec.WebsocketGatewayMessageCodec;
import io.scalecube.gateway.clientsdk.websocket.WebsocketClientTransport;
import io.scalecube.services.codec.DataCodec;
import java.time.Duration;
import reactor.core.publisher.Mono;
import reactor.ipc.netty.resources.LoopResources;

public class WebsocketClientTransportTest {

  public static void main(String[] args) throws InterruptedException {
    String contentType = "application/json";
    ClientSettings settings =
        ClientSettings.builder().contentType(contentType).host("localhost").port(7070).build();
    LoopResources loopResources = LoopResources.create("worker");

    WebsocketClientTransport transport =
        new WebsocketClientTransport(
            settings,
            new WebsocketGatewayMessageCodec(DataCodec.getInstance(contentType)),
            loopResources);

    ClientMessage request =
        ClientMessage.builder().qualifier("/greeting/one").header("sid", "1").build();

    Mono.delay(Duration.ofSeconds(3))
        .doOnTerminate(
            () -> {
              System.err.println("closing ...");
              transport.close().subscribe();
            })
        .subscribe();

    transport.requestResponse(request).subscribe(System.out::println, System.err::println);

    Thread.currentThread().join();
  }
}

Update WebsocketHandler and WebsocketSession behavior


/*
 * Copyright (c) 2015 AsyncHttpClient Project. All rights reserved.
 *
 * This program is licensed to you under the Apache License Version 2.0,
 * and you may not use this file except in compliance with the Apache License Version 2.0.
 * You may obtain a copy of the Apache License Version 2.0 at
 *     http://www.apache.org/licenses/LICENSE-2.0.
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the Apache License Version 2.0 is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
 */
package org.asynchttpclient.netty;

import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;

public abstract class SimpleGenericFutureListener<V> implements GenericFutureListener<Future<V>> {

    @Override
    public final void operationComplete(Future<V> future) throws Exception {
        if (future.isSuccess()) {
            onSuccess(future.get());
        } else {
            onFailure(future.cause());
        }
    }

    protected abstract void onSuccess(V value) throws Exception;

    protected abstract void onFailure(Throwable t) throws Exception;
}

/*
 * Copyright (c) 2015 AsyncHttpClient Project. All rights reserved.
 *
 * This program is licensed to you under the Apache License Version 2.0,
 * and you may not use this file except in compliance with the Apache License Version 2.0.
 * You may obtain a copy of the Apache License Version 2.0 at
 *     http://www.apache.org/licenses/LICENSE-2.0.
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the Apache License Version 2.0 is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
 */
package org.asynchttpclient.netty;

import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;

public abstract class SimpleGenericFutureListener<V> implements GenericFutureListener<Future<V>> {

    @Override
    public final void operationComplete(Future<V> future) throws Exception {
        if (future.isSuccess()) {
            onSuccess(future.getNow());
        } else {
            onFailure(future.cause());
        }
    }

    protected abstract void onSuccess(V value) throws Exception;

    protected abstract void onFailure(Throwable t) throws Exception;
}

Use getNow() in GenericFutureListener. operationComplete instead of get()


/*
 * Copyright (c) 2002-2018 "Neo4j,"
 * Neo4j Sweden AB [http://neo4j.com]
 *
 * This file is part of Neo4j.
 *
 * 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.
 */
package org.neo4j.driver.v1.tck.tck.util;

import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

import org.neo4j.driver.v1.util.DatabaseExtension;

public class DatabaseRule extends DatabaseExtension implements TestRule
{
    @Override
    public Statement apply( Statement base, Description description )
    {
        return new Statement()
        {
            @Override
            public void evaluate() throws Throwable
            {
                DatabaseRule.this.beforeEach( null );
                base.evaluate();
            }
        };
    }
}

/*
 * Copyright (c) 2002-2018 "Neo4j,"
 * Neo4j Sweden AB [http://neo4j.com]
 *
 * This file is part of Neo4j.
 *
 * 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.
 */
package org.neo4j.driver.v1.tck.tck.util;

import org.junit.AssumptionViolatedException;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.opentest4j.TestAbortedException;

import org.neo4j.driver.v1.util.DatabaseExtension;

public class DatabaseRule extends DatabaseExtension implements TestRule
{
    @Override
    public Statement apply( Statement base, Description description )
    {
        return new Statement()
        {
            @Override
            public void evaluate() throws Throwable
            {
                try
                {
                    DatabaseRule.this.beforeEach( null );
                }
                catch ( TestAbortedException e )
                {
                    throw new AssumptionViolatedException( "Unable to prepare database", e );
                }
                base.evaluate();
            }
        };
    }
}

Fix skipping of TCK tests when boltkit unavailable

It failed because thrown exception was from JUnit 5. This commit
changes the exception to be from JUnit 4 API.


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

package org.apache.logging.log4j.core.net;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

/**
 * Unit tests for {@link SmtpManager}.
 */
class SmtpManagerTest {

    @Test
    void testCreateManagerName() {
        String managerName = SmtpManager.createManagerName("to", "cc", null, "from", null, "LOG4J2-3107",
                "proto", "smtp.log4j.com", 4711, "username", false, "filter");
        assertEquals("SMTP:to:cc::from::LOG4J2-3107:proto:smtp.log4j.com:4711:username::filter", managerName);
    }

}

Add missing Apache license header.

Add missing Apache license header.


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.technobots.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;

/**
 *
 * @author miguel
 */
public class NormalAutonomous extends CommandGroup {

    public NormalAutonomous() {

        //addSequential(new StopBall());
        addParallel(new ShooterOn(-.8));
        addSequential(new ReleaseBall());
        addSequential(new StopBall());

    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.technobots.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;

/**
 *
 * @author miguel
 */
public class NormalAutonomous extends CommandGroup {

    public NormalAutonomous() {

        //addSequential(new StopBall());
        addParallel(new ShooterOn(-.4));
        addSequential(new ReleaseBall());
        addSequential(new StopBall());

    }
}

Decrease Shooter Speed For Autonomous

Decrease Shooter Speed For Autonomous


package com.nulabinc.backlog4j.api.option;

import com.nulabinc.backlog4j.http.NameValuePair;

/**
 * Parameters for update status API.
 *
 * @author nulab-inc
 */
public class UpdateStatusParams extends PatchParams {

    private Object projectIdOrKey;
    private Object statusId;

    public UpdateStatusParams(Object projectIdOrKey, Object statusId, String name, String color) {
        this.projectIdOrKey = projectIdOrKey;
        this.statusId = statusId;
        parameters.add(new NameValuePair("name", name));
        parameters.add(new NameValuePair("color", color));
    }

    public String getProjectIdOrKeyString() {
        return projectIdOrKey.toString();
    }

    public String getStatusId() {
        return statusId.toString();
    }
}

package com.nulabinc.backlog4j.api.option;

import com.nulabinc.backlog4j.Project;
import com.nulabinc.backlog4j.http.NameValuePair;

/**
 * Parameters for update status API.
 *
 * @author nulab-inc
 */
public class UpdateStatusParams extends PatchParams {

    private Object projectIdOrKey;
    private Object statusId;

    public UpdateStatusParams(Object projectIdOrKey, Object statusId, String name, Project.CustomStatusColor color) {
        this.projectIdOrKey = projectIdOrKey;
        this.statusId = statusId;
        parameters.add(new NameValuePair("name", name));
        parameters.add(new NameValuePair("color", color.getStrValue()));
    }

    public String getProjectIdOrKeyString() {
        return projectIdOrKey.toString();
    }

    public String getStatusId() {
        return statusId.toString();
    }
}

Fix type at color variable

Fix type at color variable


package alien4cloud.it;

import org.junit.Ignore;
import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features = {
        //
        // "classpath:alien/rest/application-deployment/"
        // "classpath:alien/rest/application-deployment/service_matching.feature"
        // "classpath:alien/rest/application-deployment/deploy_application.feature"
        // "classpath:alien/rest/application-deployment/deploy_application_with_events.feature"
        // "classpath:alien/rest/application-deployment/deployments.feature"
        "classpath:alien/rest/application-deployment/inputs_orchestrators_properties_settings.feature"
        // "classpath:alien/rest/application-deployment/location_matching.feature"
        // "classpath:alien/rest/application-deployment/location_policies_setting.feature"
        // "classpath:alien/rest/application-deployment/node_substitution.feature"
        // "classpath:alien/rest/application-deployment/undeploy_application.feature"
        //
}, format = { "pretty", "html:target/cucumber/application_deployment", "json:target/cucumber/cucumber-application-deployment.json" })
// @Ignore
public class RunApplicationDeploymentIT {
}

package alien4cloud.it;

import org.junit.Ignore;
import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features = {
        //
        "classpath:alien/rest/application-deployment/"
        // "classpath:alien/rest/application-deployment/service_matching.feature"
        // "classpath:alien/rest/application-deployment/deploy_application.feature"
        // "classpath:alien/rest/application-deployment/deploy_application_with_events.feature"
        // "classpath:alien/rest/application-deployment/deployments.feature"
        // "classpath:alien/rest/application-deployment/inputs_orchestrators_properties_settings.feature"
        // "classpath:alien/rest/application-deployment/location_matching.feature"
        // "classpath:alien/rest/application-deployment/location_policies_setting.feature"
        // "classpath:alien/rest/application-deployment/node_substitution.feature"
        // "classpath:alien/rest/application-deployment/undeploy_application.feature"
        //
}, format = { "pretty", "html:target/cucumber/application_deployment", "json:target/cucumber/cucumber-application-deployment.json" })
// @Ignore
public class RunApplicationDeploymentIT {
}

Fix previous commit (disabled some tests)


/**
 * Copyright © 2015 MicroWorld (contact@microworld.org)
 *
 * 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.
 */
package org.microworld.mangopay.entities;

public enum LegalPersonType {
  BUSINESS, ORGANIZATION;
}

/**
 * Copyright © 2015 MicroWorld (contact@microworld.org)
 *
 * 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.
 */
package org.microworld.mangopay.entities;

public enum LegalPersonType {
  BUSINESS, ORGANIZATION, SOLETRADER;
}

Add new legal person types.

Add new legal person types.


package com.smartbear.ready.jenkins.sample;

import org.junit.Test;

import java.io.IOException;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class SpotifyLookupTest {
    @Test
    public void testNyttGolv() throws IOException {
        SpotifyLookup spotifyLookup = new SpotifyLookup();

        // Use our Virt instead of the real API
        spotifyLookup.setEndpoint("http://localhost:8080/lookup/1/");

        String title = spotifyLookup.getTitle("7JIuSd9aMu0bDd57820sFV");
        assertThat(title, is("Nytt golv"));
    }
}

package com.smartbear.ready.jenkins.sample;

import org.junit.Test;

import java.io.IOException;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class SpotifyLookupTest {
    @Test
    public void testNyttGolv() throws IOException {
        SpotifyLookup spotifyLookup = new SpotifyLookup();

        // Use our Virt instead of the real API
        spotifyLookup.setEndpoint("http://localhost:53487/lookup/1/");

        String title = spotifyLookup.getTitle("7JIuSd9aMu0bDd57820sFV");
        assertThat(title, is("Nytt golv"));
    }
}

Use a less common port

Use a less common port


// Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
//  This source code is licensed under both the GPLv2 (found in the
//  COPYING file in the root directory) and Apache 2.0 License
//  (found in the LICENSE.Apache file in the root directory).

package org.rocksdb;

/**
 * RocksDB {@link ReadOptions} read tiers.
 */
public enum ReadTier {
  READ_ALL_TIER((byte)0),
  BLOCK_CACHE_TIER((byte)1),
  PERSISTED_TIER((byte)2);

  private final byte value;

  ReadTier(final byte value) {
    this.value = value;
  }

  /**
   * Returns the byte value of the enumerations value
   *
   * @return byte representation
   */
  public byte getValue() {
    return value;
  }

  /**
   * Get ReadTier by byte value.
   *
   * @param value byte representation of ReadTier.
   *
   * @return {@link org.rocksdb.ReadTier} instance or null.
   * @throws java.lang.IllegalArgumentException if an invalid
   *     value is provided.
   */
  public static ReadTier getReadTier(final byte value) {
    for (final ReadTier readTier : ReadTier.values()) {
      if (readTier.getValue() == value){
        return readTier;
      }
    }
    throw new IllegalArgumentException("Illegal value provided for ReadTier.");
  }
}

// Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
//  This source code is licensed under both the GPLv2 (found in the
//  COPYING file in the root directory) and Apache 2.0 License
//  (found in the LICENSE.Apache file in the root directory).

package org.rocksdb;

/**
 * RocksDB {@link ReadOptions} read tiers.
 */
public enum ReadTier {
  READ_ALL_TIER((byte)0),
  BLOCK_CACHE_TIER((byte)1),
  PERSISTED_TIER((byte)2),
  MEMTABLE_TIER((byte)3);

  private final byte value;

  ReadTier(final byte value) {
    this.value = value;
  }

  /**
   * Returns the byte value of the enumerations value
   *
   * @return byte representation
   */
  public byte getValue() {
    return value;
  }

  /**
   * Get ReadTier by byte value.
   *
   * @param value byte representation of ReadTier.
   *
   * @return {@link org.rocksdb.ReadTier} instance or null.
   * @throws java.lang.IllegalArgumentException if an invalid
   *     value is provided.
   */
  public static ReadTier getReadTier(final byte value) {
    for (final ReadTier readTier : ReadTier.values()) {
      if (readTier.getValue() == value){
        return readTier;
      }
    }
    throw new IllegalArgumentException("Illegal value provided for ReadTier.");
  }
}

Add Memtable Read Tier to RocksJava

Add Memtable Read Tier to RocksJava

Summary:
This options was introduced in the C++ API in #1953 .
Closes https://github.com/facebook/rocksdb/pull/3064

Differential Revision: D6139010

Pulled By: sagar0

fbshipit-source-id: 164de11d539d174cf3afe7cd40e667049f44b0bc


package org.cyclops.integrateddynamics.network;

import org.cyclops.cyclopscore.datastructure.DimPos;
import org.cyclops.integrateddynamics.api.network.IPartNetwork;
import org.cyclops.integrateddynamics.core.network.TileNetworkElement;
import org.cyclops.integrateddynamics.tileentity.TileVariablestore;

/**
 * Network element for variable stores.
 * @author rubensworks
 */
public class VariablestoreNetworkElement extends TileNetworkElement<TileVariablestore> {

    public VariablestoreNetworkElement(DimPos pos) {
        super(pos);
    }

    @Override
    public boolean onNetworkAddition(IPartNetwork network) {
        return network.addVariableContainer(getPos());
    }

    @Override
    public void onNetworkRemoval(IPartNetwork network) {
        network.removeVariableContainer(getPos());
    }

    @Override
    public int getConsumptionRate() {
        return 4;
    }

    @Override
    protected Class<TileVariablestore> getTileClass() {
        return null;
    }
}

package org.cyclops.integrateddynamics.network;

import org.cyclops.cyclopscore.datastructure.DimPos;
import org.cyclops.integrateddynamics.api.network.IPartNetwork;
import org.cyclops.integrateddynamics.core.network.TileNetworkElement;
import org.cyclops.integrateddynamics.tileentity.TileVariablestore;

/**
 * Network element for variable stores.
 * @author rubensworks
 */
public class VariablestoreNetworkElement extends TileNetworkElement<TileVariablestore> {

    public VariablestoreNetworkElement(DimPos pos) {
        super(pos);
    }

    @Override
    public boolean onNetworkAddition(IPartNetwork network) {
        return network.addVariableContainer(getPos());
    }

    @Override
    public void onNetworkRemoval(IPartNetwork network) {
        network.removeVariableContainer(getPos());
    }

    @Override
    public int getConsumptionRate() {
        return 4;
    }

    @Override
    protected Class<TileVariablestore> getTileClass() {
        return TileVariablestore.class;
    }
}

Fix variable store breaking crash

Fix variable store breaking crash


package at.ac.tuwien.inso.integration_tests;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;

@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
@ActiveProfiles("test")
@Transactional
public class StudentRecommendedCoursesTests {

    @Test
    public void studentRecommendedCoursesTest() {
        //TODO
    }

    @Test
    public void dismissCourseTest() {
        //TODO
    }
}

package at.ac.tuwien.inso.integration_tests;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.transaction.annotation.Transactional;

import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl;

@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
@ActiveProfiles("test")
@Transactional
public class StudentRecommendedCoursesTests extends AbstractCoursesTests{

    @Test
    public void studentRecommendedCoursesTest() throws Exception {
        mockMvc.perform(
                get("/student/recommended").with(user(studentUserAccount))
        ).andExpect(
                model().attributeExists("recommendedCourses")
        );
    }

    @Test
    @Rollback
    public void dismissCourseTest() throws Exception {
        mockMvc.perform(
                post("/student/recommended")
                        .with(user(studentUserAccount))
                        .with(csrf())
                        .contentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE)
                        .content("dismissedId="+calculusWS2016.getId())
        ).andExpect(
                result -> {
                    if (studentRepository.findByAccount(studentUserAccount).getDismissedCourses().size() <= 0) {
                        throw new Exception("Size of dismissed courses for student " + student + " is zero");
                    }
                    if (!studentRepository.findByAccount(studentUserAccount).getDismissedCourses().contains(calculusWS2016)) {
                        throw new Exception("Wrong dismissed course!");
                    }
                }
        ).andExpect(
                redirectedUrl("/student/recommended")
        );
    }
}

Add tests for RecommendedCourses and Dismiss course


package com.braintreepayments.testutils;

import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
import android.support.test.espresso.intent.Intents;
import android.support.test.rule.ActivityTestRule;

import static android.support.test.InstrumentationRegistry.getTargetContext;
import static com.braintreepayments.testutils.SharedPreferencesHelper.getSharedPreferences;

public class BraintreeActivityTestRule<T extends Activity> extends ActivityTestRule<T> {

    public BraintreeActivityTestRule(Class<T> activityClass) {
        super(activityClass);
    }

    public BraintreeActivityTestRule(Class<T> activityClass, boolean initialTouchMode,
            boolean launchActivity) {
        super(activityClass, initialTouchMode, launchActivity);
    }

    @Override
    protected void beforeActivityLaunched() {
        super.beforeActivityLaunched();
        getSharedPreferences().edit().clear().commit();

        ((KeyguardManager) getTargetContext().getSystemService(Context.KEYGUARD_SERVICE))
                .newKeyguardLock("BraintreeActivityTestRule")
                .disableKeyguard();
    }

    @Override
    protected void afterActivityLaunched() {
        Intents.init();
        super.afterActivityLaunched();
    }

    @Override
    protected void afterActivityFinished() {
        super.afterActivityFinished();

        Intents.release();

        getSharedPreferences().edit().clear().commit();
    }
}

package com.braintreepayments.testutils;

import android.app.Activity;
import android.app.KeyguardManager;
import android.app.KeyguardManager.KeyguardLock;
import android.content.Context;
import android.support.test.espresso.intent.Intents;
import android.support.test.rule.ActivityTestRule;

import static android.support.test.InstrumentationRegistry.getTargetContext;
import static com.braintreepayments.testutils.SharedPreferencesHelper.getSharedPreferences;

public class BraintreeActivityTestRule<T extends Activity> extends ActivityTestRule<T> {

    private KeyguardLock mKeyguardLock;

    public BraintreeActivityTestRule(Class<T> activityClass) {
        super(activityClass);
        init();
    }

    public BraintreeActivityTestRule(Class<T> activityClass, boolean initialTouchMode,
            boolean launchActivity) {
        super(activityClass, initialTouchMode, launchActivity);
        init();
    }

    private void init() {
        getSharedPreferences().edit().clear().commit();

        mKeyguardLock = ((KeyguardManager) getTargetContext().getSystemService(Context.KEYGUARD_SERVICE))
                .newKeyguardLock("BraintreeActivityTestRule");
        mKeyguardLock.disableKeyguard();
    }

    @Override
    protected void afterActivityLaunched() {
        Intents.init();
        super.afterActivityLaunched();
    }

    @Override
    protected void afterActivityFinished() {
        super.afterActivityFinished();

        try {
            Intents.release();
        } catch (IllegalStateException ignored) {}

        getSharedPreferences().edit().clear().commit();

        mKeyguardLock.reenableKeyguard();
    }
}

Fix incorrect test failures and Keyguard leaks


package com.chaos.databinding.presenters;

import com.chaos.databinding.models.User;
import com.chaos.databinding.views.UserView;

public class ActivityMainPresenter {
    private final UserView view;

    public ActivityMainPresenter(final UserView view) {
        this.view = view;
    }

    public static ActivityMainPresenter create(final UserView view) {
        return new ActivityMainPresenter(view);
    }

    public void updateUser() {
        this.view.setUser(this.getUser());
    }

    private User getUser() {
        return new User("Ash Davies", "Berlin");
    }
}

package com.chaos.databinding.presenters;

import com.chaos.databinding.models.User;
import com.chaos.databinding.services.GitHub;
import com.chaos.databinding.views.UserView;

import retrofit.RestAdapter;

public class ActivityMainPresenter {
    private static final String GITHUB_API = "https://api.github.com";

    private final GitHub service;
    private final UserView view;

    public ActivityMainPresenter(final GitHub service, final UserView view) {
        this.service = service;
        this.view = view;
    }

    public static ActivityMainPresenter create(final UserView view) {
        final GitHub service = ActivityMainPresenter.getRestAdapter().create(GitHub.class);
        return new ActivityMainPresenter(service, view);
    }

    private static RestAdapter getRestAdapter() {
        return new RestAdapter.Builder()
                .setEndpoint(GITHUB_API)
                .build();
    }

    public void updateUser() {
        this.view.setUser(this.getUser());
    }

    private User getUser() {
        return new User("Ash Davies", "Berlin");
    }
}

Create presenter with GitHub service

Create presenter with GitHub service


/*
 * 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.
 */
package org.gbif.common.messaging.api.messages;

import java.util.Set;

/**
 * Pipelines message that allows specifying the execution runner for a pipeline process.
 */
public interface PipelinesInterpretationMessage extends PipelineBasedMessage {

  Set<String> getInterpretTypes();

  String getOnlyForStep();

  Long getNumberOfInterpretationRecords();

  void setInterpretTypes(Set<String> interpretTypes);
}

/*
 * 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.
 */
package org.gbif.common.messaging.api.messages;

import java.util.Set;

/**
 * Pipelines message that allows specifying the execution runner for a pipeline process.
 */
public interface PipelinesInterpretationMessage extends PipelineBasedMessage, PipelinesRunnerMessage {

  Set<String> getInterpretTypes();

  String getOnlyForStep();

  Long getNumberOfInterpretationRecords();

  void setInterpretTypes(Set<String> interpretTypes);
}

Create runner interface for yarn/java messages


package net.mostlyoriginal.game.system.drag;

import com.artemis.Aspect;
import com.artemis.Entity;
import com.artemis.EntitySystem;
import com.artemis.World;
import com.artemis.annotations.Wire;
import com.artemis.utils.IntBag;
import net.mostlyoriginal.api.system.physics.CollisionSystem;
import net.mostlyoriginal.game.component.Draggable;

/**
 * @author Daan van Yperen
 */
@Wire
public class GridOverlapHelperSystem extends EntitySystem {

	CollisionSystem collisionSystem;
	private Entity flyweightEntity;

	public GridOverlapHelperSystem() {
		super(Aspect.all(Draggable.class));
	}

	@Override
	protected void setWorld(World world) {
		super.setWorld(world);
		flyweightEntity = createFlyweightEntity();
	}

	/**
	 * Does passed entity overlap any grid entity? (except self)
	 */
	public boolean overlaps(Entity e) {
		IntBag actives = subscription.getEntities();
		int[] array = actives.getData();
		for (int i = 0, s = actives.size(); s > i; i++) {
			flyweightEntity.id = array[i];
			if (flyweightEntity.getId() != e.getId() && collisionSystem.overlaps(flyweightEntity, e)) {
				return true;
			}
		}
		return false;
	}

	@Override
	protected void processSystem() {
	}
}

package net.mostlyoriginal.game.system.drag;

import com.artemis.Aspect;
import com.artemis.Entity;
import com.artemis.EntitySystem;
import com.artemis.World;
import com.artemis.annotations.Wire;
import com.artemis.utils.IntBag;
import net.mostlyoriginal.api.system.physics.CollisionSystem;
import net.mostlyoriginal.game.component.Conveyer;
import net.mostlyoriginal.game.component.Draggable;

/**
 * @author Daan van Yperen
 */
@Wire
public class GridOverlapHelperSystem extends EntitySystem {

	CollisionSystem collisionSystem;
	private Entity flyweightEntity;

	public GridOverlapHelperSystem() {
		super(Aspect.one(Draggable.class, Conveyer.class));
	}

	@Override
	protected void setWorld(World world) {
		super.setWorld(world);
		flyweightEntity = createFlyweightEntity();
	}

	/**
	 * Does passed entity overlap any grid entity? (except self)
	 */
	public boolean overlaps(Entity e) {
		IntBag actives = subscription.getEntities();
		int[] array = actives.getData();
		for (int i = 0, s = actives.size(); s > i; i++) {
			flyweightEntity.id = array[i];
			if (flyweightEntity.getId() != e.getId() && collisionSystem.overlaps(flyweightEntity, e)) {
				return true;
			}
		}
		return false;
	}

	@Override
	protected void processSystem() {
	}
}

Fix draggability on top of other conveyers.


package org.realityforge.replicant.client;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static org.realityforge.braincheck.Guards.*;

/**
 * A basic EntityLocator implementation that allows explicit per-type registration
 */
public class AggregateEntityLocator
  implements EntityLocator
{
  private final ArrayList<EntityLocator> _entityLocators = new ArrayList<>();

  protected final <T> void registerEntityLocator( @Nonnull final EntityLocator entityLocator )
  {
    apiInvariant( () -> !_entityLocators.contains( entityLocator ),
                  () -> "Attempting to register entityLocator " + entityLocator + " when already present." );
    _entityLocators.add( entityLocator );
  }

  /**
   * {@inheritDoc}
   */
  @Nullable
  @Override
  public final <T> T findByID( @Nonnull final Class<T> type, @Nonnull final Object id )
  {
    for ( final EntityLocator entityLocator : _entityLocators )
    {
      final T entity = entityLocator.findByID( type, id );
      if ( null != entity )
      {
        return entity;
      }
    }
    return null;
  }

  /**
   * {@inheritDoc}
   */
  @Nonnull
  @Override
  public <T> List<T> findAll( @Nonnull final Class<T> type )
  {
    final ArrayList<T> results = new ArrayList<>();
    for ( final EntityLocator entityLocator : _entityLocators )
    {
      results.addAll( entityLocator.findAll( type ) );
    }
    return results;
  }
}

package org.realityforge.replicant.client;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static org.realityforge.braincheck.Guards.*;

/**
 * A basic EntityLocator implementation that allows explicit per-type registration
 */
public class AggregateEntityLocator
  implements EntityLocator
{
  private final ArrayList<EntityLocator> _entityLocators = new ArrayList<>();

  public AggregateEntityLocator( @Nonnull final EntityLocator... entityLocator )
  {
    for ( final EntityLocator locator : entityLocator )
    {
      registerEntityLocator( locator );
    }
  }

  protected final <T> void registerEntityLocator( @Nonnull final EntityLocator entityLocator )
  {
    apiInvariant( () -> !_entityLocators.contains( entityLocator ),
                  () -> "Attempting to register entityLocator " + entityLocator + " when already present." );
    _entityLocators.add( entityLocator );
  }

  /**
   * {@inheritDoc}
   */
  @Nullable
  @Override
  public final <T> T findByID( @Nonnull final Class<T> type, @Nonnull final Object id )
  {
    for ( final EntityLocator entityLocator : _entityLocators )
    {
      final T entity = entityLocator.findByID( type, id );
      if ( null != entity )
      {
        return entity;
      }
    }
    return null;
  }

  /**
   * {@inheritDoc}
   */
  @Nonnull
  @Override
  public <T> List<T> findAll( @Nonnull final Class<T> type )
  {
    final ArrayList<T> results = new ArrayList<>();
    for ( final EntityLocator entityLocator : _entityLocators )
    {
      results.addAll( entityLocator.findAll( type ) );
    }
    return results;
  }
}

Make it possible to register the locators via the constructor


// Copyright 2016 Yahoo Inc.
// Licensed under the terms of the Apache license. Please see LICENSE.md file distributed with this work for terms.
package com.yahoo.bard.webservice.druid.model.metadata;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

import io.druid.timeline.partition.NoneShardSpec;

/**
 * Defines a mix-in that is used to deserialize shard spec from json.
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
        @JsonSubTypes.Type(value = NumberedShardSpec.class, name = "hashed"),
        @JsonSubTypes.Type(value = NoneShardSpec.class, name = "none")
})
public abstract class ShardSpecMixIn { }

// Copyright 2016 Yahoo Inc.
// Licensed under the terms of the Apache license. Please see LICENSE.md file distributed with this work for terms.
package com.yahoo.bard.webservice.druid.model.metadata;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

import io.druid.timeline.partition.NoneShardSpec;

/**
 * Defines a mix-in that is used to deserialize shard spec from json.
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
        @JsonSubTypes.Type(value = NumberedShardSpec.class, name = "hashed"),
        @JsonSubTypes.Type(value = NumberedShardSpec.class, name = "linear"),
        @JsonSubTypes.Type(value = NoneShardSpec.class, name = "none")
})
public abstract class ShardSpecMixIn { }

Add support for linear ShardSpecs

Add support for linear ShardSpecs


package org.verapdf.model.impl.pb.external;

import org.apache.pdfbox.pdmodel.common.PDStream;
import org.verapdf.model.external.FontProgram;

/**
 * @author Timur Kamalov
 */
public class PBoxFontProgram extends PBoxExternal implements FontProgram {

	public static final String FONT_PROGRAM_TYPE = "FontProgram";

	private PDStream fontProgram;

	//for validating widths array in simple fonts
	private Long firstChar;
	private Long lastChar;
	private Long widthSize;

	public PBoxFontProgram(PDStream fontProgram) {
		super();
		setType(FONT_PROGRAM_TYPE);
		this.fontProgram = fontProgram;
	}

	public PBoxFontProgram(PDStream fontProgram, Long firstChar, Long lastChar, Long widthSize) {
		this(fontProgram);
		this.firstChar = firstChar;
		this.lastChar = lastChar;
		this.widthSize = widthSize;
	}

	@Override
	public Boolean getareReferencedGlyphsPresent() {
		return null;
	}

	@Override
	public Boolean getareWidthsConsistent() {
		return null;
	}

}

package org.verapdf.model.impl.pb.external;

import org.apache.pdfbox.pdmodel.common.PDStream;
import org.verapdf.model.external.FontProgram;

/**
 * @author Timur Kamalov
 */
public class PBoxFontProgram extends PBoxExternal implements FontProgram {

	public static final String FONT_PROGRAM_TYPE = "FontProgram";

	private PDStream fontProgram;

	//for validating widths array in simple fonts
	private Long firstChar;
	private Long lastChar;
	private Long widthSize;

	public PBoxFontProgram(PDStream fontProgram) {
		super();
		setType(FONT_PROGRAM_TYPE);
		this.fontProgram = fontProgram;
	}

	public PBoxFontProgram(PDStream fontProgram, Long firstChar, Long lastChar, Long widthSize) {
		this(fontProgram);
		this.firstChar = firstChar;
		this.lastChar = lastChar;
		this.widthSize = widthSize;
	}

}

Fix for recent changes in the model (just removed two methods).


/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package org.jsimpledb.parse.expr;

import com.google.common.base.Preconditions;

import org.jsimpledb.parse.ParseSession;

/**
 * {@link Value} that represents a {@link ParseSession} variable.
 *
 * @see ParseSession#getVars
 */
public class VarValue extends AbstractLValue {

    private final String name;

    /**
     * Constructor.
     *
     * @param name variable name
     * @throws IllegalArgumentException if name is null
     * @throws IllegalArgumentException if name is not a valid Java identifier
     */
    public VarValue(String name) {
        new AbstractNamed(name) { };                                // validates the name
        this.name = name;
    }

    /**
     * Get the variable name.
     *
     * @return variable name
     */
    public String getName() {
        return this.name;
    }

    @Override
    public Object get(ParseSession session) {
        final Value value = session.getVars().get(this.name);
        if (value == null)
            throw new EvalException("variable `" + name + "' is not defined");
        return value.get(session);
    }

    @Override
    public Class<?> getType(ParseSession session) {
        final Value value = session.getVars().get(this.name);
        return value != null ? value.getType(session) : Object.class;
    }

    @Override
    public void set(ParseSession session, Value value) {
        Preconditions.checkArgument(value != null, "null value");
        session.getVars().put(this.name, value);
    }
}

/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package org.jsimpledb.parse.expr;

import com.google.common.base.Preconditions;

import org.jsimpledb.parse.ParseSession;

/**
 * {@link Value} that represents a {@link ParseSession} variable.
 *
 * @see ParseSession#getVars
 */
public class VarValue extends AbstractLValue {

    private final String name;

    /**
     * Constructor.
     *
     * @param name variable name
     * @throws IllegalArgumentException if name is null
     * @throws IllegalArgumentException if name is not a valid Java identifier
     */
    public VarValue(String name) {
        new AbstractNamed(name) { };                                // validates the name
        this.name = name;
    }

    /**
     * Get the variable name.
     *
     * @return variable name
     */
    public String getName() {
        return this.name;
    }

    @Override
    public Object get(ParseSession session) {
        final Value value = session.getVars().get(this.name);
        if (value == null)
            throw new EvalException("variable `" + name + "' is not defined");
        return MethodUtil.refresh(value.get(session));
    }

    @Override
    public Class<?> getType(ParseSession session) {
        final Value value = session.getVars().get(this.name);
        return value != null ? value.getType(session) : Object.class;
    }

    @Override
    public void set(ParseSession session, Value value) {
        Preconditions.checkArgument(value != null, "null value");
        session.getVars().put(this.name, value);
    }
}

Refresh retrieved CLI session variables.


// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
@ExportPackage
@PublicApi // TODO: Revoke this on Vespa 8.
package com.yahoo.vespa.curator;
import com.yahoo.api.annotations.PublicApi;
import com.yahoo.osgi.annotation.ExportPackage;

// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
@ExportPackage
package com.yahoo.vespa.curator;
import com.yahoo.osgi.annotation.ExportPackage;

Revoke package c.y.vespa.curator from PublicApi

- Probably just used internally.


/*
 * Copyright 2015 Marek Kaput
 *
 * 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.
 */

package org.rustidea.psi.types;

import org.rustidea.stubs.types.*;

public interface RsStubElementTypes {
    RsLifetimeElementType LIFETIME = RsLifetimeElementType.INSTANCE;
    RsTypeParameterElementType TYPE_PARAMETER = RsTypeParameterElementType.INSTANCE;
    RsLifetimeTypeParameterElementType LIFETIME_TYPE_PARAMETER = RsLifetimeTypeParameterElementType.INSTANCE;
    RsTypeParameterListElementType TYPE_PARAMETER_LIST = RsTypeParameterListElementType.INSTANCE;
    RsWhereClauseElementType WHERE_CLAUSE = RsWhereClauseElementType.INSTANCE;
    RsPathElementType PATH = RsPathElementType.INSTANCE;
    RsPathComponentElementType PATH_COMPONENT = RsPathComponentElementType.INSTANCE;
    RsDocElementType DOC = RsDocElementType.INSTANCE;
    RsAttributeElementType ATTRIBUTE = RsAttributeElementType.INSTANCE;
    RsAttributeItemElementType ATTRIBUTE_ITEM = RsAttributeItemElementType.INSTANCE;
    RsAttributeItemListElementType ATTRIBUTE_ITEM_LIST = RsAttributeItemListElementType.INSTANCE;
}

/*
 * Copyright 2015 Marek Kaput
 *
 * 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.
 */

package org.rustidea.psi.types;

import org.rustidea.stubs.types.*;

public interface RsStubElementTypes {
    RsAttributeElementType ATTRIBUTE = RsAttributeElementType.INSTANCE;
    RsAttributeItemElementType ATTRIBUTE_ITEM = RsAttributeItemElementType.INSTANCE;
    RsAttributeItemListElementType ATTRIBUTE_ITEM_LIST = RsAttributeItemListElementType.INSTANCE;
    RsDocElementType DOC = RsDocElementType.INSTANCE;
    RsLifetimeElementType LIFETIME = RsLifetimeElementType.INSTANCE;
    RsLifetimeTypeParameterElementType LIFETIME_TYPE_PARAMETER = RsLifetimeTypeParameterElementType.INSTANCE;
    RsPathComponentElementType PATH_COMPONENT = RsPathComponentElementType.INSTANCE;
    RsPathElementType PATH = RsPathElementType.INSTANCE;
    RsTypeParameterElementType TYPE_PARAMETER = RsTypeParameterElementType.INSTANCE;
    RsTypeParameterListElementType TYPE_PARAMETER_LIST = RsTypeParameterListElementType.INSTANCE;
    RsWhereClauseElementType WHERE_CLAUSE = RsWhereClauseElementType.INSTANCE;
}

Sort stub element type definitions

Sort stub element type definitions


package com.example.inverse;

import arez.annotations.ArezComponent;
import arez.annotations.Inverse;
import arez.annotations.Observable;
import arez.annotations.Reference;
import arez.annotations.ReferenceId;
import java.util.Collection;

public class MissingInverseOnReferenceModel
{
  @ArezComponent
  static abstract class Wheel
  {
    @Reference
    abstract Car getCar();

    @ReferenceId
    @Observable
    abstract int getCarId();

    abstract void setCarId( int carId );
  }

  @ArezComponent
  static abstract class Car
  {
    @Inverse
    abstract Collection<Wheel> getWheels();
  }
}

package com.example.inverse;

import arez.annotations.ArezComponent;
import arez.annotations.Inverse;
import arez.annotations.Observable;
import arez.annotations.Reference;
import arez.annotations.ReferenceId;
import java.util.Collection;

public class MissingInverseOnReferenceModel
{
  @ArezComponent
  static abstract class Car
  {
    @Inverse
    abstract Collection<Wheel> getWheels();
  }

  @ArezComponent
  static abstract class Wheel
  {
    @Reference
    abstract Car getCar();

    @ReferenceId
    @Observable
    abstract int getCarId();

    abstract void setCarId( int carId );
  }
}

Reorder classes to ensure compiler operates in correct order


package org.develnext.jphp.core.tokenizer.token.expr.operator;

import php.runtime.common.Association;
import org.develnext.jphp.core.tokenizer.TokenType;
import org.develnext.jphp.core.tokenizer.TokenMeta;
import org.develnext.jphp.core.tokenizer.token.Token;
import org.develnext.jphp.core.tokenizer.token.expr.ExprToken;
import org.develnext.jphp.core.tokenizer.token.expr.OperatorExprToken;
import org.develnext.jphp.core.tokenizer.token.stmt.ExprStmtToken;

public class LogicOperatorExprToken extends OperatorExprToken {

    private ExprStmtToken rightValue;

    @Override
    public Association getAssociation() {
        return Association.LEFT;
    }

    @Override
    public boolean isBinary() {
        return false;
    }

    public LogicOperatorExprToken(TokenMeta meta, TokenType type) {
        super(meta, type);
    }

    public ExprStmtToken getRightValue() {
        return rightValue;
    }

    public void setRightValue(ExprStmtToken rightValue) {
        this.rightValue = rightValue;
    }

    @Override
    public Token getLast() {
        Token token = rightValue.getLast();
        if (token instanceof ExprToken)
            return ((ExprToken) token).getLast();

        return token;
    }
}

package org.develnext.jphp.core.tokenizer.token.expr.operator;

import php.runtime.common.Association;
import org.develnext.jphp.core.tokenizer.TokenType;
import org.develnext.jphp.core.tokenizer.TokenMeta;
import org.develnext.jphp.core.tokenizer.token.Token;
import org.develnext.jphp.core.tokenizer.token.expr.ExprToken;
import org.develnext.jphp.core.tokenizer.token.expr.OperatorExprToken;
import org.develnext.jphp.core.tokenizer.token.stmt.ExprStmtToken;

public class LogicOperatorExprToken extends OperatorExprToken {

    private ExprStmtToken rightValue;

    @Override
    public Association getAssociation() {
        return Association.LEFT;
    }

    @Override
    public boolean isBinary() {
        return false;
    }

    public LogicOperatorExprToken(TokenMeta meta, TokenType type) {
        super(meta, type);
    }

    public ExprStmtToken getRightValue() {
        return rightValue;
    }

    public void setRightValue(ExprStmtToken rightValue) {
        this.rightValue = rightValue;
    }

    @Override
    public Token getLast() {
        if (rightValue == null) {
            return null;
        }

        Token token = rightValue.getLast();

        if (token instanceof ExprToken)
            return ((ExprToken) token).getLast();

        return token;
    }
}

Fix npe in syntax analyzer in logic operators.


package beaform.gui.search.tree;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * A listener that activates on double clicks.
 *
 * @author Steven Post
 *
 */
public class DoubleClickListener extends MouseAdapter {

	private final FormulaTree formulaTree;

	/**
	 * @param formulaTree
	 */
	DoubleClickListener(FormulaTree formulaTree) {
		this.formulaTree = formulaTree;
	}

	/** The number of clicks to register a double click on the mouse */
	private static final int DOUBLE_CLICK = 2;

	/**
	 * This method fires when the mouse is clicked,
	 * but only does something on double click events.
	 *
	 * @param event The event passed to this method when clicks are seen.
	 */
	@Override
	public void mousePressed(final MouseEvent event) {
		if(event.getClickCount() == DOUBLE_CLICK) {
			this.formulaTree.editSelectedFormula();
		}
	}
}

Add newline at the end of a file

Add newline at the end of a file


package org.jboss.webbeans.tck;

import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.List;

import javax.inject.manager.Manager;

import org.jboss.jsr299.tck.api.DeploymentException;
import org.jboss.jsr299.tck.spi.StandaloneContainers;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.mock.MockBootstrap;
import org.jboss.webbeans.mock.MockWebBeanDiscovery;

public class StandaloneContainersImpl implements StandaloneContainers
{

   public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, Class<?>... classes) throws DeploymentException
   {
      try
      {
         MockBootstrap bootstrap = new MockBootstrap();
         ManagerImpl manager = bootstrap.getManager();
         if (enabledDeploymentTypes != null)
         {
            manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
         }
         MockWebBeanDiscovery discovery = new MockWebBeanDiscovery();
         discovery.setWebBeanClasses(Arrays.asList(classes));
         bootstrap.setWebBeanDiscovery(discovery);
         bootstrap.boot();
         return manager;
      }
      catch (Exception e)
      {
         throw new DeploymentException("Error deploying beans", e);
      }
   }

   public Manager deploy(java.lang.Class<?>... classes) throws DeploymentException
   {
      return deploy(null, classes);
   }

}

package org.jboss.webbeans.tck;

import java.lang.annotation.Annotation;
import java.net.URL;
import java.util.List;

import org.jboss.jsr299.tck.api.DeploymentException;
import org.jboss.jsr299.tck.spi.StandaloneContainers;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.mock.MockBootstrap;
import org.jboss.webbeans.mock.MockWebBeanDiscovery;

public class StandaloneContainersImpl implements StandaloneContainers
{

   public void deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, Iterable<Class<?>> classes) throws DeploymentException
   {
      deploy(enabledDeploymentTypes, classes, null);
   }

   public void deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, Iterable<Class<?>> classes, Iterable<URL> beansXml) throws DeploymentException
   {
      try
      {
         MockBootstrap bootstrap = new MockBootstrap();
         ManagerImpl manager = bootstrap.getManager();
         if (enabledDeploymentTypes != null)
         {
            manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
         }
         MockWebBeanDiscovery discovery = new MockWebBeanDiscovery();
         discovery.setWebBeanClasses(classes);
         if (beansXml != null)
         {
            discovery.setWebBeansXmlFiles(beansXml);
         }
         bootstrap.setWebBeanDiscovery(discovery);
         bootstrap.boot();
      }
      catch (Exception e)
      {
         throw new DeploymentException("Error deploying beans", e);
      }
   }

   public void deploy(Iterable<Class<?>> classes) throws DeploymentException
   {
      deploy(null, classes, null);
   }

   public void deploy(Iterable<Class<?>> classes, Iterable<URL> beansXml) throws DeploymentException
   {
      deploy(null, classes, beansXml);
   }

}

Support for reading deployment types from beans.xml

git-svn-id: 811cd8a17a8c3c0c263af499002feedd54a892d0@1531 1c488680-804c-0410-94cd-c6b725194a0e


/*
 * (C) YANDEX LLC, 2014-2015
 *
 * The Source Code called "YoctoDB" available at
 * https://bitbucket.org/yandex/yoctodb is subject to the terms of the
 * Mozilla Public License, v. 2.0 (hereinafter referred to as the "License").
 *
 * A copy of the License is also available at http://mozilla.org/MPL/2.0/.
 */

package com.yandex.yoctodb.query.simple;

import com.yandex.yoctodb.query.Condition;
import com.yandex.yoctodb.query.QueryContext;
import com.yandex.yoctodb.query.TermCondition;
import com.yandex.yoctodb.util.mutable.BitSet;
import net.jcip.annotations.Immutable;
import org.jetbrains.annotations.NotNull;

/**
 * Condition negation
 *
 * @author incubos
 */
@Immutable
public final class SimpleNotCondition implements Condition {
    @NotNull
    private final TermCondition delegate;

    public SimpleNotCondition(
            @NotNull
            final TermCondition delegate) {
        this.delegate = delegate;
    }

    @Override
    public boolean set(
            @NotNull
            final QueryContext ctx,
            @NotNull
            final BitSet to) {
        delegate.set(ctx, to);
        return to.inverse();
    }
}

/*
 * (C) YANDEX LLC, 2014-2015
 *
 * The Source Code called "YoctoDB" available at
 * https://bitbucket.org/yandex/yoctodb is subject to the terms of the
 * Mozilla Public License, v. 2.0 (hereinafter referred to as the "License").
 *
 * A copy of the License is also available at http://mozilla.org/MPL/2.0/.
 */

package com.yandex.yoctodb.query.simple;

import com.yandex.yoctodb.query.Condition;
import com.yandex.yoctodb.query.QueryContext;
import com.yandex.yoctodb.util.mutable.BitSet;
import net.jcip.annotations.Immutable;
import org.jetbrains.annotations.NotNull;

/**
 * Condition negation
 *
 * @author incubos
 */
@Immutable
public final class SimpleNotCondition implements Condition {
    @NotNull
    private final Condition delegate;

    public SimpleNotCondition(
            @NotNull
            final Condition delegate) {
        this.delegate = delegate;
    }

    @Override
    public boolean set(
            @NotNull
            final QueryContext ctx,
            @NotNull
            final BitSet to) {
        delegate.set(ctx, to);
        return to.inverse();
    }
}

Allow to use not with general conditions


import java.util.Random;

public class LockContention {
    static Random randomGen = new Random();
    static int NTHREAD = 100;

    static public void main(String args[]) {
        Runnable task = () -> {
            for (int i = 0; i < 10000000; i++)
                randomGen.nextInt(1000);
        };

        Thread threads[] = new Thread[NTHREAD];
        for (int i = 0; i < NTHREAD; i++) {
            threads[i] = new Thread(task);
            threads[i].start();
        }
        try {
            for (Thread t : threads)
                t.join();
        } catch (InterruptedException e) {
            System.err.println("Interrupted: " + e);
        }
    }
}

import java.util.Random;

public class LockContention {
    static Random randomGen = new Random();
    static int NTHREAD = 7;
    static Object lock = new Object();
    static int counter = 0;

    static public void main(String args[]) {
        Runnable task = () -> {
            for (int i = 0; i < 100000; i++)
                synchronized (lock) {
                    try {
                        Thread.sleep(50);
                    } catch (InterruptedException e) {
                        System.err.println("Interrupted sleep: " + e);
                    }
                    counter++;
                }
        };

        Thread threads[] = new Thread[NTHREAD];
        for (int i = 0; i < NTHREAD; i++) {
            threads[i] = new Thread(task);
            threads[i].start();
        }
        try {
            for (Thread t : threads)
                t.join();
        } catch (InterruptedException e) {
            System.err.println("Interrupted join: " + e);
        }
    }
}

Use sleep rather than Random

Use sleep rather than Random


package com.gentics.mesh.test.docker;

import java.nio.charset.Charset;
import java.time.Duration;
import java.util.Collections;

import org.apache.commons.io.IOUtils;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.Wait;
import org.testcontainers.images.builder.ImageFromDockerfile;

/**
 * Testcontainer for a non-clustered Elasticsearch instance.
 */
public class ElasticsearchContainer extends GenericContainer<ElasticsearchContainer> {

	public static final String VERSION = "6.3.1";

	public ElasticsearchContainer(boolean withIngestPlugin) {
		super(prepareDockerImage(withIngestPlugin));
	}

	private static ImageFromDockerfile prepareDockerImage(boolean withIngestPlugin) {
		try {
			ImageFromDockerfile dockerImage = new ImageFromDockerfile("elasticsearch", false);
			String dockerFile = IOUtils.toString(ElasticsearchContainer.class.getResourceAsStream("/elasticsearch/Dockerfile.ingest"),
				Charset.defaultCharset());
			dockerFile = dockerFile.replace("%VERSION%", VERSION);
			if (!withIngestPlugin) {
				dockerFile = dockerFile.replace("RUN", "#RUN");
			}
			dockerImage.withFileFromString("Dockerfile", dockerFile);
			return dockerImage;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

	@Override
	protected void configure() {
		addEnv("discovery.type", "single-node");
		withTmpFs(Collections.singletonMap("/usr/share/elasticsearch/data", "rw,size=64m"));
		// addEnv("xpack.security.enabled", "false");
		withExposedPorts(9200);
		withStartupTimeout(Duration.ofSeconds(250L));
		waitingFor(Wait.forHttp("/"));
	}

}

package com.gentics.mesh.test.docker;

import java.time.Duration;
import java.util.Collections;

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;

/**
 * Testcontainer for a non-clustered Elasticsearch instance.
 */
public class ElasticsearchContainer extends GenericContainer<ElasticsearchContainer> {

	public static final String VERSION = "6.6.1";

	public ElasticsearchContainer(boolean withIngestPlugin) {
		super(withIngestPlugin ? "jotschi/elasticsearch-ingest:" + VERSION : "docker.elastic.co/elasticsearch/elasticsearch-oss:" + VERSION);
	}

	@Override
	protected void configure() {
		addEnv("discovery.type", "single-node");
		withTmpFs(Collections.singletonMap("/usr/share/elasticsearch/data", "rw,size=64m"));
		// addEnv("xpack.security.enabled", "false");
		withExposedPorts(9200);
		withStartupTimeout(Duration.ofSeconds(250L));
		waitingFor(new HttpWaitStrategy().forPath("/"));
	}

}

Use pre-build docker image for ES and bump ES version to 6.6.1


#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package};

import edu.pdx.cs410J.web.HttpRequestHelper;

import java.io.IOException;

/**
 * A helper class for accessing the rest client
 */
public class AirlineRestClient extends HttpRequestHelper
{
    private static final String WEB_APP = "${artifactId}";
    private static final String SERVLET = "flights";

    private final String url;

    /**
     * Creates a client to the airline REST service running on the given host and port
     * @param hostName The name of the host
     * @param port The port
     */
    public AirlineRestClient( String hostName, int port )
    {
        this.url = String.format( "http://%s:%d/%s/%s", hostName, port, WEB_APP, SERVLET );
    }

    /**
     * Returns all keys and values from the server
     */
    public Response getAllKeysAndValues() throws IOException
    {
        return get(this.url );
    }

    /**
     * Returns all values for the given key
     */
    public Response getValues( String key ) throws IOException
    {
        return get(this.url, "key", key);
    }

    public Response addKeyValuePair( String key, String value ) throws IOException
    {
        return post( this.url, "key", key, "value", value );
    }
}

#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package};

import edu.pdx.cs410J.web.HttpRequestHelper;

import java.io.IOException;

/**
 * A helper class for accessing the rest client.  Note that this class provides
 * an example of how to make gets and posts to a URL.  You'll need to change it
 * to do something other than just send key/value pairs.
 */
public class AirlineRestClient extends HttpRequestHelper
{
    private static final String WEB_APP = "${artifactId}";
    private static final String SERVLET = "flights";

    private final String url;

    /**
     * Creates a client to the airline REST service running on the given host and port
     * @param hostName The name of the host
     * @param port The port
     */
    public AirlineRestClient( String hostName, int port )
    {
        this.url = String.format( "http://%s:%d/%s/%s", hostName, port, WEB_APP, SERVLET );
    }

    /**
     * Returns all keys and values from the server
     */
    public Response getAllKeysAndValues() throws IOException
    {
        return get(this.url );
    }

    /**
     * Returns all values for the given key
     */
    public Response getValues( String key ) throws IOException
    {
        return get(this.url, "key", key);
    }

    public Response addKeyValuePair( String key, String value ) throws IOException
    {
        return post( this.url, "key", key, "value", value );
    }
}

Add a comment instructing the student to make changes to this code.


package devopsdistilled.operp.client.abstracts;

import devopsdistilled.operp.client.items.exceptions.EntityNameExistsException;
import devopsdistilled.operp.client.items.exceptions.NullFieldException;
import devopsdistilled.operp.server.data.entity.Entiti;

public interface CreateEntityPaneController<E extends Entiti<?>> extends
		SubTaskPaneController {

	public void validate(E entity) throws NullFieldException,
			EntityNameExistsException;

	public E save(E entity);

}

package devopsdistilled.operp.client.abstracts;

import devopsdistilled.operp.server.data.entity.Entiti;

public interface CreateEntityPaneController<E extends Entiti<?>> extends
		SubTaskPaneController {

	public void validate(E entity) throws Exception;

	public E save(E entity);

}

Change validate() signature (i.e throws Exception)

OPEN - task 66: Update Item functionalities implementation
http://github.com/DevOpsDistilled/OpERP/issues/issue/66


package com.indeed.flamdex.simple;

/**
 * @author vladimir
 */

public class StringToIntTermIterator implements SimpleIntTermIterator  {
    private final SimpleStringTermIterator stringTermIterator;

    public StringToIntTermIterator(SimpleStringTermIterator stringTermIterator) {
        this.stringTermIterator = stringTermIterator;
    }

    @Override
    public void reset(long term) {
        stringTermIterator.reset(String.valueOf(term));
    }

    @Override
    public long term() {
        try {
            return Long.valueOf(stringTermIterator.term());
        } catch(NumberFormatException ignored) {
            return 0;
        }
    }

    @Override
    public String getFilename() {
        return stringTermIterator.getFilename();
    }

    @Override
    public long getOffset() {
        return stringTermIterator.getOffset();
    }

    @Override
    public boolean next() {
        return stringTermIterator.next();
    }

    @Override
    public int docFreq() {
        return stringTermIterator.docFreq();
    }

    @Override
    public void close() {
        stringTermIterator.close();
    }
}

package com.indeed.flamdex.simple;

/**
 * @author vladimir
 */

public class StringToIntTermIterator implements SimpleIntTermIterator  {
    private final SimpleStringTermIterator stringTermIterator;

    public StringToIntTermIterator(SimpleStringTermIterator stringTermIterator) {
        this.stringTermIterator = stringTermIterator;
    }

    @Override
    public void reset(long term) {
        stringTermIterator.reset(String.valueOf(term));
    }

    @Override
    public long term() {
        try {
            return Long.parseLong(stringTermIterator.term());
        } catch(NumberFormatException ignored) {
            return 0;
        }
    }

    @Override
    public String getFilename() {
        return stringTermIterator.getFilename();
    }

    @Override
    public long getOffset() {
        return stringTermIterator.getOffset();
    }

    @Override
    public boolean next() {
        return stringTermIterator.next();
    }

    @Override
    public int docFreq() {
        return stringTermIterator.docFreq();
    }

    @Override
    public void close() {
        stringTermIterator.close();
    }
}

IMTEPD-155: Use Long.parseLong() instead of Long.valueOf()


package org.theultimatedeployer.enforcer.editorconfig.check;

/**
 * Created by chris on 20.09.16.
 */
public class EOLCheckConfig implements CheckConfig{

  public static final int SYSTEM = 0;

  public static final int UNIX = 1;

  public static final int WINDOWS = 2;

  // MAC OS X now uses UNIX -> old apple ;-)
  public static final int OLD_APPLE = 3;

  int plattform;

  public EOLCheckConfig(final String configVal) {
    if ("system".equalsIgnoreCase(configVal)) {
      plattform = SYSTEM;
    } else if ("LF".equalsIgnoreCase(configVal)) {
      plattform = UNIX;
    } else if ("CRLF".equalsIgnoreCase(configVal)){
      plattform = WINDOWS;
    }
  }

  public boolean isWindows() {
    return plattform == WINDOWS;
  }

  public boolean isUnix() {
    return plattform == UNIX;
  }

  public boolean isOldApple() {
    return plattform == OLD_APPLE;
  }

  public void setUnix() {
    plattform = UNIX;
  }

  public void setWindows() {
    plattform = WINDOWS;
  }

  public void setOldApple() {
    plattform = OLD_APPLE;
  }
}

package org.theultimatedeployer.enforcer.editorconfig.check;

/**
 * Created by chris on 20.09.16.
 */
public class EOLCheckConfig implements CheckConfig{

  public static final int SYSTEM = 0;

  public static final int UNIX = 1;

  public static final int WINDOWS = 2;

  // MAC OS X now uses UNIX -> old apple ;-)
  public static final int OLD_APPLE = 3;

  int plattform;

  public EOLCheckConfig(final String configVal) {
    if ("system".equalsIgnoreCase(configVal) || "os".equalsIgnoreCase(configVal)) {
      plattform = SYSTEM;
    } else if ("LF".equalsIgnoreCase(configVal)) {
      plattform = UNIX;
    } else if ("CRLF".equalsIgnoreCase(configVal)){
      plattform = WINDOWS;
    }
  }

  public boolean isWindows() {
    return plattform == WINDOWS;
  }

  public boolean isUnix() {
    return plattform == UNIX;
  }

  public boolean isOldApple() {
    return plattform == OLD_APPLE;
  }

  public void setUnix() {
    plattform = UNIX;
  }

  public void setWindows() {
    plattform = WINDOWS;
  }

  public void setOldApple() {
    plattform = OLD_APPLE;
  }
}

Use "os" as valid constant for SYSTEM EOL check


package io.quarkus.agroal.runtime;

import java.util.Map;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;

@ConfigRoot(name = "datasource", phase = ConfigPhase.RUN_TIME)
public class AgroalRuntimeConfig {

    /**
     * The default datasource.
     */
    @ConfigItem(name = ConfigItem.PARENT)
    public DataSourceRuntimeConfig defaultDataSource;

    /**
     * Additional datasources.
     */
    @ConfigItem(name = ConfigItem.PARENT)
    public Map<String, DataSourceRuntimeConfig> namedDataSources;
}

package io.quarkus.agroal.runtime;

import java.util.Map;

import io.quarkus.runtime.annotations.ConfigDocMapKey;
import io.quarkus.runtime.annotations.ConfigDocSection;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;

@ConfigRoot(name = "datasource", phase = ConfigPhase.RUN_TIME)
public class AgroalRuntimeConfig {

    /**
     * The default datasource.
     */
    @ConfigItem(name = ConfigItem.PARENT)
    public DataSourceRuntimeConfig defaultDataSource;

    /**
     * Additional named datasources.
     */
    @ConfigItem(name = ConfigItem.PARENT)
    @ConfigDocMapKey("datasource-name")
    @ConfigDocSection
    public Map<String, DataSourceRuntimeConfig> namedDataSources;
}

Tweak Agroal configuration reference documentation


package net.happygiraffe.jslint;

/**
 * @author dom
 * @version $Id$
 */
public enum Option {
    ADSAFE   ("if use of some browser features should be restricted"),
    BITWISE  ("if bitwise operators should not be allowed"),
    BROWSER  ("if the standard browser globals should be predefined"),
    CAP      ("if upper case HTML should be allowed"),
    DEBUG    ("if debugger statements should be allowed"),
    EQEQEQ   ("if === should be required"),
    EVIL     ("if eval should be allowed"),
    FRAGMENT ("if HTML fragments should be allowed"),
    LAXBREAK ("if line breaks should not be checked"),
    NOMEN    ("if names should be checked"),
    PASSFAIL ("if the scan should stop on first error"),
    PLUSPLUS ("if increment/decrement should not be allowed"),
    RHINO    ("if the Rhino environment globals should be predefined"),
    UNDEF    ("if undefined variables are errors"),
    WHITE    ("if strict whitespace rules apply"),
    WIDGET   ("if the Yahoo Widgets globals should be predefined");

    private String description;

    Option(String description) {
        this.description = description;
    }

    /**
     * Return a description of what this option affects.
     */
    public String getDescription() {
        return description;
    }

    /**
     * Return the lowercase name of this option.
     */
    public String getLowerName() {
        return name().toLowerCase();
    }

    /**
     * Provide a JavaScript form of this option.
     */
    @Override
    public String toString() {
        return getLowerName() + ":true";
    }
}

package net.happygiraffe.jslint;

/**
 * @author dom
 * @version $Id$
 */
public enum Option {
    ADSAFE   ("if use of some browser features should be restricted"),
    BITWISE  ("if bitwise operators should not be allowed"),
    BROWSER  ("if the standard browser globals should be predefined"),
    CAP      ("if upper case HTML should be allowed"),
    DEBUG    ("if debugger statements should be allowed"),
    EQEQEQ   ("if === should be required"),
    EVIL     ("if eval should be allowed"),
    FRAGMENT ("if HTML fragments should be allowed"),
    LAXBREAK ("if line breaks should not be checked"),
    NOMEN    ("if names should be checked"),
    PASSFAIL ("if the scan should stop on first error"),
    PLUSPLUS ("if increment/decrement should not be allowed"),
    RHINO    ("if the Rhino environment globals should be predefined"),
    UNDEF    ("if undefined variables are errors"),
    WHITE    ("if strict whitespace rules apply"),
    WIDGET   ("if the Yahoo Widgets globals should be predefined");

    private String description;

    Option(String description) {
        this.description = description;
    }

    /**
     * Return a description of what this option affects.
     */
    public String getDescription() {
        return description;
    }

    /**
     * Return the lowercase name of this option.
     */
    public String getLowerName() {
        return name().toLowerCase();
    }

    /**
     * Provide a JavaScript form of this option.
     */
    @Override
    public String toString() {
        return getLowerName() + "[" + getDescription() + "]";
    }
}

Make toString include the description, which may be helpful.


package com.biotronisis.pettplant.type;

/**
 * Created by john on 6/16/15.
 */
public enum EntrainmentMode {

   oldMEDITATE(0),
   oldSLEEP(1),
   oldSTAY_AWAKE(2);

   // Run/Stop button values
//   public static final String RUN = "Run";
//   public static final String STOP = "Stop";

   // Pause/Resume button values
//   public static final String PAUSE = "Pause";
//   public static final String RESUME = "Resume";

   // Loop checkbox values
//   public static final String LOOP_OFF = "Off";
//   public static final String LOOP_ON = "On";
//
//   public static final boolean LOOP_CHECKBOX_DEFAULT = false;

   private int id;

   EntrainmentMode(int id) {
      this.id = id;
   }

//   public int getValue() {
//      return id;
//   }
//
//   public int getId() {
//      return id;
//   }
//
//   public static EntrainmentMode getEntrainmentMode(int id) {
//      return EntrainmentMode.values()[id];
//   }
}

package com.biotronisis.pettplant.type;

//public enum EntrainmentMode {

//   oldMEDITATE(0),
//   oldSLEEP(1),
//   oldSTAY_AWAKE(2);

   // Run/Stop button values
//   public static final String RUN = "Run";
//   public static final String STOP = "Stop";

   // Pause/Resume button values
//   public static final String PAUSE = "Pause";
//   public static final String RESUME = "Resume";

   // Loop checkbox values
//   public static final String LOOP_OFF = "Off";
//   public static final String LOOP_ON = "On";
//
//   public static final boolean LOOP_CHECKBOX_DEFAULT = false;

//   private int id;

//   EntrainmentMode(int id) {
//      this.id = id;
//   }

//   public int getValue() {
//      return id;
//   }
//
//   public int getId() {
//      return id;
//   }
//
//   public static EntrainmentMode getEntrainmentMode(int id) {
//      return EntrainmentMode.values()[id];
//   }
//}

Delete auto generated comments. Comment out the entire file.


package com.box.androidsdk.content.models;

/**
 * A class representing list of BoxRecentItem's
 */
public class BoxIteratorRecentItems extends BoxIterator<BoxRecentItem> {
    private static final long serialVersionUID = -2642748896882484555L;

    private transient BoxJsonObjectCreator<BoxRecentItem> representationCreator;

    @Override
    protected BoxJsonObjectCreator<BoxRecentItem> getObjectCreator() {
        if (representationCreator != null){
            return representationCreator;
        }
        representationCreator = BoxJsonObject.getBoxJsonObjectCreator(BoxRecentItem.class);
        return representationCreator;
    }
}

package com.box.androidsdk.content.models;

import com.eclipsesource.json.JsonObject;

/**
 * A class representing list of BoxRecentItem's
 */
public class BoxIteratorRecentItems extends BoxIterator<BoxRecentItem> {
    private static final long serialVersionUID = -2642748896882484555L;

    private transient BoxJsonObjectCreator<BoxRecentItem> representationCreator;

    public BoxIteratorRecentItems() {
        super();
    }

    public BoxIteratorRecentItems(JsonObject jsonObject) {
        super(jsonObject);
    }

    @Override
    protected BoxJsonObjectCreator<BoxRecentItem> getObjectCreator() {
        if (representationCreator != null){
            return representationCreator;
        }
        representationCreator = BoxJsonObject.getBoxJsonObjectCreator(BoxRecentItem.class);
        return representationCreator;
    }
}

AND-7057: Store the GET response in levelDB and populate the UI

Creating necessary constuctors for BoxIteratorRecentItems


package com.github.onsdigital.babbage.template.handlebars;

import org.junit.Test;

/**
 * Created by bren on 11/08/15.
 */
//TODO:
public class HandlebarsRendererTest {

    @Test
    public void testRenderTemplate() throws Exception {
        new HandlebarsRenderer("","");
    }

    public void testRenderTemplate1() throws Exception {

    }

    public void testInitialize() {

    }
}

package com.github.onsdigital.babbage.template.handlebars;

import org.junit.Test;

/**
 * Created by bren on 11/08/15.
 */
//TODO:
public class HandlebarsRendererTest {

    @Test
    public void testRenderTemplate() throws Exception {
        new HandlebarsRenderer("","", true);
    }

    public void testRenderTemplate1() throws Exception {

    }

    public void testInitialize() {

    }
}

Tweak to fix compile error for now.

Tweak to fix compile error for now.


package org.nusco.narjillos.shared.utilities;

import java.text.DecimalFormat;

/**
 * Formats numbers for pretty printing.
 *
 * For example, 2000 becomes 2K, 1200000 becomes 1.2M, and so on.
 */
public class NumberFormat {

	private final static DecimalFormat THOUSANDS_FORMAT = new DecimalFormat("##.#K");
	private final static DecimalFormat MILLIONS_FORMAT = new DecimalFormat("#.##M");

	public static String format(long number) {
		if (number < 1_000)
			return String.valueOf(number);

		if (number < 999_999) {
			double thousands = (double) number / 1000;
			return THOUSANDS_FORMAT.format(thousands);
		}

		double millions = (double) number / 1_000_000;
		return MILLIONS_FORMAT.format(millions);
	}

	public static String format(double number) {
		// two decimals
		return Double.toString(((long) number * 100) / 100.0);
	}
}

package org.nusco.narjillos.shared.utilities;

import java.text.DecimalFormat;

/**
 * Formats numbers for pretty printing.
 *
 * For example, 2000 becomes 2K, 1200000 becomes 1.2M, and so on.
 */
public class NumberFormat {

	private final static DecimalFormat THOUSANDS_FORMAT = new DecimalFormat("##.#K");
	private final static DecimalFormat MILLIONS_FORMAT = new DecimalFormat("#.##M");

	public static String format(long number) {
		if (number < 1_000)
			return String.valueOf(number);

		if (number < 999_999) {
			double thousands = (double) number / 1000;
			return THOUSANDS_FORMAT.format(thousands);
		}

		double millions = (double) number / 1_000_000;
		return MILLIONS_FORMAT.format(millions);
	}

	public static String format(double number) {
		// two decimals
		return Double.toString(((long) (number * 100)) / 100.0);
	}
}

Fix formatting of doubles in reports

Fix formatting of doubles in reports


package de.retest.recheck.ignore;

import static org.assertj.core.api.Assertions.assertThat;

import java.io.File;
import java.util.List;

import org.junit.jupiter.api.Test;

class SearchFilterFilesTest {

	@Test
	void getDefaultFilterFiles_should_get_all_filter_files_from_classpath() {
		final List<File> defaultFilterFiles = SearchFilterFiles.getDefaultFilterFiles();
		assertThat( defaultFilterFiles.stream().map( File::getName ) ).contains( "positioning.filter",
				"visibility.filter" );
	}
}

package de.retest.recheck.ignore;

import static de.retest.recheck.configuration.ProjectConfiguration.FILTER_FOLDER;
import static de.retest.recheck.configuration.ProjectConfiguration.RETEST_PROJECT_CONFIG_FOLDER;
import static de.retest.recheck.configuration.ProjectConfiguration.RETEST_PROJECT_ROOT;
import static de.retest.recheck.ignore.SearchFilterFiles.FILES_ENDING;
import static org.assertj.core.api.Assertions.assertThat;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import de.retest.recheck.util.junit.jupiter.SystemProperty;

class SearchFilterFilesTest {

	@Test
	void getDefaultFilterFiles_should_get_all_filter_files_from_classpath() {
		final List<File> defaultFilterFiles = SearchFilterFiles.getDefaultFilterFiles();
		assertThat( defaultFilterFiles.stream().map( File::getName ) ).contains( "positioning.filter",
				"visibility.filter" );
	}

	@Test
	@SystemProperty( key = RETEST_PROJECT_ROOT )
	void getProjectFilterFiles_should_only_get_filter_files( @TempDir final Path temp ) throws Exception {
		final Path configFolder = temp.resolve( RETEST_PROJECT_ROOT );
		Files.createDirectory( configFolder );
		final Path retestFolder = configFolder.resolve( RETEST_PROJECT_CONFIG_FOLDER );
		Files.createDirectory( retestFolder );
		final Path filterFolder = retestFolder.resolve( FILTER_FOLDER );
		Files.createDirectory( filterFolder );

		Files.createTempFile( filterFolder, "random", ".ignore" ).toFile();
		final File colorFilter = Files.createTempFile( filterFolder, "color", FILES_ENDING ).toFile();
		final File webFontFilter = Files.createTempFile( filterFolder, "web-font", FILES_ENDING ).toFile();
		System.setProperty( RETEST_PROJECT_ROOT, filterFolder.toString() );

		final List<File> projectFilterFiles = SearchFilterFiles.getProjectFilterFiles();
		assertThat( projectFilterFiles ).allMatch( file -> file.toString().endsWith( FILES_ENDING ) );
		assertThat( projectFilterFiles.stream().map( File::getName ) ).contains( colorFilter.getName().toString(),
				webFontFilter.getName().toString() );
	}
}

Test the behavior of the method

Test the behavior of the method