package org.metaborg.spoofax.eclipse.resource;

import java.util.Collection;

import org.apache.commons.vfs2.Capability;
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.provider.AbstractFileName;
import org.apache.commons.vfs2.provider.AbstractFileSystem;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;

public class EclipseResourceFileSystem extends AbstractFileSystem {
    private final IWorkspaceRoot root;

    public EclipseResourceFileSystem(FileName rootName, FileObject parentLayer, FileSystemOptions fileSystemOptions) {
        super(rootName, parentLayer, fileSystemOptions);
        this.root = ResourcesPlugin.getWorkspace().getRoot();
    }

    @Override protected FileObject createFile(AbstractFileName name) throws Exception {
        return new EclipseResourceFileObject(name, root, this);
    }

    @Override protected void addCapabilities(Collection<Capability> caps) {
        caps.addAll(EclipseResourceProvider.capabilities);
    }
}

package org.metaborg.spoofax.eclipse.resource;

import java.io.File;
import java.io.IOException;
import java.util.Collection;

import org.apache.commons.vfs2.Capability;
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSelector;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.provider.AbstractFileName;
import org.apache.commons.vfs2.provider.AbstractFileSystem;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;

public class EclipseResourceFileSystem extends AbstractFileSystem {
    private final IWorkspaceRoot root;

    public EclipseResourceFileSystem(FileName rootName, FileObject parentLayer, FileSystemOptions fileSystemOptions) {
        super(rootName, parentLayer, fileSystemOptions);
        this.root = ResourcesPlugin.getWorkspace().getRoot();
    }

    @Override protected FileObject createFile(AbstractFileName name) throws Exception {
        return new EclipseResourceFileObject(name, root, this);
    }

    @Override protected void addCapabilities(Collection<Capability> caps) {
        caps.addAll(EclipseResourceProvider.capabilities);
    }

    @Override protected File doReplicateFile(FileObject file, FileSelector selector) throws Exception {
        final EclipseResourceFileObject eclipseResource = (EclipseResourceFileObject) file;
        final IResource resource = eclipseResource.resource();
        if(resource == null) {
            throw new IOException("Cannot get Eclipse resource corresponding to " + file);
        }
        IPath path = resource.getRawLocation();
        if(path == null) {
            path = resource.getLocation();
        }
        if(path == null) {
            throw new IOException("Resource " + file + " does not reside on the local file system");
        }
        return path.makeAbsolute().toFile();
    }
}

Implement local file replication for the Eclipse file system.


package testCal;

import static org.junit.Assert.*;
import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import cal.InputHandler;

public class InputHandlerTest {

  private InputHandler inputHandler;

  @Before
  public void setUp() throws Exception {
    inputHandler = new InputHandler();

  }

  @After
  public void tearDown() throws Exception {
    inputHandler = null;
  }

  @Test
  public void testIsExpression1() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("1");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression2() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("10+1-1*100/10");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression3() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("(1+22)*3");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression4() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("(-1)-1");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression5() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("2.11*3.99999");
    assertEquals(expected, actual);
  }

}

package testCal;

import static org.junit.Assert.*;
import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import cal.InputHandler;

public class InputHandlerTest {

  private InputHandler inputHandler;

  @Before
  public void setUp() throws Exception {
    inputHandler = new InputHandler();

  }

  @After
  public void tearDown() throws Exception {
    inputHandler = null;
  }

  @Test
  public void testIsExpression1() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("1");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression2() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("10+1-1*100/10");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression3() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("(1+22)*3");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression4() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("(-1)-1");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression5() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("2.11*3.99999");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression6() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("1*(22+3.33)");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression7() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("1*(2+3)");
    assertEquals(expected, actual);
  }
}

Add test case for input handler where it cannot pass


package xyz.brassgoggledcoders.steamagerevolution.modules.steam.tileentities;

import javax.annotation.Nonnull;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import xyz.brassgoggledcoders.steamagerevolution.utils.RenderUtil;

public class TileEntityCastingBenchRenderer extends TileEntitySpecialRenderer<TileEntityCastingBench> {

	protected static Minecraft mc = Minecraft.getMinecraft();

	@Override
	public void renderTileEntityFast(@Nonnull TileEntityCastingBench tile, double x, double y, double z,
			float partialTicks, int destroyStage, float partial, net.minecraft.client.renderer.BufferBuilder buffer) {
		FluidTank tank = tile.tank;
		FluidStack liquid = tank.getFluid();

		if(liquid != null) {

			float height = ((float) liquid.amount) / (float) tank.getCapacity();

			float d = RenderUtil.FLUID_OFFSET;
			RenderUtil.renderFluidCuboid(liquid, tile.getPos(), x, y, z, d, d + 0.2F, d, 1d - d, height - d, 1d - d);
		}
	}
}

package xyz.brassgoggledcoders.steamagerevolution.modules.steam.tileentities;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import xyz.brassgoggledcoders.steamagerevolution.utils.RenderUtil;

public class TileEntityCastingBenchRenderer extends TileEntitySpecialRenderer<TileEntityCastingBench> {

	protected static Minecraft mc = Minecraft.getMinecraft();

	@Override
	public void render(TileEntityCastingBench tile, double x, double y, double z, float partialTicks, int destroyStage,
			float alpha) {
		FluidTank tank = tile.tank;
		FluidStack liquid = tank.getFluid();

		if(liquid != null) {

			float height = ((float) liquid.amount) / (float) tank.getCapacity();

			float d = RenderUtil.FLUID_OFFSET;
			RenderUtil.renderFluidCuboid(liquid, tile.getPos(), x, y, z, d, d + 0.2F, d, 1d - d, height - d, 1d - d);
		}
	}
}

Fix 'casting bench' fluid rendering


/*******************************************************************************
 * Copyright 2012-present Pixate, Inc.
 *
 * 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 com.pixate.freestyle;

/**
 * Holds version information. This info, for example, is being used with the
 * pings.
 *
 * @author Shalom Gibly
 */
public interface Version {
    public static String PIXATE_FREESTYLE_VERSION = "0.3.2";
    public static int PIXATE_FREESTYLE_API_VERSION = 2;
}

/*******************************************************************************
 * Copyright 2012-present Pixate, Inc.
 *
 * 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 com.pixate.freestyle;

/**
 * Holds version information. This info, for example, is being used with the
 * pings.
 *
 * @author Shalom Gibly
 */
public interface Version {
    public static String PIXATE_FREESTYLE_VERSION = "0.3.3";
    public static int PIXATE_FREESTYLE_API_VERSION = 2;
}

Update freestyle version to 0.3.3.


package embl.ebi.variation.commons.models.converters.data;

import org.springframework.core.convert.converter.Converter;
import com.mongodb.DBObject;
import org.opencb.biodata.models.variant.Variant;

/**
 * Created by tom on 21/09/16.
 */
public class VariantWriteConverter implements Converter<Variant, DBObject> {

    @Override
    public DBObject convert(Variant variant) {
        return null;
    }

}

package embl.ebi.variation.commons.models.converters.data;

import org.opencb.opencga.storage.mongodb.variant.DBObjectToVariantConverter;
import org.springframework.core.convert.converter.Converter;
import com.mongodb.DBObject;
import org.opencb.biodata.models.variant.Variant;

/**
 * Created by tom on 21/09/16.
 */
public class VariantWriteConverter implements Converter<Variant, DBObject> {

    @Override
    public DBObject convert(Variant variant) {
        DBObjectToVariantConverter dbObjectToVariantConverter = new DBObjectToVariantConverter();
        return dbObjectToVariantConverter.convertToStorageType(variant);
    }

}

Convert by wrapping DBObjectToVariantConverter for variant to dbobject


/*
 * 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.flink.streaming.connectors.kafka;

/**
 * IT cases for the {@link FlinkKafkaProducer09}.
 */
@SuppressWarnings("serial")
public class Kafka09ProducerITCase extends KafkaProducerTestBase {
	@Override
	public void testExactlyOnceRegularSink() throws Exception {
		// Kafka08 does not support exactly once semantic
	}

	@Override
	public void testExactlyOnceCustomOperator() throws Exception {
		// Kafka08 does not support exactly once semantic
	}

	@Override
	public void testOneToOneAtLeastOnceCustomOperator() throws Exception {
		// Disable this test since FlinkKafka09Producer doesn't support custom operator mode
	}
}

/*
 * 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.flink.streaming.connectors.kafka;

/**
 * IT cases for the {@link FlinkKafkaProducer09}.
 */
@SuppressWarnings("serial")
public class Kafka09ProducerITCase extends KafkaProducerTestBase {
	@Override
	public void testExactlyOnceRegularSink() throws Exception {
		// Kafka09 does not support exactly once semantic
	}

	@Override
	public void testExactlyOnceCustomOperator() throws Exception {
		// Kafka09 does not support exactly once semantic
	}

	@Override
	public void testOneToOneAtLeastOnceRegularSink() throws Exception {
		// For some reasons this test is sometimes failing in Kafka09 while the same code works in Kafka010. Disabling
		// this test because everything indicates those failures might be caused by unfixed bugs in Kafka 0.9 branch
	}

	@Override
	public void testOneToOneAtLeastOnceCustomOperator() throws Exception {
		// Disable this test since FlinkKafka09Producer doesn't support custom operator mode
	}
}

Disable at-least-once tests for Kafka 0.9


package io.scalecube.services.api;

import java.util.Objects;

public class Address {
  private final String host;
  private final int port;

  public static Address create(String host, int port) {
    return new Address(host, port);
  }

  private Address(String host, int port) {
    this.host = host;
    this.port = port;
  }

  public String host() {
    return this.host;
  }

  public int port() {
    return this.port;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Address address = (Address) o;
    return port == address.port && Objects.equals(host, address.host);
  }

  @Override
  public int hashCode() {
    return Objects.hash(host, port);
  }

  @Override
  public String toString() {
    return this.host + ":" + this.port;
  }
}

package io.scalecube.services.api;

import java.util.Objects;

public class Address {

  private final String host;
  private final int port;

  private Address(String host, int port) {
    this.host = host;
    this.port = port;
  }

  /**
   * Create address.
   *
   * @param host host
   * @param port port
   * @return address
   */
  public static Address create(String host, int port) {
    return new Address(host, port);
  }

  /**
   * Create address.
   *
   * @param hostAndPort host:port
   * @return address
   */
  public static Address from(String hostAndPort) {
    String[] split = hostAndPort.split(":");
    if (split.length != 2) {
      throw new IllegalArgumentException();
    }
    String host = split[0];
    int port = Integer.parseInt(split[1]);
    return new Address(host, port);
  }

  public String host() {
    return this.host;
  }

  public int port() {
    return this.port;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Address address = (Address) o;
    return port == address.port && Objects.equals(host, address.host);
  }

  @Override
  public int hashCode() {
    return Objects.hash(host, port);
  }

  @Override
  public String toString() {
    return this.host + ":" + this.port;
  }
}

Set convenient .from method in address


package com.axellience.vuegwtdemo.client;

import com.axellience.vuegwt.client.gwtextension.VueGwtPanel;
import com.axellience.vuegwt.client.jsnative.Vue;
import com.axellience.vuegwtdemo.client.components.counterwithtemplate.CounterWithTemplateComponent;
import com.axellience.vuegwtdemo.client.components.todolist.TodoListComponent;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define onModuleLoad()
 */
public class VueGwtDemoApp implements EntryPoint
{
    /**
     * This is the entry point method.
     */
    public void onModuleLoad()
    {
        // Create a simple GWT panel containing a CounterWithTemplateComponent
        RootPanel
            .get("simpleCounterComponentContainer")
            .add(new VueGwtPanel(CounterWithTemplateComponent.class));

        Vue.attach("#todoListComponentContainer", TodoListComponent.class);
    }
}

package com.axellience.vuegwtdemo.client;

import com.axellience.vuegwt.client.gwtextension.VueGwtPanel;
import com.axellience.vuegwt.client.jsnative.Vue;
import com.axellience.vuegwtdemo.client.components.counterwithtemplate.CounterWithTemplateComponent;
import com.axellience.vuegwtdemo.client.components.todolist.TodoListComponent;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define onModuleLoad()
 */
public class VueGwtDemoApp implements EntryPoint
{
    /**
     * This is the entry point method.
     */
    public void onModuleLoad()
    {
        // Create a simple GWT panel containing a CounterWithTemplateComponent
        RootPanel
            .get("simpleCounterComponentContainer")
            .add(new VueGwtPanel<>(CounterWithTemplateComponent.class));

        Vue.attach("#todoListComponentContainer", TodoListComponent.class);
    }
}

Fix VueGwtPanel not being typed in the Demo app


package org.wildfly.swarm.it.vaadin;

import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.wildfly.swarm.it.AbstractIntegrationTest;

import static org.fest.assertions.Assertions.assertThat;

/**
 * @author Bob McWhirter
 */
@RunWith(Arquillian.class)
public class VaadinApplicationIT extends AbstractIntegrationTest {

    @Drone
    PhantomJSDriver browser;

    @Test
    public void testIt() throws Exception {
        browser.manage().window().setSize( new Dimension(1024, 768));
        browser.navigate().to("http://localhost:8080/");

        browser.findElementByClassName( "v-button" ).click();
        WebElement notification = browser.findElementByClassName("v-Notification");

        assertThat( notification.getText() ).contains( "Howdy at" );
    }
}

package org.wildfly.swarm.it.vaadin;

import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.wildfly.swarm.it.AbstractIntegrationTest;

import static org.fest.assertions.Assertions.assertThat;

/**
 * @author Bob McWhirter
 */
//@RunWith(Arquillian.class)
public class VaadinApplicationIT extends AbstractIntegrationTest {

    @Drone
    PhantomJSDriver browser;

    //disabled until SWARM-249
    //@Test
    public void testIt() throws Exception {
        browser.manage().window().setSize( new Dimension(1024, 768));
        browser.navigate().to("http://localhost:8080/");

        browser.findElementByClassName( "v-button" ).click();
        WebElement notification = browser.findElementByClassName("v-Notification");

        assertThat( notification.getText() ).contains( "Howdy at" );
    }
}

Disable Vaadin test until SWARM-249 is resolved.


package org.opennms.netmgt.dao.db;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class PopulatedTemporaryDatabaseTestCase extends
        TemporaryDatabaseTestCase {

    private InstallerDb installerDb;

    private ByteArrayOutputStream m_outputStream;

    protected void setUp() throws Exception {
        super.setUp();

        initializeDatabase();
    }

    protected void initializeDatabase() throws Exception {
        if (!isEnabled()) {
            return;
        }

        installerDb = new InstallerDb();

        // Create a ByteArrayOutputSteam to effectively throw away output.
        resetOutputStream();
        installerDb.setDatabaseName(getTestDatabase());
        installerDb.setDataSource(getDataSource());

        installerDb.setCreateSqlLocation(
            "../opennms-daemon/src/main/filtered/etc/create.sql");

        installerDb.setStoredProcedureDirectory(
            "../opennms-daemon/src/main/filtered/etc");

        //installerDb.setDebug(true);

        installerDb.readTables();

        installerDb.createSequences();
        installerDb.updatePlPgsql();
        installerDb.addStoredProcedures();

        installerDb.createTables();

        installerDb.closeConnection();
    }

    public ByteArrayOutputStream getOutputStream() {
        return m_outputStream;
    }

    public void resetOutputStream() {
        m_outputStream = new ByteArrayOutputStream();
        installerDb.setOutputStream(new PrintStream(m_outputStream));
    }
}

package org.opennms.netmgt.dao.db;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class PopulatedTemporaryDatabaseTestCase extends
        TemporaryDatabaseTestCase {

    private InstallerDb m_installerDb;

    private ByteArrayOutputStream m_outputStream;

    protected void setUp() throws Exception {
        super.setUp();

        initializeDatabase();
    }

    protected void initializeDatabase() throws Exception {
        if (!isEnabled()) {
            return;
        }

        m_installerDb = new InstallerDb();

        // Create a ByteArrayOutputSteam to effectively throw away output.
        resetOutputStream();
        m_installerDb.setDatabaseName(getTestDatabase());
        m_installerDb.setDataSource(getDataSource());

        m_installerDb.setCreateSqlLocation(
            "../opennms-daemon/src/main/filtered/etc/create.sql");

        m_installerDb.setStoredProcedureDirectory(
            "../opennms-daemon/src/main/filtered/etc");

        //installerDb.setDebug(true);

        m_installerDb.readTables();

        m_installerDb.createSequences();
        m_installerDb.updatePlPgsql();
        m_installerDb.addStoredProcedures();

        m_installerDb.createTables();

        m_installerDb.closeConnection();
    }

    public ByteArrayOutputStream getOutputStream() {
        return m_outputStream;
    }

    public void resetOutputStream() {
        m_outputStream = new ByteArrayOutputStream();
        m_installerDb.setOutputStream(new PrintStream(m_outputStream));
    }
}

Fix the name for the installerDb field to match our conventions.


package com.bloatit.framework;

import java.util.Date;

import com.bloatit.framework.right.OfferRight;
import com.bloatit.framework.right.RightManager.Action;
import com.bloatit.model.data.DaoComment;
import com.bloatit.model.data.DaoKudosable;
import com.bloatit.model.data.DaoOffer;

public final class Offer extends Kudosable {

    private final DaoOffer dao;

    public static Offer create(final DaoOffer dao) {
        if (dao == null) {
            return null;
        }
        return new Offer(dao);
    }

    public Offer(final DaoOffer dao) {
        super();
        this.dao = dao;
    }

    public DaoOffer getDao() {
        return dao;
    }

    public Date getDateExpire() {
        return dao.getDateExpire();
    }

    public boolean canSetdatExpire() {
        return new OfferRight.DateExpire().canAccess(calculateRole(this), Action.WRITE);
    }

    public void setDateExpire(final Date dateExpire) {
        new OfferRight.DateExpire().tryAccess(calculateRole(this), Action.WRITE);
        dao.setDateExpire(dateExpire);
    }

    public Demand getDemand() {
        return Demand.create(dao.getDemand());
    }

    public Description getDescription() {
        return new Description(dao.getDescription());
    }

    @Override
    protected DaoKudosable getDaoKudosable() {
        return dao;
    }

}

package com.bloatit.framework;

import java.math.BigDecimal;
import java.util.Date;

import com.bloatit.framework.right.OfferRight;
import com.bloatit.framework.right.RightManager.Action;
import com.bloatit.model.data.DaoComment;
import com.bloatit.model.data.DaoKudosable;
import com.bloatit.model.data.DaoOffer;

public final class Offer extends Kudosable {

    private final DaoOffer dao;

    public static Offer create(final DaoOffer dao) {
        if (dao == null) {
            return null;
        }
        return new Offer(dao);
    }

    public Offer(final DaoOffer dao) {
        super();
        this.dao = dao;
    }

    public DaoOffer getDao() {
        return dao;
    }

    public Date getDateExpire() {
        return dao.getDateExpire();
    }

    public boolean canSetdatExpire() {
        return new OfferRight.DateExpire().canAccess(calculateRole(this), Action.WRITE);
    }

    public void setDateExpire(final Date dateExpire) {
        new OfferRight.DateExpire().tryAccess(calculateRole(this), Action.WRITE);
        dao.setDateExpire(dateExpire);
    }

    public Demand getDemand() {
        return Demand.create(dao.getDemand());
    }

    public Description getDescription() {
        return new Description(dao.getDescription());
    }

    public BigDecimal getAmount() {
        return dao.getAmount();
    }

    @Override
    protected DaoKudosable getDaoKudosable() {
        return dao;
    }

}

Add get amount method in offer


package org.flymine.dataconversion;

/*
 * Copyright (C) 2002-2003 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

 /**
 * Abstract parent class of all DataConverters
 * @author Mark Woodbridge
 */
 public abstract class DataConverter
{
    protected ItemWriter writer;

    /**
    * Constructor that should be called by children
    * @param writer an ItemWriter used to handle the resultant Items
    */
    public DataConverter(ItemWriter writer) {
        this.writer = writer;
    }

    /**
    * Perform the data conversion
    * @throws Exception if an error occurs during processing
    */
    public abstract void process() throws Exception;
}

package org.flymine.dataconversion;

/*
 * Copyright (C) 2002-2003 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import java.util.Map;
import java.util.HashMap;

/**
 * Abstract parent class of all DataConverters
 * @author Mark Woodbridge
 */
 public abstract class DataConverter
{
    protected ItemWriter writer;
    protected Map aliases = new HashMap();
    protected int nextClsId = 0;

    /**
    * Constructor that should be called by children
    * @param writer an ItemWriter used to handle the resultant Items
    */
    public DataConverter(ItemWriter writer) {
        this.writer = writer;
    }

    /**
    * Perform the data conversion
    * @throws Exception if an error occurs during processing
    */
    public abstract void process() throws Exception;

    /**
     * Uniquely alias a className
     * @param className the class name
     * @return the alias
     */
    protected String alias(String className) {
        String alias = (String) aliases.get(className);
        if (alias != null) {
            return alias;
        }
        String nextIndex = "" + (nextClsId++);
        aliases.put(className, nextIndex);
        return nextIndex;
    }
}

Add functionality to alias classes


package com.timgroup.tucker.info.component;

import com.timgroup.tucker.info.Component;
import com.timgroup.tucker.info.Report;
import com.timgroup.tucker.info.Status;

/**
 * Reports version information about the JVM in which this application is running.
 * <p>
 * The version comes from a query of the java system properties.
 *
 * @see java.lang.System#getProperties
 */
public class JvmVersionComponent extends Component {
    public static final String versionInfoString;

    static {
        String basicVersion = System.getProperty("java.version");
        String vendorVersion = System.getProperty("java.vendor.version");
        if (basicVersion.equals("10") || basicVersion.startsWith("10.") || basicVersion.equals("11") || basicVersion.startsWith("11.")) {
            versionInfoString = basicVersion + " (" + vendorVersion + ")";
        }
        else {
            versionInfoString = basicVersion;
        }
    }

    public JvmVersionComponent() {
        super("jvmversion", "JVM Version");
    }

    @Override
    public Report getReport() {
        return new Report(Status.INFO, versionInfoString);
    }

}

package com.timgroup.tucker.info.component;

import com.timgroup.tucker.info.Component;
import com.timgroup.tucker.info.Report;
import com.timgroup.tucker.info.Status;

/**
 * Reports version information about the JVM in which this application is running.
 * <p>
 * The version comes from a query of the java system properties.
 *
 * @see java.lang.System#getProperties
 */
public class JvmVersionComponent extends Component {
    public static final String versionInfoString;

    static {
        String vendorVersion = System.getProperty("java.vendor.version");
        String basicVersion = System.getProperty("java.version");
        if (vendorVersion != null) {
            versionInfoString = basicVersion + " (" + vendorVersion + ")";
        }
        else {
            versionInfoString = basicVersion;
        }
    }

    public JvmVersionComponent() {
        super("jvmversion", "JVM Version");
    }

    @Override
    public Report getReport() {
        return new Report(Status.INFO, versionInfoString);
    }

}

Simplify formatting JVM version and avoid having to configure each new release


package markehme.factionsplus.sublisteners;

import markehme.factionsplus.Utilities;
import markehme.factionsplus.MCore.FPUConf;

import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;

public class PeacefulSubListener {

	public EventFactionsMembershipChange eventFactionsMembershipChange(EventFactionsMembershipChange event) {
		if(event.getReason() != MembershipChangeReason.JOIN) return event;

		double boostValue = FPUConf.get(event.getUSender().getUniverse()).peacefulPowerBoost;

		if(boostValue> 0 && Utilities.isPeaceful(event.getUSender().getFaction())) {
			Utilities.addPower(event.getUSender(), boostValue);
		}

		return event;
	}
}

package markehme.factionsplus.sublisteners;

import markehme.factionsplus.Utilities;
import markehme.factionsplus.MCore.FPUConf;

import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;

public class PeacefulSubListener {

	public EventFactionsMembershipChange eventFactionsMembershipChange(EventFactionsMembershipChange event) {
		if(event.getReason() != MembershipChangeReason.JOIN) return event;

		double boostValue = FPUConf.get(event.getUSender().getUniverse()).peacefulPowerBoost;

		if(boostValue> 0 && (event.getUSender().getFaction().getFlag(FFlag.PEACEFUL))) {
			Utilities.addPower(event.getUSender(), boostValue);
		}

		return event;
	}
}

Check the FFlag instead of the utility


package net.bloople.stories;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

public class NodesAdapter extends RecyclerView.Adapter<NodesAdapter.ViewHolder> {
    private List<Node> nodes;

    public static class ViewHolder extends RecyclerView.ViewHolder {
        public TextView textView;
        public ViewHolder(View view) {
            super(view);
            textView = (TextView)view.findViewById(R.id.text_view);
        }
    }

    public NodesAdapter(List<Node> inNodes) {
        nodes = inNodes;
    }

    // Create new views (invoked by the layout manager)
    @Override
    public NodesAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.node_view, parent,
                false);

        return new ViewHolder(view);
    }

    // Replace the contents of a view (invoked by the layout manager)
    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        TextView tv = holder.textView;

        tv.setText(nodes.get(position).content());

        if(position == 0) {
            tv.setPadding(
                    tv.getPaddingLeft(),
                    tv.getPaddingBottom(),
                    tv.getPaddingRight(),
                    tv.getPaddingBottom()
            );
        }
    }

    // Return the size of your dataset (invoked by the layout manager)
    @Override
    public int getItemCount() {
        return nodes.size();
    }
}

package net.bloople.stories;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

public class NodesAdapter extends RecyclerView.Adapter<NodesAdapter.ViewHolder> {
    private List<Node> nodes;

    public static class ViewHolder extends RecyclerView.ViewHolder {
        public TextView textView;
        public ViewHolder(View view) {
            super(view);
            textView = (TextView)view.findViewById(R.id.text_view);
        }
    }

    public NodesAdapter(List<Node> inNodes) {
        nodes = inNodes;
    }

    // Create new views (invoked by the layout manager)
    @Override
    public NodesAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.node_view, parent,
                false);

        return new ViewHolder(view);
    }

    // Replace the contents of a view (invoked by the layout manager)
    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        TextView tv = holder.textView;

        tv.setText(nodes.get(position).content());

        tv.setPadding(
            tv.getPaddingLeft(),
            (position == 0 ? tv.getPaddingBottom() : 0),
            tv.getPaddingRight(),
            tv.getPaddingBottom()
        );
    }

    // Return the size of your dataset (invoked by the layout manager)
    @Override
    public int getItemCount() {
        return nodes.size();
    }
}

Reset the padding on each TextView when the RecyclerView binds it


package org.wikipedia.json;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.google.gson.reflect.TypeToken;

import org.wikipedia.crash.RemoteLogException;
import org.wikipedia.page.tabs.Tab;
import org.wikipedia.util.log.L;

import java.util.Collections;
import java.util.List;

public final class TabUnmarshaller {
    private static final TypeToken<List<Tab>> TYPE_TOKEN = new TypeToken<List<Tab>>() { };

    @NonNull public static List<Tab> unmarshal(@Nullable String json) {
        List<Tab> object = null;
        try {
            object = GsonUnmarshaller.unmarshal(TYPE_TOKEN, json);
        } catch (Exception e) {
            // Catch all. Any Exception can be thrown when unmarshalling.
            L.logRemoteErrorIfProd(new RemoteLogException(e).put("json", json));
        }
        if (object == null) {
            object = Collections.emptyList();
        }
        return object;
    }

    private TabUnmarshaller() { }
}

package org.wikipedia.json;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.google.gson.reflect.TypeToken;

import org.wikipedia.crash.RemoteLogException;
import org.wikipedia.page.PageBackStackItem;
import org.wikipedia.page.tabs.Tab;
import org.wikipedia.util.log.L;

import java.util.Collections;
import java.util.List;

public final class TabUnmarshaller {
    private static final TypeToken<List<Tab>> TYPE_TOKEN = new TypeToken<List<Tab>>() { };

    @NonNull public static List<Tab> unmarshal(@Nullable String json) {
        List<Tab> object = null;
        try {
            object = GsonUnmarshaller.unmarshal(TYPE_TOKEN, json);
        } catch (Exception e) {
            // Catch all. Any Exception can be thrown when unmarshalling.
            L.logRemoteErrorIfProd(new RemoteLogException(e).put("json", json));
        }
        if (object == null) {
            object = Collections.emptyList();
        }

        // T152980
        // When upgrading from much older versions (namely, 2.1.141 or earlier), the serialized
        // tab list may be in a format that causes WikiSite objects to have null Uri components.
        // If we encounter one of these occurrences, just clear out the entire tab list.
        // to be on the safe side.
        // TODO: Remove when the incidence of this is sufficiently diminished (April 2017?)
        boolean bad = false;
        for (Tab tab : object) {
            for (PageBackStackItem item : tab.getBackStack()) {
                if (TextUtils.isEmpty(item.getTitle().getWikiSite().authority())
                        || TextUtils.isEmpty(item.getHistoryEntry().getTitle().getWikiSite().authority())) {
                    L.logRemoteErrorIfProd(new IllegalArgumentException("Format error in serialized tab list."));
                    bad = true;
                    break;
                }
            }
        }
        if (bad) {
            object.clear();
        }

        return object;
    }

    private TabUnmarshaller() { }
}

Fix possible crash when upgrading from older app versions.


package org.jboss.shamrock.deployment;

import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.shamrock.runtime.RegisterForReflection;

public class RegisterForReflectionProcessor implements ResourceProcessor {
    @Override
    public void process(ArchiveContext archiveContext, ProcessorContext processorContext) throws Exception {
        for (AnnotationInstance i : archiveContext.getCombinedIndex().getAnnotations(DotName.createSimple(RegisterForReflection.class.getName()))) {
            ClassInfo target = i.target().asClass();
            boolean methods = i.value("methods") == null || i.value("methods").asBoolean();
            boolean fields = i.value("fields") == null || i.value("fields").asBoolean();
            processorContext.addReflectiveClass(methods, fields, target.name().toString());
        }
    }

    @Override
    public int getPriority() {
        return 0;
    }
}

package org.jboss.shamrock.deployment;

import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.shamrock.runtime.RegisterForReflection;

public class RegisterForReflectionProcessor implements ResourceProcessor {
    @Override
    public void process(ArchiveContext archiveContext, ProcessorContext processorContext) throws Exception {
        for (AnnotationInstance i : archiveContext.getCombinedIndex().getAnnotations(DotName.createSimple(RegisterForReflection.class.getName()))) {
            ClassInfo target = i.target().asClass();
            boolean methods = i.value("methods") == null || i.value("methods").asBoolean();
            boolean fields = i.value("fields") == null || i.value("fields").asBoolean();
            processorContext.addReflectiveClass(methods, fields, target.name().toString());
        }

        //TODO: where should stuff like this go?
        //this will hold a heap of memory when it is initialized, and is rarely used (but it generally on the analysis path)
        processorContext.addRuntimeInitializedClasses("com.sun.org.apache.xml.internal.serializer.ToHTMLStream");
    }

    @Override
    public int getPriority() {
        return 0;
    }
}

Mark class with memory intensive static init method as init at runtime


package com.thoughtworks.xstream.core.util;

public final class FastStack {

    private Object[] stack;
    private int pointer;

    public FastStack(int initialCapacity) {
        stack = new Object[initialCapacity];
    }

    public Object push(Object value) {
        if (pointer + 1 >= stack.length) {
            resizeStack(stack.length * 2);
        }
        stack[pointer++] = value;
        return value;
    }

    public void popSilently() {
        pointer--;
    }

    public Object pop() {
        return stack[--pointer];
    }

    public Object peek() {
        return pointer == 0 ? null : stack[pointer - 1];
    }

    public int size() {
        return pointer;
    }

    public boolean hasStuff() {
        return pointer > 0;
    }

    public Object get(int i) {
        return stack[i];
    }

    private void resizeStack(int newCapacity) {
        Object[] newStack = new Object[newCapacity];
        System.arraycopy(stack, 0, newStack, 0, Math.min(stack.length, newCapacity));
        stack = newStack;
    }

    public String toString() {
        StringBuffer result = new StringBuffer("[");
        for (int i = 0; i < pointer; i++) {
            if (i > 0) {
                result.append(", ");
            }
            result.append(stack[i]);
        }
        result.append(']');
        return result.toString();
    }
}

package com.thoughtworks.xstream.core.util;

public final class FastStack {

    private Object[] stack;
    private int pointer;

    public FastStack(int initialCapacity) {
        stack = new Object[initialCapacity];
    }

    public Object push(Object value) {
        if (pointer + 1 >= stack.length) {
            resizeStack(stack.length * 2);
        }
        stack[pointer++] = value;
        return value;
    }

    public void popSilently() {
        stack[--pointer] = null;
    }

    public Object pop() {
        final Object result = stack[--pointer];
        stack[pointer] = null;
        return result;
    }

    public Object peek() {
        return pointer == 0 ? null : stack[pointer - 1];
    }

    public int size() {
        return pointer;
    }

    public boolean hasStuff() {
        return pointer > 0;
    }

    public Object get(int i) {
        return stack[i];
    }

    private void resizeStack(int newCapacity) {
        Object[] newStack = new Object[newCapacity];
        System.arraycopy(stack, 0, newStack, 0, Math.min(stack.length, newCapacity));
        stack = newStack;
    }

    public String toString() {
        StringBuffer result = new StringBuffer("[");
        for (int i = 0; i < pointer; i++) {
            if (i > 0) {
                result.append(", ");
            }
            result.append(stack[i]);
        }
        result.append(']');
        return result.toString();
    }
}

Drop unnecessary reference to popped elements to allow finalization through GC (XSTR-264).


package com.koenv.universalminecraftapi.users;

import com.koenv.universalminecraftapi.ErrorCodes;
import com.koenv.universalminecraftapi.UniversalMinecraftAPI;
import com.koenv.universalminecraftapi.http.model.APIException;
import com.koenv.universalminecraftapi.http.model.BaseHttpInvoker;
import com.koenv.universalminecraftapi.methods.APIMethod;
import com.koenv.universalminecraftapi.methods.APINamespace;
import com.koenv.universalminecraftapi.methods.Invoker;
import com.koenv.universalminecraftapi.users.model.User;

import java.util.Collection;

@APINamespace("users")
public class UserMethods {
    @APIMethod
    public static Collection<User> getUsers() {
        return UniversalMinecraftAPI.getInstance().getUserManager().getUsers();
    }

    @APIMethod(operatesOn = User.class)
    public static String getUsername(User user) {
        return user.getUsername();
    }

    @APIMethod
    public static String generateApiKey(Invoker invoker) {
        if (invoker instanceof BaseHttpInvoker) {
            BaseHttpInvoker httpInvoker = (BaseHttpInvoker) invoker;
            return UniversalMinecraftAPI.getInstance().getUserManager().getApiKeyManager().generate(httpInvoker.getUser());
        }
        throw new APIException("Invalid user", ErrorCodes.INVALID_CREDENTIALS);
    }
}

package com.koenv.universalminecraftapi.users;

import com.koenv.universalminecraftapi.ErrorCodes;
import com.koenv.universalminecraftapi.UniversalMinecraftAPI;
import com.koenv.universalminecraftapi.http.model.APIException;
import com.koenv.universalminecraftapi.http.model.BaseHttpInvoker;
import com.koenv.universalminecraftapi.methods.APIMethod;
import com.koenv.universalminecraftapi.methods.APINamespace;
import com.koenv.universalminecraftapi.methods.Invoker;
import com.koenv.universalminecraftapi.users.model.User;

import java.util.Collection;

@APINamespace("users")
public class UserMethods {
    @APIMethod
    public static Collection<User> getUsers() {
        return UniversalMinecraftAPI.getInstance().getUserManager().getUsers();
    }

    @APIMethod(operatesOn = User.class)
    public static String getUsername(User user) {
        return user.getUsername();
    }

    @APIMethod
    public static String generateApiKey(Invoker invoker) {
        if (invoker instanceof BaseHttpInvoker) {
            BaseHttpInvoker httpInvoker = (BaseHttpInvoker) invoker;
            return UniversalMinecraftAPI.getInstance().getUserManager().getApiKeyManager().generate(httpInvoker.getUser());
        }
        throw new APIException("Invalid user", ErrorCodes.INVALID_CREDENTIALS);
    }

    @APIMethod
    public static String getCurrentUser(Invoker invoker) {
        if (invoker instanceof BaseHttpInvoker) {
            BaseHttpInvoker httpInvoker = (BaseHttpInvoker) invoker;
            return httpInvoker.getUser().getUsername();
        }
        throw new APIException("Invalid user", ErrorCodes.INVALID_CREDENTIALS);
    }
}

Allow getting the current authenticated user


package com.rabenauge.gl;

import android.opengl.GLU;
import java.nio.FloatBuffer;
import javax.microedition.khronos.opengles.GL10;

/*
 * A class for various static helper methods.
 */
public class Helper {
    // Vertices and texture coordinates for rendering a bitmap in order LR, LL, UL, UR.
    private static final float w=1, h=1;
    private static final FloatBuffer v=FloatBuffer.allocate(8).put(w).put(h).put(0).put(h).put(0).put(0).put(w).put(0);

    public static void drawScreenSpaceTexture(Texture2D tex) {
        tex.makeCurrent();

        tex.gl.glMatrixMode(GL10.GL_PROJECTION);
        tex.gl.glLoadIdentity();
        GLU.gluOrtho2D(tex.gl, 0, w, h, 0);

        tex.gl.glVertexPointer(2, GL10.GL_FLOAT, 0, v);
        tex.gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, v);

        tex.gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, 4);
    }

    public static void toggleState(GL10 gl, int cap, boolean state) {
        if (state) {
            gl.glEnable(cap);
        }
        else {
            gl.glDisable(cap);
        }
    }
}

package com.rabenauge.gl;

import android.opengl.GLU;
import java.nio.FloatBuffer;
import javax.microedition.khronos.opengles.GL10;

/*
 * A class for various static helper methods.
 */
public class Helper {
    // Vertices and texture coordinates for rendering a bitmap in order LR, LL, UL, UR.
    private static final float w=1, h=1;
    private static final FloatBuffer v=FloatBuffer.allocate(8).put(w).put(h).put(0).put(h).put(0).put(0).put(w).put(0);

    public static void drawScreenSpaceQuad(GL10 gl) {
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        GLU.gluOrtho2D(gl, 0, w, h, 0);

        gl.glVertexPointer(2, GL10.GL_FLOAT, 0, v);
        gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, 4);
    }

    public static void drawScreenSpaceTexture(Texture2D tex) {
        tex.makeCurrent();
        tex.gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, v);

        drawScreenSpaceQuad(tex.gl);
    }

    public static void toggleState(GL10 gl, int cap, boolean state) {
        if (state) {
            gl.glEnable(cap);
        }
        else {
            gl.glDisable(cap);
        }
    }
}

Add a method to draw a screen space aligned (untextured) quad


package org.ow2.proactive.scheduler.common.task;

import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * This class is the super class of the every task that can be integrated in a job.

 * A task contains some properties that can be set but also :

 *
A selection script that can be used to select a specific execution node for this task.

 *
A preScript that will be launched before the real task (can be used to set environment vars).

 *
A postScript that will be launched just after the end of the real task.
 * (this can be used to transfer files that have been created by the task).

 *
A CleaningScript that will be launched by the resource manager to perform some cleaning. (deleting files or resources).

 *

 * You will also be able to add dependences (if necessary) to
 * this task. The dependences mechanism are best describe below.
 *
 * TODO PARAITA update javadoc
 *
 */
@XmlRootElement
public class TaskStatesPage {

    private int size;

    private List<TaskState> taskStates;

    public TaskStatesPage() {

    }

    public TaskStatesPage(List<TaskState> taskStates, int size) {
        this.taskStates = taskStates;
        this.size = size;
    }

    public int getSize() {
        return size;
    }

    public void setSize(final int size) {
        this.size = size;
    }

    public List<TaskState> getTaskStates() {
        return taskStates;
    }

    public void setTaskStates(List<TaskState> taskStates) {
        this.taskStates = taskStates;
    }

    @Override
    public String toString() {
        return "TaskStatePage{" + "size=" + size + ", taskStates='" + taskStates + '\'' + '}';
    }
}

package org.ow2.proactive.scheduler.common.task;

import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * This class holds a paginated list of TaskState
 * server-wise and the total number of tasks.
 *
 */
@XmlRootElement
public class TaskStatesPage {

    private int size;

    private List<TaskState> taskStates;

    public TaskStatesPage() {

    }

    public TaskStatesPage(List<TaskState> taskStates, int size) {
        this.taskStates = taskStates;
        this.size = size;
    }

    public int getSize() {
        return size;
    }

    public void setSize(final int size) {
        this.size = size;
    }

    public List<TaskState> getTaskStates() {
        return taskStates;
    }

    public void setTaskStates(List<TaskState> taskStates) {
        this.taskStates = taskStates;
    }

    @Override
    public String toString() {
        return "TaskStatePage{" + "size=" + size + ", taskStates='" + taskStates + '\'' + '}';
    }
}

Fix javadoc for the TaskStatePage


package com.github.vedenin.thirdpartylib.htmlparser;

import com.github.vedenin.thirdpartylib.annotations.Atom;
import com.github.vedenin.thirdpartylib.annotations.BoilerPlate;
import com.github.vedenin.thirdpartylib.annotations.Contract;
import com.github.vedenin.thirdpartylib.annotations.Reference;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import org.jsoup.nodes.Element;

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

/**
 * Created by vvedenin on 12/16/2016.
 */
@Atom
@Contract("Provide information about HTML pages")
@Reference({ElementAtom.class})
public class DocumentAtom {
    private final Document document;

    @Contract("Should returns elements according this CSS Query")
    public List<ElementAtom> select(String cssQuery) {
        Elements elements = document.select(cssQuery);
        List<ElementAtom> result = new ArrayList<>(elements.size());
        for(Element element: elements) {
            result.add(ElementAtom.getProxy(element));
        }
        return result;
    }

    @Contract("Should returns text from html without any tags")
    public String getText() {
        return document.text();
    }

    // -------------- Just boilerplate code for Atom -----------------
    @BoilerPlate
    private DocumentAtom(Document document) {
        this.document = document;
    }

    @BoilerPlate
    public static DocumentAtom getAtom(Document document) {
        return new DocumentAtom(document);
    }

}

package com.github.vedenin.thirdpartylib.htmlparser;

import com.github.vedenin.thirdpartylib.annotations.Atom;
import com.github.vedenin.thirdpartylib.annotations.BoilerPlate;
import com.github.vedenin.thirdpartylib.annotations.Contract;
import com.github.vedenin.thirdpartylib.annotations.Reference;
import org.jsoup.nodes.Document;
import java.util.ArrayList;
import java.util.List;

import static java.util.stream.Collectors.*;

/**
 * Created by vvedenin on 12/16/2016.
 */
@Atom
@Contract("Provide information about HTML pages")
@Reference({ElementAtom.class})
public class DocumentAtom {
    private final Document document;

    @Contract("Should returns elements according this CSS Query")
    public List<ElementAtom> select(String cssQuery) {
        List<ElementAtom> result = new ArrayList<>();
        result.addAll(document.select(cssQuery).stream().map(ElementAtom::getProxy).collect(toList()));
        return result;
    }

    @Contract("Should returns text from html without any tags")
    public String getText() {
        return document.text();
    }

    // -------------- Just boilerplate code for Atom -----------------
    @BoilerPlate
    private DocumentAtom(Document document) {
        this.document = document;
    }

    @BoilerPlate
    public static DocumentAtom getAtom(Document document) {
        return new DocumentAtom(document);
    }

}

Create atom-proxy for third party libs


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

package com.google.devtools.cdbg.debuglets.java;

/**
 * Defines the version of the Java Cloud Debugger agent.
 */
public final class GcpDebugletVersion {
  /**
   * Major version of the debugger.

   * All agents of the same major version are compatible with each other. In other words an
   * application can mix different agents with the same major version within the same debuggee.
   */
  public static final int MAJOR_VERSION = 2;

  /**
   * Minor version of the agent.
   */
  public static final int MINOR_VERSION = 7;

  /**
   * Debugger agent version string in the format of MAJOR.MINOR.
   */
  public static final String VERSION = String.format("%d.%d", MAJOR_VERSION, MINOR_VERSION);

  /**
   * Main function to print the version string.
   */
  public static void main(String[] args) {
    System.out.println(VERSION);
  }
}

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

package com.google.devtools.cdbg.debuglets.java;

/**
 * Defines the version of the Java Cloud Debugger agent.
 */
public final class GcpDebugletVersion {
  /**
   * Major version of the debugger.

   * All agents of the same major version are compatible with each other. In other words an
   * application can mix different agents with the same major version within the same debuggee.
   */
  public static final int MAJOR_VERSION = 2;

  /**
   * Minor version of the agent.
   */
  public static final int MINOR_VERSION = 8;

  /**
   * Debugger agent version string in the format of MAJOR.MINOR.
   */
  public static final String VERSION = String.format("%d.%d", MAJOR_VERSION, MINOR_VERSION);

  /**
   * Main function to print the version string.
   */
  public static void main(String[] args) {
    System.out.println(VERSION);
  }
}

Increment Java debugger minor version to 2.8 for a new release.


/*
 * This file is part of Bitsquare.
 *
 * Bitsquare is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 *
 * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
 */

package io.bitsquare.trade.protocol.availability.messages;

import io.bitsquare.app.Version;
import io.bitsquare.trade.protocol.availability.AvailabilityResult;

public final class OfferAvailabilityResponse extends OfferMessage {
    // That object is sent over the wire, so we need to take care of version compatibility.
    private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;

    public final AvailabilityResult availabilityResult;

    // TODO keep for backward compatibility. Can be removed once everyone is on v0.4.9
    public boolean isAvailable;

    public OfferAvailabilityResponse(String offerId, AvailabilityResult availabilityResult) {
        super(offerId);
        this.availabilityResult = availabilityResult;
    }

    @Override
    public String toString() {
        return "OfferAvailabilityResponse{" +
                "availabilityResult=" + availabilityResult +
                "} " + super.toString();
    }
}

/*
 * This file is part of Bitsquare.
 *
 * Bitsquare is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 *
 * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
 */

package io.bitsquare.trade.protocol.availability.messages;

import io.bitsquare.app.Version;
import io.bitsquare.trade.protocol.availability.AvailabilityResult;

public final class OfferAvailabilityResponse extends OfferMessage {
    // That object is sent over the wire, so we need to take care of version compatibility.
    private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;

    public final AvailabilityResult availabilityResult;

    // TODO keep for backward compatibility. Can be removed once everyone is on v0.4.9
    public boolean isAvailable;

    public OfferAvailabilityResponse(String offerId, AvailabilityResult availabilityResult) {
        super(offerId);
        this.availabilityResult = availabilityResult;
        isAvailable = availabilityResult == AvailabilityResult.AVAILABLE;
    }

    @Override
    public String toString() {
        return "OfferAvailabilityResponse{" +
                "availabilityResult=" + availabilityResult +
                "} " + super.toString();
    }
}

Set availabilityResult for backward compatibility


package hellowicket;

import org.apache.wicket.core.request.handler.PageProvider;
import org.apache.wicket.core.request.handler.RenderPageRequestHandler;
import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.IRequestMapper;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Url;
import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler;

import hellowicket.dbupdates.HelloDbUpdatesReference;
import hellowicket.fortune.FortunePage;
import hellowicket.plaintext.HelloTextReference;

/**
 * Custom request mapper optimized for the application needs
 */
public class RequestMapper implements IRequestMapper {

    private static final Url FORTUNES_URL = Url.parse("fortunes");

    @Override
    public IRequestHandler mapRequest(final Request request) {
        final String url = request.getUrl().toString();
        switch (url) {
            case "json":
                return new ResourceReferenceRequestHandler(new HelloJsonReference());
            case "db":
                return new ResourceReferenceRequestHandler(new HelloDbReference());
            case "updates":
                return new ResourceReferenceRequestHandler(new HelloDbUpdatesReference());
            case "plaintext":
                return new ResourceReferenceRequestHandler(new HelloTextReference());
            case "fortunes":
                return new RenderPageRequestHandler(new PageProvider(FortunePage.class));
            default:
        }
        return null;
    }

    @Override
    public int getCompatibilityScore(final Request request) {
        return 0;
    }

    @Override
    public Url mapHandler(final IRequestHandler requestHandler) {
        return FORTUNES_URL;
    }
}

package hellowicket;

import org.apache.wicket.core.request.handler.PageProvider;
import org.apache.wicket.core.request.handler.RenderPageRequestHandler;
import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.IRequestMapper;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Url;
import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler;

import hellowicket.dbupdates.HelloDbUpdatesReference;
import hellowicket.fortune.FortunePage;
import hellowicket.plaintext.HelloTextReference;

/**
 * Custom request mapper optimized for the application needs
 */
public class RequestMapper implements IRequestMapper {

    private static final Url FORTUNES_URL = Url.parse("fortunes");

    @Override
    public IRequestHandler mapRequest(final Request request) {
        final String url = request.getUrl().getPath();
        switch (url) {
            case "json":
                return new ResourceReferenceRequestHandler(new HelloJsonReference());
            case "db":
                return new ResourceReferenceRequestHandler(new HelloDbReference());
            case "updates":
                return new ResourceReferenceRequestHandler(new HelloDbUpdatesReference());
            case "plaintext":
                return new ResourceReferenceRequestHandler(new HelloTextReference());
            case "fortunes":
                return new RenderPageRequestHandler(new PageProvider(FortunePage.class));
            default:
        }
        return null;
    }

    @Override
    public int getCompatibilityScore(final Request request) {
        return 0;
    }

    @Override
    public Url mapHandler(final IRequestHandler requestHandler) {
        return FORTUNES_URL;
    }
}

Improve the url parsing - we need only the path to be able to decide


/*
 * Copyright (C) 2016 grandcentrix GmbH
 * 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 net.grandcentrix.thirtyinch.distinctuntilchanged;

import net.grandcentrix.thirtyinch.TiView;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * When added to a {@code void} method with at least one parameter inside a {@link TiView}, the
 * method implementation will only be called when the parameters change. A
 * {@link DistinctComparator} class is used to detect changes. By default it uses
 * {@link EqualsComparator}.
 */
@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DistinctUntilChanged {

    Class<? extends DistinctComparator> comparator() default EqualsComparator.class;

    boolean logDropped() default false;

}

/*
 * Copyright (C) 2016 grandcentrix GmbH
 * 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 net.grandcentrix.thirtyinch.distinctuntilchanged;

import net.grandcentrix.thirtyinch.TiView;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * When added to a {@code void} method with at least one parameter inside a {@link TiView}, the
 * method implementation will only be called when the parameters change. A
 * {@link DistinctComparator} class is used to detect changes. By default it uses
 * {@link HashComparator}.
 */
@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DistinctUntilChanged {

    Class<? extends DistinctComparator> comparator() default HashComparator.class;

    boolean logDropped() default false;

}

Revert Default implementation should using equals


// Copyright (C) 2013 The Android Open Source Project
//
// 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 com.googlesource.gerrit.plugins.deleteproject;

import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.extensions.webui.JavaScriptPlugin;
import com.google.gerrit.extensions.webui.WebUiPlugin;
import com.google.gerrit.httpd.plugins.HttpPluginModule;
import com.google.inject.Inject;

public class HttpModule extends HttpPluginModule {
  private final Configuration cfg;

  @Inject
  HttpModule(Configuration cfg) {
    this.cfg = cfg;
  }

  @Override
  protected void configureServlets() {
    if (cfg.enablePreserveOption()) {
      DynamicSet.bind(binder(), WebUiPlugin.class)
          .toInstance(new JavaScriptPlugin("delete-project.js"));
    } else {
      DynamicSet.bind(binder(), WebUiPlugin.class)
          .toInstance(new JavaScriptPlugin("delete-project-with-preserve-disabled.js"));
    }
  }
}

// Copyright (C) 2013 The Android Open Source Project
//
// 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 com.googlesource.gerrit.plugins.deleteproject;

import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.extensions.webui.JavaScriptPlugin;
import com.google.gerrit.extensions.webui.WebUiPlugin;
import com.google.inject.Inject;
import com.google.inject.servlet.ServletModule;

public class HttpModule extends ServletModule {
  private final Configuration cfg;

  @Inject
  HttpModule(Configuration cfg) {
    this.cfg = cfg;
  }

  @Override
  protected void configureServlets() {
    if (cfg.enablePreserveOption()) {
      DynamicSet.bind(binder(), WebUiPlugin.class)
          .toInstance(new JavaScriptPlugin("delete-project.js"));
    } else {
      DynamicSet.bind(binder(), WebUiPlugin.class)
          .toInstance(new JavaScriptPlugin("delete-project-with-preserve-disabled.js"));
    }
  }
}

Extend ServletModule instead of HttpPluginModule


package com.thebuerkle.dropwizard.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

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

import com.thebuerkle.dropwizard.core.Car;

@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public class TestResource {

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

    private final Client _client;

    public TestResource(Client client) {
        _client = client;
    }

    @Path("/produce")
    @GET
    public Car produce() {
        return new Car("Elantra", "gray");
    }

    @Path("/consume")
    @GET
    public void consume() {
        WebTarget target = _client.target("http://localhost:8080/produce");
        Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
        Response response = invocation.get();

        log.info(response.readEntity(Car.class).toString());
    }
}

package com.thebuerkle.dropwizard.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

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

import com.thebuerkle.dropwizard.core.Car;

@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public class TestResource {

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

    private final Client _client;

    public TestResource(Client client) {
        _client = client;
    }

    @Path("/produce")
    @GET
    public Car produce() {
        return new Car("Elantra", "gray");
    }

    @Path("/consume")
    @GET
    public void consume(@QueryParam("string") boolean asString) {
        WebTarget target = _client.target("http://localhost:8080/produce");
        Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
        Response response = invocation.get();

        log.info("Status code: " + Response.Status.fromStatusCode(response.getStatus()));

        if (asString) {
            log.info("Response as string: " + response.readEntity(String.class));
        }
        else {
            log.info("Response as car: " + response.readEntity(Car.class).toString());
        }
    }
}

Add getting response as a string


package cells;

import com.jme3.math.ColorRGBA;
import geometry.Position;
import inventory.InventoryItem;
import world.World;

/**
 * A cell whose state is known for any given tick
 */
public enum AnimatedCell implements InventoryItem, WorldCell {
    OSCILLATOR("Oscillator", (tick) -> {
        if (tick % 2 == 0) {
            return ColorRGBA.Magenta;
        } else {
            return ColorRGBA.Yellow;
        }
    });

    private final String name;
    private final F function;

    /**
     * A color function of tick and position
     */
    interface F { ColorRGBA f(int tick); }

    /**
     * Create an animated cell with given name and a color function
     * @param name name of the animated cell
     * @param function color generating function
     */
    AnimatedCell(String name, F function) {
        this.name = name;
        this.function = function;
    }

    /**
     * Produce the name of this animated cell
     * @return name of this animated cell
     */
    @Override
    public String getName() {
        return name;
    }

    /**
     * Produce the color of this animated cell from the given tick and position
     * @param tick current tick
     * @return current color of this animated cell
     */
    @Override
    public ColorRGBA getColor(int tick, Position position) {
        return function.f(tick);
    }

    @Override
    public void use(Position placeCursor, Position removeCursor, Position player) {
        World.getInstance().add(placeCursor, this);
    }
}

package cells;

import com.jme3.math.ColorRGBA;
import geometry.Position;
import inventory.InventoryItem;
import world.World;

/**
 * A cell whose state is known for any given tick
 */
public enum AnimatedCell implements InventoryItem, WorldCell {
    OSCILLATOR("Oscillator", (tick) -> {
        if (tick % 2 == 0) {
            return ColorRGBA.Magenta;
        } else {
            return ColorRGBA.Yellow;
        }
    });

    private final String name;
    private final Function function;

    /**
     * A color function of tick and position
     */
    private interface Function { ColorRGBA apply(int tick); }

    /**
     * Create an animated cell with given name and a color function
     * @param name name of the animated cell
     * @param function color generating function
     */
    AnimatedCell(String name, Function function) {
        this.name = name;
        this.function = function;
    }

    /**
     * Produce the name of this animated cell
     * @return name of this animated cell
     */
    @Override
    public String getName() {
        return name;
    }

    /**
     * Produce the color of this animated cell from the given tick and position
     * @param tick current tick
     * @return current color of this animated cell
     */
    @Override
    public ColorRGBA getColor(int tick, Position position) {
        return function.apply(tick);
    }

    @Override
    public void use(Position placeCursor, Position removeCursor, Position player) {
        World.getInstance().add(placeCursor, this);
    }
}

Rename F to Function and f() to apply()


package org.pentaho.di.run.sortedmerge;

import junit.framework.TestCase;

import org.pentaho.di.core.Result;
import org.pentaho.di.core.logging.LogWriter;
import org.pentaho.di.run.AllRunTests;
import org.pentaho.di.run.TimedTransRunner;

public class RunSortedMerge extends TestCase
{
    public void test_SORTED_MERGE_00()
    {
        System.out.println();
        System.out.println("SORTED MERGE");
        System.out.println("==================");
    }

    public void test_SORTED_MERGE_01_SIMPLE() throws Exception
    {
        TimedTransRunner timedTransRunner = new TimedTransRunner(
                "test/org/pentaho/di/run/sortedmerge/SortedMergeSimple.ktr",
                LogWriter.LOG_LEVEL_ERROR,
                AllRunTests.getOldTargetDatabase(),
                AllRunTests.getNewTargetDatabase(),
                1000
            );
        timedTransRunner.runOldAndNew();

        be.ibridge.kettle.core.Result oldResult = timedTransRunner.getOldResult();
        assertTrue(oldResult.getNrErrors()==0);

        Result newResult = timedTransRunner.getNewResult();
        assertTrue(newResult.getNrErrors()==0);
    }
}

package org.pentaho.di.run.sortedmerge;

import junit.framework.TestCase;

import org.pentaho.di.core.Result;
import org.pentaho.di.core.logging.LogWriter;
import org.pentaho.di.run.AllRunTests;
import org.pentaho.di.run.TimedTransRunner;

public class RunSortedMerge extends TestCase
{
    public void test_SORTED_MERGE_00()
    {
        System.out.println();
        System.out.println("SORTED MERGE");
        System.out.println("==================");
    }

    public void test_SORTED_MERGE_01_SIMPLE() throws Exception
    {
        TimedTransRunner timedTransRunner = new TimedTransRunner(
                "test/org/pentaho/di/run/sortedmerge/SortedMergeSimple.ktr",
                LogWriter.LOG_LEVEL_ERROR,
                AllRunTests.getOldTargetDatabase(),
                AllRunTests.getNewTargetDatabase(),
                1000000
            );
        timedTransRunner.runOldAndNew();

        be.ibridge.kettle.core.Result oldResult = timedTransRunner.getOldResult();
        assertTrue(oldResult.getNrErrors()==0);

        Result newResult = timedTransRunner.getNewResult();
        assertTrue(newResult.getNrErrors()==0);
    }
}

Fix for the sorted merge step


package io.liveoak.security.spi;

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

/**
 * @author Bob McWhirter
 */
public class AuthzPolicyGroup {

    public AuthzPolicyGroup() {
        this.entries = new ArrayList<>();
    }

    public AuthzPolicyGroup(List<AuthzPolicyEntry> entries) {
        this.entries = entries;
    }

    public List<AuthzPolicyEntry> entries() {
        return this.entries;
    }

    public void entries(List<AuthzPolicyEntry> entries) {
        this.entries = entries;
    }

    private List<AuthzPolicyEntry> entries;

}

package io.liveoak.security.spi;

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

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * @author Bob McWhirter
 */
public class AuthzPolicyGroup {

    public AuthzPolicyGroup() {
        this.entries = new ArrayList<>();
    }

    public AuthzPolicyGroup(List<AuthzPolicyEntry> entries) {
        this.entries = entries;
    }

    public List<AuthzPolicyEntry> entries() {
        return this.entries;
    }

    public void entries(List<AuthzPolicyEntry> entries) {
        this.entries = entries;
    }

    @JsonProperty("policies")
    private List<AuthzPolicyEntry> entries;

}

Fix root element of authz-config.json to be 'policies'


package uk.ac.ebi.atlas.model.resource;

import java.io.IOException;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public abstract class AtlasResource<T> {

    protected final Path path;

    AtlasResource(Path path) {
        this.path = path;
    }

    public boolean exists() {
        return Files.exists(path);
    }

    public boolean existsAndIsNonEmpty() {
        return exists() && (
                path.toFile().isDirectory()
                        ? path.toFile().list().length > 0
                        : path.toFile().length() > 0
        );
    }

    public boolean isReadable() {
        return Files.isReadable(path);
    }

    public abstract T get();

    public Reader getReader() throws IOException {
        return Files.newBufferedReader(path, StandardCharsets.UTF_8);
    }

    public long size() {
        return path.toFile().length();
    }

    @Override
    public String toString() {
        return this.getClass().getName() + " with path " + path.toString();
    }

}

package uk.ac.ebi.atlas.model.resource;

import java.io.IOException;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public abstract class AtlasResource<T> {

    protected final Path path;

    AtlasResource(Path path) {
        this.path = path;
    }

    public boolean exists() {
        return Files.exists(path);
    }

    public boolean existsAndIsNonEmpty() {
        return exists() && (
                path.toFile().isDirectory()
                        ? path.toFile().list().length > 0
                        : path.toFile().length() > 0
        );
    }

    public boolean isReadable() {
        return Files.isReadable(path);
    }

    public abstract T get();

    public Reader getReader() throws IOException {
        return Files.newBufferedReader(path, StandardCharsets.UTF_8);
    }

    public long size() {
        return path.toFile().length();
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName() + " with path " + path.toString();
    }

}

Simplify log messages in bioentities/buildIndex/status


package helloworld;

import static org.requirementsascode.UseCaseModelBuilder.newBuilder;

import java.util.function.Consumer;

import org.requirementsascode.UseCaseModel;
import org.requirementsascode.UseCaseModelBuilder;
import org.requirementsascode.UseCaseModelRunner;

public class HelloWorld01_PrintHelloUserExample {

	public UseCaseModel buildWith(UseCaseModelBuilder modelBuilder) {
		UseCaseModel useCaseModel =
			modelBuilder.useCase("Get greeted")
				.basicFlow()
					.step("S1").system(greetUser())
				.build();
		return useCaseModel;
	}

	private Consumer<UseCaseModelRunner> greetUser() {
		return r -> System.out.println("Hello, User.");
	}

	public static void main(String[] args){
		HelloWorld01_PrintHelloUserExample example = new HelloWorld01_PrintHelloUserExample();
		example.start();
	}

	private void start() {
		UseCaseModelRunner useCaseModelRunner = new UseCaseModelRunner();
		UseCaseModel useCaseModel = buildWith(newBuilder());
		useCaseModelRunner.run(useCaseModel);
	}
}

package helloworld;

import static org.requirementsascode.UseCaseModelBuilder.newBuilder;

import org.requirementsascode.UseCaseModel;
import org.requirementsascode.UseCaseModelBuilder;
import org.requirementsascode.UseCaseModelRunner;

public class HelloWorld01_PrintHelloUserExample {

	public UseCaseModel buildWith(UseCaseModelBuilder modelBuilder) {
		UseCaseModel useCaseModel =
			modelBuilder.useCase("Get greeted")
				.basicFlow()
					.step("S1").system(this::greetUser)
				.build();
		return useCaseModel;
	}

	private void greetUser(UseCaseModelRunner runner) {
		System.out.println("Hello, User.");
	}

	public static void main(String[] args){
		HelloWorld01_PrintHelloUserExample example = new HelloWorld01_PrintHelloUserExample();
		example.start();
	}

	private void start() {
		UseCaseModelRunner useCaseModelRunner = new UseCaseModelRunner();
		UseCaseModel useCaseModel = buildWith(newBuilder());
		useCaseModelRunner.run(useCaseModel);
	}
}

Refactor to use method references


package app;

import java.util.Observable;
import java.util.Observer;

/**
 * Created by Benjamin on 03/02/2016.
 */
public class ShippingTrackerObserver implements Observer {
	@Override
	public void update(Observable o, Object arg) {

	}
}

package app;

import app.action.Action;
import app.action.ActionEvent;
import app.action.Drop;
import app.shipper.BasicShipper;

import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.Observer;

/**
 * Created by Benjamin on 03/02/2016.
 */
public class ShippingTrackerObserver implements Observer {
	List<String> achievedDeliveries = new ArrayList<>();

	@Override
	public void update(Observable o, Object arg) {
		ActionEvent actionEvent = (ActionEvent) arg;

		if(o instanceof Drop && actionEvent.equals(ActionEvent.ENDED)) {

			Drop action = (Drop) o;
			System.out.printf("\n\t[DELIVERY DONE] %s has performed package %s\n", action.getTarget().getName(), action.getTarget().getPack());

		}
	}
}

Add basic code into new Spy


package com.sequenceiq.environment.environment.validation.validators;

import static com.sequenceiq.cloudbreak.common.mappable.CloudPlatform.GCP;

import java.util.Map;
import java.util.Optional;

import org.springframework.stereotype.Component;

import com.sequenceiq.cloudbreak.cloud.init.CloudPlatformConnectors;
import com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant;
import com.sequenceiq.cloudbreak.cloud.model.Platform;
import com.sequenceiq.cloudbreak.cloud.model.Variant;
import com.sequenceiq.cloudbreak.validation.ValidationResult;

@Component
public class TagValidator {

    private final CloudPlatformConnectors cloudPlatformConnectors;

    public TagValidator(CloudPlatformConnectors cloudPlatformConnectors) {
        this.cloudPlatformConnectors = cloudPlatformConnectors;
    }

    public ValidationResult validateTags(String cloudPlatform, Map<String, String> tags) {
        //TODO gcp ignored due to special tag handling in gcp. remove this when cb factory tags (like Owner) sanitized in the env request
        if (GCP.name().equalsIgnoreCase(cloudPlatform)) {
            return ValidationResult.empty();
        }
        Optional<com.sequenceiq.cloudbreak.cloud.TagValidator> tagValidatorConnector = getTagValidatorConnector(cloudPlatform);
        if (tagValidatorConnector.isEmpty()) {
            return ValidationResult.empty();
        }
        return tagValidatorConnector.get().validateTags(tags);

    }

    private Optional<com.sequenceiq.cloudbreak.cloud.TagValidator> getTagValidatorConnector(String cloudPlatform) {
        CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(cloudPlatform), Variant.variant(cloudPlatform));
        return Optional.ofNullable(cloudPlatformConnectors.get(cloudPlatformVariant).parameters().tagValidator());
    }
}

package com.sequenceiq.environment.environment.validation.validators;

import java.util.Map;
import java.util.Optional;

import org.springframework.stereotype.Component;

import com.sequenceiq.cloudbreak.cloud.init.CloudPlatformConnectors;
import com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant;
import com.sequenceiq.cloudbreak.cloud.model.Platform;
import com.sequenceiq.cloudbreak.cloud.model.Variant;
import com.sequenceiq.cloudbreak.validation.ValidationResult;

@Component
public class TagValidator {

    private final CloudPlatformConnectors cloudPlatformConnectors;

    public TagValidator(CloudPlatformConnectors cloudPlatformConnectors) {
        this.cloudPlatformConnectors = cloudPlatformConnectors;
    }

    public ValidationResult validateTags(String cloudPlatform, Map<String, String> tags) {
        Optional<com.sequenceiq.cloudbreak.cloud.TagValidator> tagValidatorConnector = getTagValidatorConnector(cloudPlatform);
        if (tagValidatorConnector.isEmpty()) {
            return ValidationResult.empty();
        }
        return tagValidatorConnector.get().validateTags(tags);

    }

    private Optional<com.sequenceiq.cloudbreak.cloud.TagValidator> getTagValidatorConnector(String cloudPlatform) {
        CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(cloudPlatform), Variant.variant(cloudPlatform));
        return Optional.ofNullable(cloudPlatformConnectors.get(cloudPlatformVariant).parameters().tagValidator());
    }
}

Revert "CB-11008 in case of gcp the tag validation will be switched off on environmentcreationdto until the gcp tag sanitization is used only cluster request"


/*
 * Copyright 2015-2020 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v2.0 which
 * accompanies this distribution and is available at
 *
 * https://www.eclipse.org/legal/epl-v20.html
 */

package org.junit.platform.launcher.listeners;

import static org.apiguardian.api.API.Status.EXPERIMENTAL;

import org.apiguardian.api.API;
import org.junit.platform.launcher.TestExecutionListener;

/**
 * A {@link TestExecutionListener} that generates Java Flight Recorder
 * events.
 *
 * @see JEP 328: Flight Recorder
 * @since 1.7
 */
@API(status = EXPERIMENTAL, since = "1.7")
public class FlightRecordingListener implements TestExecutionListener {
}

/*
 * Copyright 2015-2020 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v2.0 which
 * accompanies this distribution and is available at
 *
 * https://www.eclipse.org/legal/epl-v20.html
 */

package org.junit.platform.launcher.listeners;

import static org.apiguardian.api.API.Status.EXPERIMENTAL;

import org.apiguardian.api.API;
import org.junit.platform.engine.TestExecutionResult;
import org.junit.platform.launcher.TestExecutionListener;
import org.junit.platform.launcher.TestIdentifier;
import org.junit.platform.launcher.TestPlan;

/**
 * A {@link TestExecutionListener} that generates Java Flight Recorder
 * events.
 *
 * @see JEP 328: Flight Recorder
 * @since 1.7
 */
@API(status = EXPERIMENTAL, since = "1.7")
public class FlightRecordingListener implements TestExecutionListener {

	@Override
	public void testPlanExecutionStarted(TestPlan testPlan) {

	}

	@Override
	public void testPlanExecutionFinished(TestPlan testPlan) {

	}

	@Override
	public void dynamicTestRegistered(TestIdentifier testIdentifier) {

	}

	@Override
	public void executionSkipped(TestIdentifier testIdentifier, String reason) {

	}

	@Override
	public void executionStarted(TestIdentifier testIdentifier) {

	}

	@Override
	public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {

	}
}

Synchronize API of base type and versioned type


// Copyright (c) 2011 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 org.chromium.sdk.internal.wip.protocol.input;

import java.util.List;

import org.chromium.sdk.internal.protocolparser.JsonOptionalField;
import org.chromium.sdk.internal.protocolparser.JsonProtocolParseException;
import org.chromium.sdk.internal.protocolparser.JsonSubtypeCasting;
import org.chromium.sdk.internal.protocolparser.JsonType;

@JsonType(subtypesChosenManually=true)
public interface WipTabList {
  @JsonSubtypeCasting List<TabDescription> asTabList() throws JsonProtocolParseException;

  @JsonType interface TabDescription {
    String faviconUrl();
    String title();
    String url();

    String thumbnailUrl();

    @JsonOptionalField
    String devtoolsFrontendUrl();

    @JsonOptionalField
    String webSocketDebuggerUrl();
  }
}

// Copyright (c) 2011 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 org.chromium.sdk.internal.wip.protocol.input;

import java.util.List;

import org.chromium.sdk.internal.protocolparser.JsonOptionalField;
import org.chromium.sdk.internal.protocolparser.JsonProtocolParseException;
import org.chromium.sdk.internal.protocolparser.JsonSubtypeCasting;
import org.chromium.sdk.internal.protocolparser.JsonType;

@JsonType(subtypesChosenManually=true)
public interface WipTabList {
  @JsonSubtypeCasting List<TabDescription> asTabList() throws JsonProtocolParseException;

  @JsonType interface TabDescription {
    String faviconUrl();
    String title();
    String url();

    String thumbnailUrl();

    // TODO: consider adding enum here
    String type();

    @JsonOptionalField
    String devtoolsFrontendUrl();

    @JsonOptionalField
    String webSocketDebuggerUrl();
  }
}

Add 'type' field to tab enumeration JSON protocol


package com.squareup.seismic.sample;

import android.app.Activity;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.seismic.ShakeDetector;

import static android.view.Gravity.CENTER;
import static android.view.ViewGroup.LayoutParams;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;

public class Demo extends Activity implements ShakeDetector.Listener {
  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    ShakeDetector sd = new ShakeDetector(this);
    sd.start(sensorManager);

    TextView tv = new TextView(this);
    tv.setGravity(CENTER);
    tv.setText("Shake me, bro!");
    setContentView(tv, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
  }

  public void hearShake() {
    Toast.makeText(this, "Don't shake me, bro!", Toast.LENGTH_SHORT).show();
  }
}

package com.squareup.seismic.sample;

import android.app.Activity;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.seismic.ShakeDetector;

import static android.view.Gravity.CENTER;
import static android.view.ViewGroup.LayoutParams;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;

public class Demo extends Activity implements ShakeDetector.Listener {
  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    ShakeDetector sd = new ShakeDetector(this);
    sd.start(sensorManager);

    TextView tv = new TextView(this);
    tv.setGravity(CENTER);
    tv.setText("Shake me, bro!");
    setContentView(tv, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
  }

  @Override public void hearShake() {
    Toast.makeText(this, "Don't shake me, bro!", Toast.LENGTH_SHORT).show();
  }
}

Add @Override annotation for implemented method


package com.opencredo.concourse.mapping.events.methods.ordering;

import com.opencredo.concourse.domain.events.Event;
import com.opencredo.concourse.domain.events.EventType;

import java.util.Comparator;
import java.util.Map;

public final class CausalOrdering {

    public static final int INITIAL = Integer.MIN_VALUE;
    public static final int TERMINAL = Integer.MAX_VALUE;
    public static final int PRE_TERMINAL = TERMINAL - 1;

    private CausalOrdering() {
    }

    public static Comparator<Event> onEventTypes(Map<EventType, Integer> eventTypeMap) {
        return Comparator.comparing((Event evt) -> eventTypeMap.getOrDefault(EventType.of(evt), PRE_TERMINAL))
                .thenComparing(Event::getEventTimestamp);
    }
}

package com.opencredo.concourse.mapping.events.methods.ordering;

import com.opencredo.concourse.domain.events.Event;
import com.opencredo.concourse.domain.events.EventCharacteristics;
import com.opencredo.concourse.domain.events.EventType;

import java.util.Comparator;
import java.util.Map;

public final class CausalOrdering {

    public static final int INITIAL = Integer.MIN_VALUE;
    public static final int TERMINAL = Integer.MAX_VALUE;
    public static final int PRE_TERMINAL = TERMINAL - 1;

    private CausalOrdering() {
    }

    public static Comparator<Event> onEventTypes(Map<EventType, Integer> eventTypeMap) {
        return Comparator.comparing((Event evt) -> eventTypeMap.getOrDefault(EventType.of(evt),
                getDefaultOrderBasedOnCharacteristics(evt)))
                .thenComparing(Event::getEventTimestamp);
    }

    private static int getDefaultOrderBasedOnCharacteristics(Event evt) {
        return evt.hasCharacteristic(EventCharacteristics.IS_INITIAL)
            ? INITIAL
            : evt.hasCharacteristic(EventCharacteristics.IS_TERMINAL)
                ? TERMINAL
                : PRE_TERMINAL;
    }
}

Use event characteristics in causal ordering


package net.happygiraffe.jslint;

/**
 * Base class for an {@link Option} binding.
 *
 * @author dom
 * @version $Id$
 */
public abstract class AbstractOptionInstance implements OptionInstance {

    private final Option option;

    /**
     * Create a new instance and associate it with <i>option</i>.
     */
    public AbstractOptionInstance(Option option) {
        this.option = option;
    }

    /**
     * Return the option associated with this instance.
     */
    public Option getOption() {
        return option;
    }

}

package net.happygiraffe.jslint;

/**
 * Base class for an {@link Option} binding.
 *
 * @author dom
 * @version $Id$
 */
public abstract class AbstractOptionInstance implements OptionInstance {

    private final Option option;

    /**
     * Create a new instance and associate it with <i>option</i>.
     */
    public AbstractOptionInstance(Option option) {
        this.option = option;
    }

    /**
     * Return the option associated with this instance.
     */
    public Option getOption() {
        return option;
    }

    @Override
    public String toString() {
        return option.getLowerName() + "=" + getValue();
    }

}

Add a default toString() for OptionInstances.