/*
 * Copyright 2014 the original author or authors.
 *
 * 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.gvmtool.api;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Noam Y. Tenne
 */
public class GvmOptions {

    private final Set<GvmOption> options;

    public GvmOptions(GvmOption[] gvmOptions) {
        options = new HashSet<>();
        Collections.addAll(options, gvmOptions);
    }

    public boolean isInstall() {
        return options.contains(GvmOption.INSTALL);
    }

    public boolean isDefault() {
        return options.contains(GvmOption.DEFAULT);
    }

    public boolean isOffline() {
        return options.contains(GvmOption.OFFLINE);
    }
}

/*
 * Copyright 2014 the original author or authors.
 *
 * 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.gvmtool.api;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Noam Y. Tenne
 */
public class GvmOptions {

    private final Set<GvmOption> options;

    public GvmOptions(GvmOption...gvmOptions) {
        options = new HashSet<>();
        Collections.addAll(options, gvmOptions);
    }

    public boolean isInstall() {
        return options.contains(GvmOption.INSTALL);
    }

    public boolean isDefault() {
        return options.contains(GvmOption.DEFAULT);
    }

    public boolean isOffline() {
        return options.contains(GvmOption.OFFLINE);
    }
}

Use a varargs constructor instead of an array for the GVM Options


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

import java.util.List;

import org.apache.deltaspike.data.api.EntityRepository;
import org.apache.deltaspike.data.api.Repository;
import org.ops4j.pax.exam.sample1.model.Book;

@Repository
public interface BookRepository extends EntityRepository<Book, Integer>{

    List<Book> findByTitle(String title);

}

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

import java.util.List;

import org.apache.deltaspike.data.api.EntityRepository;
import org.apache.deltaspike.data.api.Repository;
import org.ops4j.pax.exam.sample1.model.Book;

@Repository
public interface BookRepository extends EntityRepository<Book, Integer> {

    List<Book> findByTitle(String title);

}

Fix '{' is not preceded with whitespace checkstyle warning


package water.webserver.iface;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * Finds implementation of {@link HttpServerFacade} found on the classpath.
 * There must be exactly one present.
 */
public class HttpServerLoader {
  public static final HttpServerFacade INSTANCE;
  static {
    final ServiceLoader<HttpServerFacade> serviceLoader = ServiceLoader.load(HttpServerFacade.class);
    final Iterator<HttpServerFacade> iter = serviceLoader.iterator();
    if (! iter.hasNext()) {
      throw new IllegalStateException("No implementation of HttpServerFacade found on classpath");
    }
    INSTANCE = iter.next();
    if (iter.hasNext()) {
      final StringBuilder sb = new StringBuilder(INSTANCE.getClass().getName());
      while (iter.hasNext()) {
        sb.append(",");
        sb.append(iter.next().getClass().getName());
      }
      throw new IllegalStateException("Multiple implementations of HttpServerFacade found on classpath: " + sb);
    }
  }
}

package water.webserver.iface;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * Finds implementation of {@link HttpServerFacade} found on the classpath.
 * There must be exactly one present.
 */
public class HttpServerLoader {
  public static final HttpServerFacade INSTANCE;
  static {
    final ServiceLoader<HttpServerFacade> serviceLoader = ServiceLoader.load(HttpServerFacade.class);
    final Iterator<HttpServerFacade> iter = serviceLoader.iterator();
    if (! iter.hasNext()) {
      throw new IllegalStateException("HTTP Server cannot be loaded: No implementation of HttpServerFacade found on classpath. Please refer to https://0xdata.atlassian.net/browse/TN-13 for details.");
    }
    INSTANCE = iter.next();
    if (iter.hasNext()) {
      final StringBuilder sb = new StringBuilder(INSTANCE.getClass().getName());
      while (iter.hasNext()) {
        sb.append(", ");
        sb.append(iter.next().getClass().getName());
      }
      throw new IllegalStateException("HTTP Server cannot be loaded: Multiple implementations of HttpServerFacade found on classpath: " + sb + ". Please refer to https://0xdata.atlassian.net/browse/TN-13 for details.");
    }
  }
}

PUBDEV-6170: Add a technote explaining what to do when Jetty is missing


package com.gurkensalat.osm.repository;

import com.gurkensalat.osm.entity.LinkedPlace;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

@RepositoryRestResource(collectionResourceRel = "linkedPlace", path = "linkedPlace")
public interface LinkedPlaceRepository extends PagingAndSortingRepository<LinkedPlace, Long>
{
    LinkedPlace findByOsmId(@Param("osm_id") String osmId);

    LinkedPlace findByDitibCode(@Param("D_CODE") String ditibCode);
}

package com.gurkensalat.osm.repository;

import com.gurkensalat.osm.entity.LinkedPlace;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

@RepositoryRestResource(collectionResourceRel = "linkedPlace", path = "linkedPlace")
public interface LinkedPlaceRepository extends PagingAndSortingRepository<LinkedPlace, Long>
{
    LinkedPlace findByOsmId(@Param("OSM_ID") String osmId);

    LinkedPlace findByDitibCode(@Param("DITIB_CODE") String ditibCode);
}

Clean up schema a bit

Clean up schema a bit


package org.realityforge.replicant.client.json.gwt;

import org.realityforge.gwt.propertysource.client.PropertySource;
import org.realityforge.gwt.propertysource.client.annotations.Namespace;
import org.realityforge.gwt.propertysource.client.annotations.Property;

@Namespace("replicant")
public interface ReplicantConfig
  extends PropertySource
{
  @Property( "shouldValidateRepositoryOnLoad" )
  boolean shouldValidateRepositoryOnLoad();
}

package org.realityforge.replicant.client.json.gwt;

import org.realityforge.gwt.propertysource.client.PropertySource;
import org.realityforge.gwt.propertysource.client.annotations.Namespace;

@Namespace("replicant")
public interface ReplicantConfig
  extends PropertySource
{
  boolean shouldValidateRepositoryOnLoad();
}

Remove unnecessary annotation as it matches the method name


package im.actor.core.js.entity;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;

import org.timepedia.exporter.client.Export;
import org.timepedia.exporter.client.ExportClosure;
import org.timepedia.exporter.client.Exportable;

@Export
@ExportClosure
public interface JsMessagesBindClosure extends Exportable {
    void onBind(JsArray<JsMessage> array,
                JsArray<JavaScriptObject> overlays,
                boolean isLoaded,
                Double receiveDate,
                Double readDate);
}

package im.actor.core.js.entity;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;

import org.timepedia.exporter.client.Export;
import org.timepedia.exporter.client.ExportClosure;
import org.timepedia.exporter.client.Exportable;

@Export
@ExportClosure
public interface JsMessagesBindClosure extends Exportable {
    void onBind(JsArray<JsMessage> array,
                JsArray<JavaScriptObject> overlays,
                boolean isLoaded,
                double receiveDate,
                double readDate);
}

Fix messages binding date boxing

fix(js): Fix messages binding date boxing


package basearch.integration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
import org.thymeleaf.templateresolver.ServletContextTemplateResolver;

@Configuration
public class ThymeleafConfiguration {

	@Bean
	public ServletContextTemplateResolver templateResolver() {
		ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
		resolver.setPrefix("/WEB-INF/thymeleaf");
		resolver.setTemplateMode("HTML5");
		return resolver;
	}

	@Bean
	public SpringSecurityDialect springSecurityDialect() {
		return new SpringSecurityDialect();
	}

	@Bean
	public SpringTemplateEngine templateEngine() {
		SpringTemplateEngine templateEngine = new SpringTemplateEngine();
		templateEngine.setTemplateResolver(templateResolver());
		templateEngine.addDialect(springSecurityDialect());
		return templateEngine;
	}

	@Bean
	public ThymeleafViewResolver viewResolver() {
		ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
		viewResolver.setTemplateEngine(templateEngine());
		viewResolver.setOrder(1);
		viewResolver.setViewNames(new String[] {"*.html"});
		return viewResolver;
	}

}

package basearch.integration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
import org.thymeleaf.templateresolver.ServletContextTemplateResolver;

@Configuration
public class ThymeleafConfiguration {

	@Bean
	public ServletContextTemplateResolver templateResolver() {
		ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
		resolver.setPrefix("/WEB-INF/thymeleaf");
		resolver.setTemplateMode("HTML5");
		resolver.setCacheable(false);
		return resolver;
	}

	@Bean
	public SpringSecurityDialect springSecurityDialect() {
		return new SpringSecurityDialect();
	}

	@Bean
	public SpringTemplateEngine templateEngine() {
		SpringTemplateEngine templateEngine = new SpringTemplateEngine();
		templateEngine.setTemplateResolver(templateResolver());
		templateEngine.addDialect(springSecurityDialect());
		return templateEngine;
	}

	@Bean
	public ThymeleafViewResolver viewResolver() {
		ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
		viewResolver.setTemplateEngine(templateEngine());
		viewResolver.setOrder(1);
		viewResolver.setViewNames(new String[] {"*.html"});
		return viewResolver;
	}

}

Make thymeleaf templates not cacheable, to ease jetty redeploys


package org.javarosa.core.model.instance.utils;

import org.javarosa.core.model.instance.FormInstance;
import org.javarosa.core.model.instance.TreeElement;
import org.javarosa.xml.ElementParser;
import org.javarosa.xml.TreeElementParser;
import org.javarosa.xml.util.InvalidStructureException;
import org.javarosa.xml.util.UnfullfilledRequirementsException;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.io.InputStream;

/**
 * Collection of static form loading methods
 *
 * @author Phillip Mates
 */
public class FormLoadingUtils {

    public static FormInstance loadFormInstance(String formFilepath)
            throws InvalidStructureException, IOException {
        TreeElement root = xmlToTreeElement(formFilepath);

        return new FormInstance(root, null);
    }

    public static TreeElement xmlToTreeElement(String xmlFilepath)
            throws InvalidStructureException, IOException {
        InputStream is = System.class.getResourceAsStream(xmlFilepath);
        TreeElementParser parser = new TreeElementParser(ElementParser.instantiateParser(is), 0, "instance");

        try {
            return parser.parse();
        } catch (XmlPullParserException e) {
            throw new IOException(e.getMessage());
        } catch (UnfullfilledRequirementsException e) {
            throw new IOException(e.getMessage());
        }
    }
}

package org.javarosa.core.model.instance.utils;

import org.javarosa.core.model.instance.FormInstance;
import org.javarosa.core.model.instance.TreeElement;
import org.javarosa.xml.ElementParser;
import org.javarosa.xml.TreeElementParser;
import org.javarosa.xml.util.InvalidStructureException;
import org.javarosa.xml.util.UnfullfilledRequirementsException;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.io.InputStream;

/**
 * Collection of static form loading methods
 *
 * @author Phillip Mates
 */
public class FormLoadingUtils {

    public static FormInstance loadFormInstance(String formFilepath)
            throws InvalidStructureException, IOException {
        TreeElement root = xmlToTreeElement(formFilepath);

        return new FormInstance(root, null);
    }

    public static TreeElement xmlToTreeElement(String xmlFilepath)
            throws InvalidStructureException, IOException {
        InputStream is = FormLoadingUtils.class.getResourceAsStream(xmlFilepath);
        TreeElementParser parser = new TreeElementParser(ElementParser.instantiateParser(is), 0, "instance");

        try {
            return parser.parse();
        } catch (XmlPullParserException e) {
            throw new IOException(e.getMessage());
        } catch (UnfullfilledRequirementsException e) {
            throw new IOException(e.getMessage());
        }
    }
}

Fix resource loading on android

Fix resource loading on android


/*******************************************************************************
 * Copyright (c) 2011, 2017 Eurotech and/or its affiliates and others
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Eurotech - initial API and implementation
 *******************************************************************************/
package org.eclipse.kapua.message.xml;

import org.eclipse.kapua.model.xml.ObjectTypeXmlAdapter;

public class MetricTypeXmlAdapter extends ObjectTypeXmlAdapter {

    private static final String TYPE_BASE_64_BINARY = "base64binary";

    @Override
    public String marshal(Class<?> clazz) {

        String value;
        if (clazz == byte[].class) {
            value = TYPE_BASE_64_BINARY;
        } else {
            value = super.marshal(clazz);
        }

        return value;
    }

    @Override
    public Class<?> unmarshal(String value) throws ClassNotFoundException {
        Class<?> clazz;
        if (TYPE_BASE_64_BINARY.equals(value)) {
            clazz = byte[].class;
        } else {
            clazz = super.unmarshal(value);
        }
        return clazz;
    }
}

/*******************************************************************************
 * Copyright (c) 2011, 2017 Eurotech and/or its affiliates and others
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Eurotech - initial API and implementation
 *******************************************************************************/
package org.eclipse.kapua.message.xml;

import org.eclipse.kapua.model.xml.ObjectTypeXmlAdapter;

/**
 * XML Adapter from metric type. <br>
 * This adapter extends {@link ObjectTypeXmlAdapter} and serialize/deserialize in a different way the
 * {@link Byte}[] metric type.
 *
 * This is because Kapua uses Base64 encoding of binary data.
 *
 * @since 1.0.0
 */
public class MetricTypeXmlAdapter extends ObjectTypeXmlAdapter {

    private static final String TYPE_BASE_64_BINARY = "base64binary";

    @Override
    public String marshal(Class<?> clazz) {

        String value;
        if (clazz == byte[].class) {
            value = TYPE_BASE_64_BINARY;
        } else {
            value = super.marshal(clazz);
        }

        return value;
    }

    @Override
    public Class<?> unmarshal(String value) throws ClassNotFoundException {
        Class<?> clazz;
        if (TYPE_BASE_64_BINARY.equals(value)) {
            clazz = byte[].class;
        } else {
            clazz = super.unmarshal(value);
        }
        return clazz;
    }
}

Clean up and applyed code formatting

Clean up and applyed code formatting

Signed-off-by: coduz <ded987c534c96b462feeee54a345bec2d025746a@eurotech.com>


package com.novoda.downloadmanager.lib;

import android.provider.BaseColumns;

/**
 * Constants related to HTTP request headers associated with each download.
 */
public class DownloadsColumnsRequestHeaders implements BaseColumns {
    public static final String HEADERS_DB_TABLE = "request_headers";
    public static final String COLUMN_DOWNLOAD_ID = "download_id";
    public static final String COLUMN_HEADER = "header";
    public static final String COLUMN_VALUE = "value";

    /**
     * Path segment to add to a download URI to retrieve request headers
     */
    public static final String URI_SEGMENT = "headers";

    /**
     * Prefix for ContentValues keys that contain HTTP header lines, to be passed to
     * DownloadProvider.insert().
     */
    public static final String INSERT_KEY_PREFIX = "http_header_";
}

package com.novoda.downloadmanager.lib;

import android.provider.BaseColumns;

/**
 * Constants related to HTTP request headers associated with each download.
 */
public final class DownloadsColumnsRequestHeaders implements BaseColumns {

    public static final String HEADERS_DB_TABLE = "request_headers";
    public static final String COLUMN_DOWNLOAD_ID = "download_id";
    public static final String COLUMN_HEADER = "header";
    public static final String COLUMN_VALUE = "value";

    /**
     * Path segment to add to a download URI to retrieve request headers
     */
    public static final String URI_SEGMENT = "headers";

    /**
     * Prefix for ContentValues keys that contain HTTP header lines, to be passed to
     * DownloadProvider.insert().
     */
    public static final String INSERT_KEY_PREFIX = "http_header_";

    private DownloadsColumnsRequestHeaders() {
        // non-instantiable class
    }
}

Make class final and adds private constructor


package com.intellij.debugger.streams.ui;

import com.intellij.debugger.DebuggerContext;
import com.intellij.debugger.engine.ContextUtil;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.memory.utils.InstanceValueDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiElementFactory;
import com.intellij.psi.PsiExpression;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.Value;
import org.jetbrains.annotations.NotNull;

/**
 * @author Vitaliy.Bibaev
 */
public class PrimitiveValueDescriptor extends InstanceValueDescriptor {
  PrimitiveValueDescriptor(@NotNull Project project, @NotNull Value value) {
    super(project, value);
  }

  @Override
  public String calcValueName() {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.calcValueName();
    }

    return value.type().name();
  }

  @Override
  public boolean isShowIdLabel() {
    return true;
  }

  @Override
  public PsiExpression getDescriptorEvaluation(DebuggerContext debuggerContext) throws EvaluateException {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.getDescriptorEvaluation(debuggerContext);
    }

    final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myProject).getElementFactory();
    return elementFactory.createExpressionFromText("", ContextUtil.getContextElement(debuggerContext));
  }
}

package com.intellij.debugger.streams.ui;

import com.intellij.debugger.DebuggerContext;
import com.intellij.debugger.engine.ContextUtil;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.memory.utils.InstanceValueDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiElementFactory;
import com.intellij.psi.PsiExpression;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.Value;
import org.jetbrains.annotations.NotNull;

/**
 * @author Vitaliy.Bibaev
 */
public class PrimitiveValueDescriptor extends InstanceValueDescriptor {
  PrimitiveValueDescriptor(@NotNull Project project, @NotNull Value value) {
    super(project, value);
  }

  @Override
  public String calcValueName() {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.calcValueName();
    }

    return value.type().name();
  }

  @Override
  public PsiExpression getDescriptorEvaluation(DebuggerContext debuggerContext) throws EvaluateException {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.getDescriptorEvaluation(debuggerContext);
    }

    final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myProject).getElementFactory();
    return elementFactory.createExpressionFromText("", ContextUtil.getContextElement(debuggerContext));
  }
}

Remove a duplicated label from the collection view


package com.unascribed.correlatedpotentialistics.block.item;

import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;

public class ItemBlockDriveBay extends ItemBlock {

	public ItemBlockDriveBay(Block block) {
		super(block);
	}

	@Override
	public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
		tooltip.add(I18n.format("tooltip.correlatedpotentialistics.rf_usage", 16));
	}

}

package com.unascribed.correlatedpotentialistics.block.item;

import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;

public class ItemBlockDriveBay extends ItemBlock {

	public ItemBlockDriveBay(Block block) {
		super(block);
	}

	@Override
	public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
		tooltip.add(I18n.format("tooltip.correlatedpotentialistics.rf_usage", 8));
	}

}

Fix Drive Bay tooltip saying it uses 16RF/t and not 8RF/t

Not major enough for a new release, this'll get pushed along with whatever else winds up in 0.1.3.


package com.infinityraider.agricraft.renderers.particles;

//heavily inspired by the OpenBlocks sprinkler
import com.infinityraider.agricraft.utility.BaseIcons;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class LiquidSprayFX extends AgriCraftFX {

    public LiquidSprayFX(World world, double x, double y, double z, float scale, float gravity, Vec3d vector) {
        super(world, x, y, z, scale, gravity, vector, new ResourceLocation(BaseIcons.WATER_STILL.location));
        this.particleMaxAge = 15;
        this.setSize(0.2f, 0.2f);
    }
}

package com.infinityraider.agricraft.renderers.particles;

//heavily inspired by the OpenBlocks sprinkler
import com.infinityraider.agricraft.utility.BaseIcons;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class LiquidSprayFX extends AgriCraftFX {

    public LiquidSprayFX(World world, double x, double y, double z, float scale, float gravity, Vec3d vector) {
        super(world, x, y, z, scale, gravity, vector, new ResourceLocation("minecraft:textures/blocks/water_still.png"));
        this.particleMaxAge = 15;
        this.setSize(0.2f, 0.2f);
    }
}

Fix particle texture causing FileNotFoundException

The string used in the ResourceLocation for the sprinkler water particle
was for an icon instead of the texture. As a result, the client would
throw an exception and then it would instead use the "missingo" texture.

Although this does fix the black and purple texture, all particles will
still be water colored. For example, blocks break into bursts of water
droplets. A separate commit fixes that though.


package de.fau.amos.virtualledger.server;

import org.junit.Assert;
import org.junit.Test;

import javax.ws.rs.core.Response;

public class TestRestProviderTest {
    private final TestRestProvider testRestProvider = new TestRestProvider();

    @Test
    public void helloWorld_noInput_200Status() {
        //arrange
        //act
        final Response result = testRestProvider.helloWorld();
        //assert
        Assert.assertEquals(200, result.getStatus());
    }

    @Test
    public void helloWorld_noInput_helloWorldEntity() {
        //arrange
        //act
        final Response result = testRestProvider.helloWorld();
        //assert
        Assert.assertEquals("Hello World", result.getEntity());
    }
}

package de.fau.amos.virtualledger.server;

import org.junit.Assert;
import org.junit.Test;

import javax.ws.rs.core.Response;

public class TestRestProviderTest {
    private final TestRestProvider testRestProvider = new TestRestProvider();

    @Test
    public void helloWorld_noInput_200Status() {
        //arrange
        //act
        final Response result = testRestProvider.helloWorld();
        //assert
        Assert.assertEquals(200, result.getStatus());
    }

    @Test
    public void helloWorld_noInput_helloWorldEntity() {
        //arrange
        //act
        final Response result = testRestProvider.helloWorld();
        //assert
        Assert.assertEquals("hallo!", result.getEntity());
    }
}

Edit wrong test that make build fail

Edit wrong test that make build fail


package com.bazaarvoice.dropwizard.assets;

import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.validation.constraints.NotNull;
import java.util.Map;

public class AssetsConfiguration {

    @NotNull
    @JsonProperty
    private String cacheSpec = ConfiguredAssetsBundle.DEFAULT_CACHE_SPEC.toParsableString();

    @NotNull
    @JsonProperty
    private Map<String, String> overrides = Maps.newHashMap();

    @JsonProperty
    private Map<String, String> mimeTypes = Maps.newHashMap();

    /** The caching specification for how to memoize assets. */
    public String getCacheSpec() {
        return cacheSpec;
    }

    public Iterable<Map.Entry<String, String>> getOverrides() {
        return Iterables.unmodifiableIterable(overrides.entrySet());
    }

    public Iterable<Map.Entry<String, String>> getMimeTypes() {
        return Iterables.unmodifiableIterable(mimeTypes.entrySet());
    }
}

package com.bazaarvoice.dropwizard.assets;

import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.validation.constraints.NotNull;
import java.util.Map;

public class AssetsConfiguration {
    @NotNull
    @JsonProperty
    private String cacheSpec = ConfiguredAssetsBundle.DEFAULT_CACHE_SPEC.toParsableString();

    @NotNull
    @JsonProperty
    private Map<String, String> overrides = Maps.newHashMap();

    @NotNull
    @JsonProperty
    private Map<String, String> mimeTypes = Maps.newHashMap();

    /** The caching specification for how to memoize assets. */
    public String getCacheSpec() {
        return cacheSpec;
    }

    public Iterable<Map.Entry<String, String>> getOverrides() {
        return Iterables.unmodifiableIterable(overrides.entrySet());
    }

    public Iterable<Map.Entry<String, String>> getMimeTypes() {
        return Iterables.unmodifiableIterable(mimeTypes.entrySet());
    }
}

Revert "remove not null constraint"

Revert "remove not null constraint"

This reverts commit 32f5c29a23341c4f1dd6c1241a751201ce286430.


package io.quarkus.arc.impl;

import io.quarkus.arc.InjectableReferenceProvider;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.InjectionPoint;

/**
 *
 * @author Martin Kouba
 */
public class InjectionPointProvider implements InjectableReferenceProvider<InjectionPoint> {

    private static final ThreadLocal<InjectionPoint> CURRENT = new ThreadLocal<>();

    @Override
    public InjectionPoint get(CreationalContext<InjectionPoint> creationalContext) {
        return CURRENT.get();
    }

    /**
     * Set the current injection point for a non-null parameter, remove the threadlocal for null parameter.
     *
     * @param injectionPoint
     * @return the previous injection point or {@code null}
     */
    static InjectionPoint set(InjectionPoint injectionPoint) {
        if (injectionPoint != null) {
            InjectionPoint prev = InjectionPointProvider.CURRENT.get();
            InjectionPointProvider.CURRENT.set(injectionPoint);
            return prev;
        } else {
            CURRENT.remove();
            return null;
        }
    }

    public static InjectionPoint get() {
        return CURRENT.get();
    }

}

package io.quarkus.arc.impl;

import io.quarkus.arc.InjectableReferenceProvider;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.InjectionPoint;

/**
 *
 * @author Martin Kouba
 */
public class InjectionPointProvider implements InjectableReferenceProvider<InjectionPoint> {

    private static final ThreadLocal<InjectionPoint> CURRENT = new ThreadLocal<>();

    @Override
    public InjectionPoint get(CreationalContext<InjectionPoint> creationalContext) {
        return CURRENT.get();
    }

    /**
     * Set the current injection point for a non-null parameter, remove the threadlocal for null parameter.
     *
     * @param injectionPoint
     * @return the previous injection point or {@code null}
     */
    static InjectionPoint set(InjectionPoint injectionPoint) {
        if (injectionPoint != null) {
            InjectionPoint prev = InjectionPointProvider.CURRENT.get();
            if (injectionPoint.equals(prev)) {
                return injectionPoint;
            } else {
                InjectionPointProvider.CURRENT.set(injectionPoint);
                return prev;
            }
        } else {
            CURRENT.remove();
            return null;
        }
    }

    public static InjectionPoint get() {
        return CURRENT.get();
    }

}

Check to see if injection point is same as current thread local value


/*
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch 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.elasticsearch.search.aggregations.bucket;

import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder;

public class FilterTests extends BaseAggregationTestCase<FilterAggregationBuilder> {

    @Override
    protected FilterAggregationBuilder createTestAggregatorBuilder() {
        FilterAggregationBuilder factory = new FilterAggregationBuilder(randomAlphaOfLengthBetween(1, 20),
                QueryBuilders.termQuery(randomAlphaOfLengthBetween(5, 20), randomAlphaOfLengthBetween(5, 20)));
        // NORELEASE make RandomQueryBuilder work outside of the
        // AbstractQueryTestCase
        // builder.query(RandomQueryBuilder.createQuery(getRandom()));
        return factory;
    }

}

/*
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch 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.elasticsearch.search.aggregations.bucket;

import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder;

public class FilterTests extends BaseAggregationTestCase<FilterAggregationBuilder> {

    @Override
    protected FilterAggregationBuilder createTestAggregatorBuilder() {
        return new FilterAggregationBuilder(randomAlphaOfLengthBetween(1, 20),
                QueryBuilders.termQuery(randomAlphaOfLengthBetween(5, 20), randomAlphaOfLengthBetween(5, 20)));
    }

}

Remove old norelease comment, the test is okay as it is


package org.realityforge.arez.annotations;

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

/**
 * Methods marked with this annotation are computed values within Arez.
 *
 *
The method should take zero parameters and return a single value. The value
 * should be derived from other {@link org.realityforge.arez.Observable}s
 * within the Arez system and the value returned by the method should not change
 * unless the state of the other Observables changes. The method should NOT modify
 * other state in the system.

 *
 *
The computed method is automatically wrapped in a READ_ONLY transaction
 * by the annotation parser.

 */
@Retention( RetentionPolicy.CLASS )
@Target( ElementType.METHOD )
public @interface Computed
{
}

package org.realityforge.arez.annotations;

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

/**
 * Methods marked with this annotation are computed values within Arez.
 *
 *
The method should take zero parameters and return a single value. The value
 * should be derived from other Observables within the Arez system and the value
 * returned by the method should not change unless the state of the other Observables
 * changes. The method should NOT modify other state in the system.

 *
 *
The computed method is automatically wrapped in a READ_ONLY transaction
 * by the annotation parser.

 */
@Retention( RetentionPolicy.CLASS )
@Target( ElementType.METHOD )
public @interface Computed
{
}

Fix javadocs cross link as Observable is not present locally


package net.kencochrane.raven.sentrystub.event.interfaces;

import com.fasterxml.jackson.annotation.JsonProperty;

public class ExceptionInterface {
    @JsonProperty(value = "type")
    private String type;
    @JsonProperty(value = "value")
    private String value;
    @JsonProperty(value = "module")
    private String module;
}

package net.kencochrane.raven.sentrystub.event.interfaces;

import com.fasterxml.jackson.annotation.JsonProperty;

public class ExceptionInterface {
    @JsonProperty(value = "type")
    private String type;
    @JsonProperty(value = "value")
    private String value;
    @JsonProperty(value = "module")
    private String module;
    @JsonProperty(value = "stacktrace")
    private StackTraceInterface stackTraceInterface;
}

Add a stacktrace element to exception

Add a stacktrace element to exception


package edu.sdsc.scigraph.owlapi.cases;

import static com.google.common.collect.Iterables.getOnlyElement;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import org.junit.Test;
import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;

import edu.sdsc.scigraph.owlapi.OwlRelationships;

public class TestInferredEdges extends OwlTestCase {

  @Test
  public void testInferredEdges() {
    Node cx = getNode("http://example.org/cx");
    Node dx = getNode("http://example.org/dx");

    Iterable<Relationship> superclasses = dx.getRelationships(OwlRelationships.RDF_SUBCLASS_OF, Direction.OUTGOING);
    Relationship r = getOnlyElement(superclasses);
    assertThat(r.getOtherNode(dx), is(cx));
  }

}

package edu.sdsc.scigraph.owlapi.cases;

import static com.google.common.collect.Iterables.getOnlyElement;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import org.junit.Ignore;
import org.junit.Test;
import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;

import edu.sdsc.scigraph.owlapi.OwlRelationships;

@Ignore
public class TestInferredEdges extends OwlTestCase {

  @Test
  public void testInferredEdges() {
    Node cx = getNode("http://example.org/cx");
    Node dx = getNode("http://example.org/dx");

    Iterable<Relationship> superclasses = dx.getRelationships(OwlRelationships.RDF_SUBCLASS_OF, Direction.OUTGOING);
    Relationship r = getOnlyElement(superclasses);
    assertThat(r.getOtherNode(dx), is(cx));
  }

}

42: Add direct inferred edges as part of loading SciGraph

Task-Url: https://github.com/SciCrunch/SciGraph/issues/issue/42

Removes test to resolve inference issues


package uk.ac.ic.wlgitbridge.bridge.db.sqlite.query;

import uk.ac.ic.wlgitbridge.bridge.db.sqlite.SQLQuery;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by winston on 23/08/2016.
 */
public class GetOldestProjectName implements SQLQuery<String> {

    private static final String GET_OLDEST_PROJECT_NAME =
            "SELECT `name`, MIN(`last_accessed`)\n" +
            "    FROM `projects`";

    @Override
    public String getSQL() {
        return GET_OLDEST_PROJECT_NAME;
    }

    @Override
    public String processResultSet(ResultSet resultSet) throws SQLException {
        while (resultSet.next()) {
            return resultSet.getString("name");
        }
        return null;
    }

}

package uk.ac.ic.wlgitbridge.bridge.db.sqlite.query;

import uk.ac.ic.wlgitbridge.bridge.db.sqlite.SQLQuery;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by winston on 23/08/2016.
 */
public class GetOldestProjectName implements SQLQuery<String> {

    private static final String GET_OLDEST_PROJECT_NAME =
            "SELECT `name`, MIN(`last_accessed`)\n" +
            "    FROM `projects` \n" +
            "    WHERE `last_accessed` IS NOT NULL;";

    @Override
    public String getSQL() {
        return GET_OLDEST_PROJECT_NAME;
    }

    @Override
    public String processResultSet(ResultSet resultSet) throws SQLException {
        while (resultSet.next()) {
            return resultSet.getString("name");
        }
        return null;
    }

}

Fix query for oldest (un-swapped) project


package com.adaptris.core.stubs;

public interface UpgradedToJunit4 {

  // For concrete implementations to override
  default boolean isAnnotatedForJunit4() {
    return false;
  }
}

package com.adaptris.core.stubs;

public interface UpgradedToJunit4 {

  boolean isAnnotatedForJunit4();
}

Remove default method to force compile failures


/**
 *
 */
package org.eclipse.scanning.test.points;

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

import org.eclipse.scanning.api.points.IGenerator;
import org.eclipse.scanning.api.points.IPosition;
import org.eclipse.scanning.api.points.Point;

/**
 * @author fcp94556
 *
 */
class GeneratorUtil {

	/**
	 * Checks the points list vs the iterator
	 * @param gen
	 * @throws Exception
	 */
	public static void testGeneratorPoints(IGenerator<?,?> gen) throws Exception {

		final List ponts = gen.createPoints();
		final List its   = new ArrayList<>(gen.size());
		final Iterator it = gen.iterator();
		while(it.hasNext()) its.add(it.next());

		IPosition[] pnts1 = array(ponts);
		IPosition[] pnts2 = array(ponts);

		if (pnts2.length!=pnts1.length) throw new Exception("Not the same size!");
        for (int i = 0; i < pnts1.length; i++) {
			if (!pnts1[i].equals(pnts2[i])) {
				throw new Exception(pnts1[i]+" does not equal "+pnts2[i]);
			}
		}
 	}

	private static IPosition[] array(List<IPosition> p) {
		return p.toArray(new IPosition[p.size()]);
	}
}

/**
 *
 */
package org.eclipse.scanning.test.points;

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

import org.eclipse.scanning.api.points.IGenerator;
import org.eclipse.scanning.api.points.IPosition;
import org.eclipse.scanning.api.points.Point;

/**
 * @author fcp94556
 *
 */
class GeneratorUtil {

	/**
	 * Checks the points list vs the iterator
	 * @param gen
	 * @throws Exception
	 */
	public static void testGeneratorPoints(IGenerator<?,?> gen) throws Exception {

		final List ponts = gen.createPoints();
		final List its   = new ArrayList<>(gen.size());
		final Iterator it = gen.iterator();
		while(it.hasNext()) its.add(it.next());

		IPosition[] pnts1 = array(ponts);
		IPosition[] pnts2 = array(its);

		if (pnts2.length!=pnts1.length) throw new Exception("Not the same size!");
        for (int i = 0; i < pnts1.length; i++) {
			if (!pnts1[i].equals(pnts2[i])) {
				throw new Exception(pnts1[i]+" does not equal "+pnts2[i]);
			}
		}
 	}

	private static IPosition[] array(List<IPosition> p) {
		return p.toArray(new IPosition[p.size()]);
	}
}

Fix to class used in tests, generates the failures properly!


package com.peterphi.std.guice.common.serviceprops;

import com.google.inject.Provider;
import com.peterphi.std.guice.common.serviceprops.typed.TypedConfigRef;
import org.apache.commons.configuration.Configuration;

public class ConfigRef implements Provider<String>
{
	private final Configuration configuration;
	private final String name;

	public ConfigRef(final Configuration configuration, final String name)
	{
		this.configuration = configuration;
		this.name = name;
	}

	@Override
	public String get()
	{
		return configuration.getString(name);
	}

	public <T> T get(Class<T> clazz)
	{
		return as(clazz).get();
	}

	public <T> TypedConfigRef<T> as(final Class<T> clazz)
	{
		return new TypedConfigRef<>(this, clazz);
	}
}

package com.peterphi.std.guice.common.serviceprops;

import com.google.inject.Provider;
import com.peterphi.std.guice.common.serviceprops.typed.TypedConfigRef;
import org.apache.commons.configuration.Configuration;

import java.util.List;

public class ConfigRef implements Provider<String>
{
	private final Configuration configuration;
	private final String name;

	public ConfigRef(final Configuration configuration, final String name)
	{
		this.configuration = configuration;
		this.name = name;
	}

	@Override
	public String get()
	{
		return configuration.getString(name);
	}

	public String[] getStringArray()
	{
		return configuration.getStringArray(name);
	}

	public List<Object> getList()
	{
		return configuration.getList(name);
	}

	public Object getObject()
	{
		return configuration.getProperty(name);
	}

	public <T> T get(Class<T> clazz)
	{
		return as(clazz).get();
	}

	public <T> TypedConfigRef<T> as(final Class<T> clazz)
	{
		return new TypedConfigRef<>(this, clazz);
	}
}

Add methods to retrieve a string[] as well as the underlying object if needed


package org.stagemonitor.jdbc.p6spy;

import com.p6spy.engine.logging.Category;
import com.p6spy.engine.spy.appender.P6Logger;

import java.util.LinkedList;
import java.util.List;

public class P6SpyMultiLogger implements P6Logger {

	private static List<P6Logger> loggers = new LinkedList<P6Logger>();

	public static void addLogger(P6Logger logger) {
		if (logger != null) {
			loggers.add(logger);
		}
	}

	@Override
	public void logSQL(int connectionId, String now, long elapsed, Category category, String prepared, String sql) {
		for (P6Logger logger : loggers) {
			if (logger.isCategoryEnabled(category)) {
				logger.logSQL(connectionId, now, elapsed, category, prepared, sql);
			}
		}
	}

	@Override
	public void logException(Exception e) {
		for (P6Logger logger : loggers) {
			logger.logException(e);
		}
	}

	@Override
	public void logText(String text) {
		for (P6Logger logger : loggers) {
			logger.logText(text);
		}
	}

	@Override
	public boolean isCategoryEnabled(Category category) {
		boolean result = false;
		for (P6Logger logger : loggers) {
			result |= logger.isCategoryEnabled(category);
		}
		return result;
	}
}

package org.stagemonitor.jdbc.p6spy;

import com.p6spy.engine.logging.Category;
import com.p6spy.engine.spy.appender.P6Logger;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class P6SpyMultiLogger implements P6Logger {

	private static List<P6Logger> loggers = new CopyOnWriteArrayList<>();

	public static void addLogger(P6Logger logger) {
		if (logger != null) {
			loggers.add(logger);
		}
	}

	@Override
	public void logSQL(int connectionId, String now, long elapsed, Category category, String prepared, String sql) {
		for (P6Logger logger : loggers) {
			if (logger.isCategoryEnabled(category)) {
				logger.logSQL(connectionId, now, elapsed, category, prepared, sql);
			}
		}
	}

	@Override
	public void logException(Exception e) {
		for (P6Logger logger : loggers) {
			logger.logException(e);
		}
	}

	@Override
	public void logText(String text) {
		for (P6Logger logger : loggers) {
			logger.logText(text);
		}
	}

	@Override
	public boolean isCategoryEnabled(Category category) {
		boolean result = false;
		for (P6Logger logger : loggers) {
			result |= logger.isCategoryEnabled(category);
		}
		return result;
	}
}

Fix non thread safe list

Fix non thread safe list

If seen this in our CI:

[INFO] STDOUT: Caused by: java.lang.NullPointerException
at java.util.LinkedList$ListItr.next(LinkedList.java:893)
~[?:1.8.0_60]
at
org.stagemonitor.jdbc.p6spy.P6SpyMultiLogger.isCategoryEnabled(P6SpyMultiLogger.java:45)
~[stagemonitor-jdbc-0.18.0.jar!/:0.18.0]
at
com.p6spy.engine.common.P6LogQuery.isCategoryOk(P6LogQuery.java:169)
~[p6spy-2.1.4.jar!/:?]
at
com.p6spy.engine.common.P6LogQuery.logElapsed(P6LogQuery.java:209)
~[p6spy-2.1.4.jar!/:?]
at
com.p6spy.engine.common.P6LogQuery.logElapsed(P6LogQuery.java:203)
~[p6spy-2.1.4.jar!/:?]
at
com.p6spy.engine.logging.P6LogStatementExecuteDelegate.invoke(P6LogStatementExecuteDelegate.java:51) ~[p6spy-2.1.4.jar!/:?]

Linked Lists and their iterators are not thread safe, so as we have a shared
static instance here I guess that needs to be somewhat safer.


/*
 * Copyright (c) OSGi Alliance (2008, 2009). 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 org.osgi.service.blueprint.reflect;

import java.util.List;

/**
 * A java.util.Properties based value. The properties are defined as string to
 * string. This means that the actual value can be returned.
 *
 * Defined in the props element.
 *
 */
public interface PropsMetadata extends NonNullMetadata {

	/**
	 * This is the same as getValuesMetadata but more type safe.
	 *
	 * Defined in prop sub elements.
	 *
	 * @return
	 */
	List/*<MapEntry>*/ getEntries();
}

/*
 * Copyright (c) OSGi Alliance (2008, 2009). 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 org.osgi.service.blueprint.reflect;

import java.util.List;

/**
 * A java.util.Properties based value. The properties are defined as string to
 * string. This means that the actual value can be returned.
 *
 * Defined in the props element.
 *
 */
public interface PropsMetadata extends NonNullMetadata {

	/**
	 * Defined in prop sub elements.
	 *
	 * @return list of <code.MapEntry objects, never null
	 */
	List/*<MapEntry>*/ getEntries();
}

Comment did not make sense anymore

Comment did not make sense anymore


/*
 * Copyright 2000-2009 JetBrains s.r.o.
 *
 * 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.intellij.xdebugger.impl.actions.handlers;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.project.Project;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import org.jetbrains.annotations.NotNull;

/**
 * @author nik
*/
public class XDebuggerPauseActionHandler extends XDebuggerActionHandler {
  @Override
  protected void perform(@NotNull final XDebugSession session, final DataContext dataContext) {
    session.pause();
  }

  @Override
  public boolean isHidden(@NotNull Project project, AnActionEvent event) {
    final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
    return session == null || !((XDebugSessionImpl)session).isPauseActionSupported();
  }

  @Override
  protected boolean isEnabled(@NotNull final XDebugSession session, final DataContext dataContext) {
    assert session instanceof XDebugSessionImpl;
    return ((XDebugSessionImpl)session).isPauseActionSupported() && !session.isPaused();
  }
}

// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xdebugger.impl.actions.handlers;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.project.Project;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import org.jetbrains.annotations.NotNull;

/**
 * @author nik
*/
public class XDebuggerPauseActionHandler extends XDebuggerActionHandler {
  @Override
  protected void perform(@NotNull final XDebugSession session, final DataContext dataContext) {
    session.pause();
  }

  @Override
  public boolean isHidden(@NotNull Project project, AnActionEvent event) {
    final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
    return session == null || !((XDebugSessionImpl)session).isPauseActionSupported();
  }

  @Override
  protected boolean isEnabled(@NotNull final XDebugSession session, final DataContext dataContext) {
    return !session.isPaused();
  }
}

Revert "Debugger: fix the "Pause" button status." (see IDEA-227619)

This reverts commit bf6fb790

GitOrigin-RevId: 09873c326f8290c4fc8e0002f4d26f4b2eb2ee86


package ch.sheremet.dasfoo.rover.android.client.video;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import ch.sheremet.dasfoo.rover.android.client.R;

/**
 * Created by Katarina Sheremet on 6/7/16 12:00 PM.
 */
public class VideoFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        return inflater.inflate(R.layout.fragment_video, container, false);
    }
}

package ch.sheremet.dasfoo.rover.android.client.video;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import ch.sheremet.dasfoo.rover.android.client.R;

/**
 * Created by Katarina Sheremet on 6/7/16 12:00 PM.
 */
public class VideoFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        return inflater.inflate(R.layout.fragment_video, container, false);
    }

    public void startVideo(View view) {
        //Not implemented yet
        //Todo: add button implementation
    }

    public void stopVideo(View view) {
        //Not implemented yet
        //Todo: add button implementation
    }
}

Add onClick handlers for buttons

Add onClick handlers for buttons


package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_1_9_r1__1_9_r2__1_10;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleVehicleMove;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class VehicleMove extends MiddleVehicleMove<RecyclableCollection<ClientBoundPacketData>> {

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData(ProtocolVersion version) {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_VEHICLE_MOVE, version);
		serializer.writeDouble(x);
		serializer.writeDouble(y);
		serializer.writeDouble(y);
		serializer.writeFloat(yaw);
		serializer.writeFloat(pitch);
		return RecyclableSingletonList.create(serializer);
	}

}

package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_1_9_r1__1_9_r2__1_10;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleVehicleMove;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class VehicleMove extends MiddleVehicleMove<RecyclableCollection<ClientBoundPacketData>> {

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData(ProtocolVersion version) {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_VEHICLE_MOVE, version);
		serializer.writeDouble(x);
		serializer.writeDouble(y);
		serializer.writeDouble(z);
		serializer.writeFloat(yaw);
		serializer.writeFloat(pitch);
		return RecyclableSingletonList.create(serializer);
	}

}

Fix vehicle move serializing (still no idea what it does)


package com.veyndan.redditclient.post.media.mutator;

import com.veyndan.redditclient.api.reddit.model.PostHint;
import com.veyndan.redditclient.post.media.model.Text;
import com.veyndan.redditclient.post.model.Post;

import rx.Observable;

final class TextMutatorFactory implements MutatorFactory {

    static TextMutatorFactory create() {
        return new TextMutatorFactory();
    }

    private TextMutatorFactory() {
    }

    @Override
    public Observable<Post> mutate(final Post post) {
        return Observable.just(post)
                .filter(post1 -> post1.getPostHint().equals(PostHint.SELF))
                .map(post1 -> {
                    post1.setMediaObservable(Observable.just(new Text(post1.getBodyHtml())));
                    return post1;
                });
    }
}

package com.veyndan.redditclient.post.media.mutator;

import android.text.TextUtils;

import com.veyndan.redditclient.api.reddit.model.PostHint;
import com.veyndan.redditclient.post.media.model.Text;
import com.veyndan.redditclient.post.model.Post;

import rx.Observable;

final class TextMutatorFactory implements MutatorFactory {

    static TextMutatorFactory create() {
        return new TextMutatorFactory();
    }

    private TextMutatorFactory() {
    }

    @Override
    public Observable<Post> mutate(final Post post) {
        return Observable.just(post)
                .filter(post1 -> post1.getPostHint().equals(PostHint.SELF) &&
                        !TextUtils.isEmpty(post1.getBodyHtml()))
                .map(post1 -> {
                    post1.setMediaObservable(Observable.just(new Text(post1.getBodyHtml())));
                    return post1;
                });
    }
}

Make self posts without text bodies to not have any media adapter delegate


package com.google.errorprone.bugpatterns;

import com.google.errorprone.CompilationTestHelper;

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

import java.io.File;

/**
 * Unit tests for {@link OrderingFrom}.
 *
 * @author sjnickerson@google.com (Simon Nickerson)
 */
public class OrderingFromTest {

  private CompilationTestHelper compilationHelper;

  @Before
  public void setUp() {
    compilationHelper = new CompilationTestHelper(new OrderingFrom.Scanner());
  }

  @Test
  public void testPositiveCase() throws Exception {
    compilationHelper.assertCompileFailsWithMessages(
        new File(this.getClass().getResource("OrderingFromPositiveCases.java").toURI()));
  }

  //@Test
  public void testNegativeCase() throws Exception {
    compilationHelper.assertCompileSucceeds(
        new File(this.getClass().getResource("OrderingFromNegativeCases.java").toURI()));
  }
}

/*
 * Copyright 2012 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.errorprone.bugpatterns;

import com.google.errorprone.CompilationTestHelper;

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

import java.io.File;

/**
 * Unit tests for {@link OrderingFrom}.
 *
 * @author sjnickerson@google.com (Simon Nickerson)
 */
public class OrderingFromTest {

  private CompilationTestHelper compilationHelper;

  @Before
  public void setUp() {
    compilationHelper = new CompilationTestHelper(new OrderingFrom.Scanner());
  }

  @Test
  public void testPositiveCase() throws Exception {
    compilationHelper.assertCompileFailsWithMessages(
        new File(this.getClass().getResource("OrderingFromPositiveCases.java").toURI()));
  }

  @Test
  public void testNegativeCase() throws Exception {
    compilationHelper.assertCompileSucceeds(
        new File(this.getClass().getResource("OrderingFromNegativeCases.java").toURI()));
  }
}

Enable commented out test for OrderingFrom. (Also add Apache copyright notice)


// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author hmusum
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    @Override
    public void getConfig(ThreadpoolConfig.Builder builder) {
        builder.maxthreads(10);
    }

    @Override
    public void getConfig(QrStartConfig.Builder builder) {
        super.getConfig(builder);
        builder.jvm.heapsize(384);
    }

    protected boolean messageBusEnabled() { return false; }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("http://*/logs");
        addComponent(logHandler);
    }

}

// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author hmusum
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    @Override
    public void getConfig(ThreadpoolConfig.Builder builder) {
        builder.maxthreads(10);
    }

    @Override
    public void getConfig(QrStartConfig.Builder builder) {
        super.getConfig(builder);
        builder.jvm.heapsize(384)
               .verbosegc(true);
    }

    protected boolean messageBusEnabled() { return false; }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("http://*/logs");
        addComponent(logHandler);
    }

}

Use verbose gc logging for logserver-container


/*
 * SPDX-License-Identifier: MIT
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2015-2022 games647 and contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.github.games647.fastlogin.bukkit.listener.protocollib.packet;

import java.security.PublicKey;
import java.time.Instant;

public record ClientPublicKey(Instant expiry, PublicKey key, byte[] signature) {

    public boolean isExpired(Instant verifyTimestamp) {
        return verifyTimestamp.isBefore(expiry);
    }
}

/*
 * SPDX-License-Identifier: MIT
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2015-2022 games647 and contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.github.games647.fastlogin.bukkit.listener.protocollib.packet;

import java.security.PublicKey;
import java.time.Instant;

public record ClientPublicKey(Instant expiry, PublicKey key, byte[] signature) {

    public boolean isExpired(Instant verifyTimestamp) {
        return !verifyTimestamp.isBefore(expiry);
    }
}

Fix public key timestamp verification.

Fix public key timestamp verification.


/*
 * Copyright 2017 The RoboZonky 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.github.robozonky.app.configuration;

import java.time.Duration;

import org.junit.jupiter.api.Test;

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

class MarketplaceCommandLineFragmentTest {

    @Test
    void delayBetweenPrimaryMarketplaceChecks() {
        final MarketplaceCommandLineFragment f = new MarketplaceCommandLineFragment();
        final Duration a = f.getPrimaryMarketplaceCheckDelay();
        assertThat(a).isEqualByComparingTo(Duration.ofSeconds(10));
    }

    @Test
    void delayBetweenSecondaryMarketplaceChecks() {
        final MarketplaceCommandLineFragment f = new MarketplaceCommandLineFragment();
        final Duration a = f.getSecondaryMarketplaceCheckDelay();
        assertThat(a).isEqualByComparingTo(Duration.ofSeconds(10));
    }

}

/*
 * Copyright 2018 The RoboZonky 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.github.robozonky.app.configuration;

import java.time.Duration;

import org.junit.jupiter.api.Test;

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

class MarketplaceCommandLineFragmentTest {

    @Test
    void delayBetweenPrimaryMarketplaceChecks() {
        final MarketplaceCommandLineFragment f = new MarketplaceCommandLineFragment();
        final Duration a = f.getPrimaryMarketplaceCheckDelay();
        assertThat(a).isEqualByComparingTo(Duration.ofSeconds(5));
    }

    @Test
    void delayBetweenSecondaryMarketplaceChecks() {
        final MarketplaceCommandLineFragment f = new MarketplaceCommandLineFragment();
        final Duration a = f.getSecondaryMarketplaceCheckDelay();
        assertThat(a).isEqualByComparingTo(Duration.ofSeconds(5));
    }

}

Fix tests after the previous commit

Fix tests after the previous commit


/*
 * Copyright 2014 the original author or authors.
 *
 * 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.
 */

/**
 * Classes for managing plugin resolution and use.
 */
@org.gradle.api.Incubating
package org.gradle.plugin.use;

/*
 * Copyright 2014 the original author or authors.
 *
 * 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.
 */

/**
 * Classes for managing plugin resolution and use.
 */
@org.gradle.api.Incubating
@org.gradle.api.NonNullApi
package org.gradle.plugin.use;

Cover `org.gradle.plugin.use` with nullability annotations


package org.axonframework.boot.autoconfig;

import org.axonframework.axonserver.connector.query.AxonServerQueryBus;
import org.axonframework.queryhandling.QueryBus;
import org.axonframework.queryhandling.QueryUpdateEmitter;
import org.junit.*;
import org.junit.runner.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

@ContextConfiguration
@EnableAutoConfiguration
@RunWith(SpringRunner.class)
public class AxonServerAutoConfigurationTest {

    @Autowired
    private QueryBus queryBus;

    @Autowired
    private QueryUpdateEmitter updateEmitter;

    @Test
    public void testAxonServerQueryBusConfiguration() {
        assertTrue(queryBus instanceof AxonServerQueryBus);
        assertSame(updateEmitter, queryBus.queryUpdateEmitter());
    }
}

package org.axonframework.boot.autoconfig;

import org.axonframework.axonserver.connector.query.AxonServerQueryBus;
import org.axonframework.queryhandling.QueryBus;
import org.axonframework.queryhandling.QueryUpdateEmitter;
import org.junit.*;
import org.junit.runner.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.EnableMBeanExport;
import org.springframework.jmx.support.RegistrationPolicy;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import static org.junit.Assert.*;

@ContextConfiguration
@EnableAutoConfiguration
@RunWith(SpringRunner.class)
@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
public class AxonServerAutoConfigurationTest {

    @Autowired
    private QueryBus queryBus;

    @Autowired
    private QueryUpdateEmitter updateEmitter;

    @Test
    public void testAxonServerQueryBusConfiguration() {
        assertTrue(queryBus instanceof AxonServerQueryBus);
        assertSame(updateEmitter, queryBus.queryUpdateEmitter());
    }
}

Set test to ignore failed MBean registration


package pl.dawidstepien.jee.examples;

import java.text.SimpleDateFormat;

import javax.enterprise.inject.Produces;
import javax.inject.Inject;

public class SimpleDateFormatProducer {

  @Inject @SimpleDatePattern
  private String pattern;

  @Produces
  public SimpleDateFormat produceSimpleDateFormat() {
    return new SimpleDateFormat(pattern);
  }
}

package pl.dawidstepien.jee.examples;

import java.text.SimpleDateFormat;
import java.util.logging.Logger;

import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;

public class SimpleDateFormatProducer {

  @Inject
  Logger logger;

  @Inject @SimpleDatePattern
  private String pattern;

  @Produces
  public SimpleDateFormat produceSimpleDateFormat() {
    return new SimpleDateFormat(pattern);
  }

  private void objectCreated(@Disposes SimpleDateFormat simpleDateFormat) {
    logger.info("SimpleDateFormat object created.");
  }
}

Add example of a disposer method

Add example of a disposer method


package com.novoda.downloadmanager.lib;

public class PublicFacingStatusTranslator {

    public int translate(int status) {
        switch (status) {
            case DownloadStatus.SUBMITTED:
            case DownloadStatus.PENDING:
                return DownloadManager.STATUS_PENDING;
            case DownloadStatus.RUNNING:
                return DownloadManager.STATUS_RUNNING;
            case DownloadStatus.QUEUED_DUE_CLIENT_RESTRICTIONS:
            case DownloadStatus.PAUSED_BY_APP:
            case DownloadStatus.WAITING_TO_RETRY:
            case DownloadStatus.WAITING_FOR_NETWORK:
            case DownloadStatus.QUEUED_FOR_WIFI:
                return DownloadManager.STATUS_PAUSED;
            case DownloadStatus.PAUSING:
                return DownloadManager.STATUS_PAUSING;
            case DownloadStatus.SUCCESS:
                return DownloadManager.STATUS_SUCCESSFUL;
            case DownloadStatus.DELETING:
                return DownloadManager.STATUS_DELETING;
            default:
                return DownloadManager.STATUS_FAILED;
        }
    }
}

package com.novoda.downloadmanager.lib;

public class PublicFacingStatusTranslator {

    public int translate(int status) {
        switch (status) {
            case DownloadStatus.SUBMITTED:
            case DownloadStatus.PENDING:
            case DownloadStatus.QUEUED_DUE_CLIENT_RESTRICTIONS:
            case DownloadStatus.WAITING_TO_RETRY:
            case DownloadStatus.WAITING_FOR_NETWORK:
            case DownloadStatus.QUEUED_FOR_WIFI:
                return DownloadManager.STATUS_PENDING;
            case DownloadStatus.RUNNING:
                return DownloadManager.STATUS_RUNNING;
            case DownloadStatus.PAUSED_BY_APP:
                return DownloadManager.STATUS_PAUSED;
            case DownloadStatus.PAUSING:
                return DownloadManager.STATUS_PAUSING;
            case DownloadStatus.SUCCESS:
                return DownloadManager.STATUS_SUCCESSFUL;
            case DownloadStatus.DELETING:
                return DownloadManager.STATUS_DELETING;
            default:
                return DownloadManager.STATUS_FAILED;
        }
    }
}

Fix Queued states to be pending instead of paused


package com.novoda.simplechromecustomtabs;

import com.novoda.notils.exception.DeveloperError;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;

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

@RunWith(RobolectricTestRunner.class)
public class SimpleChromeCustomTabsTest {

    @Test
    public void givenSimpleChromeCustomTabsIsNotInitialised_whenGettingInstance_thenDeveloperErrorIsThrown() {
        try {
            SimpleChromeCustomTabs.getInstance();
            fail("A Developer error exception was expected, but there was nothing");
        } catch (DeveloperError e) {
            // passes
        }
    }

    @Test
    public void givenSimpleChromeCustomTabsIsInitialised_whenGettingInstance_thenInstanceIsReturned() {
        SimpleChromeCustomTabs.initialize(RuntimeEnvironment.application);

        assertThat(SimpleChromeCustomTabs.getInstance()).isInstanceOf(SimpleChromeCustomTabs.class);
    }

}

package com.novoda.simplechromecustomtabs;

import com.novoda.notils.exception.DeveloperError;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;

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

@RunWith(RobolectricTestRunner.class)
public class SimpleChromeCustomTabsTest {

    @Test
    public void givenSimpleChromeCustomTabsIsNotInitialised_whenGettingInstance_thenDeveloperErrorIsThrown() {
        /** Please forgive me for what you are seeing. Given some incompatibility issues between Robolectric 3.1.4 and some versions of
         *  Java 8, the @Test(expected = DeveloperError.class) wasn't working.
         *  Will fix when we figure out how.
         **/
        try {
            SimpleChromeCustomTabs.getInstance();
            fail("A Developer error exception was expected, but there was nothing");
        } catch (DeveloperError e) {
            // passes
        }
    }

    @Test
    public void givenSimpleChromeCustomTabsIsInitialised_whenGettingInstance_thenInstanceIsReturned() {
        SimpleChromeCustomTabs.initialize(RuntimeEnvironment.application);

        assertThat(SimpleChromeCustomTabs.getInstance()).isInstanceOf(SimpleChromeCustomTabs.class);
    }

}

Fix broken test on some java 8 versions

Fix broken test on some java 8 versions


package se.vidstige.jadb.managers;

public class Bash {
    public static String quote(String s) {
        // TODO: Should also check other whitespace
        if (!s.contains(" ")) {
            return s;
        }
        return "'" + s.replace("'", "'\\''") + "'";
    }
}

package se.vidstige.jadb.managers;

public class Bash {
    public static String quote(String s) {
        // Check that s contains no whitespace
        if (s.matches("\\S+")) {
            return s;
        }
        return "'" + s.replace("'", "'\\''") + "'";
    }
}

Check other whitespace characters, e.g. tabs


package guitests;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import guitests.guihandles.HelpWindowHandle;

public class HelpWindowTest extends TaskManagerGuiTest {

    @Test
    public void openHelpWindow() {
        //use accelerator
        commandBox.clickOnTextField();
        assertHelpWindowOpen(mainMenu.openHelpWindowUsingAccelerator());

        resultDisplay.clickOnTextArea();
        assertHelpWindowOpen(mainMenu.openHelpWindowUsingAccelerator());

        taskListPanel.clickOnListView();
        assertHelpWindowOpen(mainMenu.openHelpWindowUsingAccelerator());

        //use menu button
        assertHelpWindowOpen(mainMenu.openHelpWindowUsingMenu());

        //use command
        assertHelpWindowOpen(commandBox.runHelpCommand());
    }

    private void assertHelpWindowOpen(HelpWindowHandle helpWindowHandle) {
        assertTrue(helpWindowHandle.isWindowOpen());
        helpWindowHandle.closeWindow();
    }

    private void assertHelpWindowNotOpen(HelpWindowHandle helpWindowHandle) {
        assertFalse(helpWindowHandle.isWindowOpen());
    }

}

package guitests;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import guitests.guihandles.HelpWindowHandle;

public class HelpWindowTest extends TaskManagerGuiTest {

    @Test
    public void openHelpWindow() {
        //use accelerator
        commandBox.clickOnTextField();
        assertHelpWindowOpen(mainMenu.openHelpWindowUsingAccelerator());
//
//        resultDisplay.clickOnTextArea();
//        assertHelpWindowOpen(mainMenu.openHelpWindowUsingAccelerator());

        taskListPanel.clickOnListView();
        assertHelpWindowOpen(mainMenu.openHelpWindowUsingAccelerator());

        //use menu button
        assertHelpWindowOpen(mainMenu.openHelpWindowUsingMenu());

        //use command
        assertHelpWindowOpen(commandBox.runHelpCommand());
    }

    private void assertHelpWindowOpen(HelpWindowHandle helpWindowHandle) {
        assertTrue(helpWindowHandle.isWindowOpen());
        helpWindowHandle.closeWindow();
    }

    private void assertHelpWindowNotOpen(HelpWindowHandle helpWindowHandle) {
        assertFalse(helpWindowHandle.isWindowOpen());
    }

}

Comment out resultDisplay check for Help Window test


/**
 * Write a description of interface Spot here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class ViewSpot
{
    private boolean hit;
    public ViewSpot()
    {
        hit=false;
    }
    public void changeHit()
    {
        if (hit==false)
        {
            hit=true;
        }
    }
}

/**
 * Write a description of interface Spot here.
 *
 * @Basit Malik
 * @version (a version number or a date)
 */
public class ViewSpot
{
    private boolean hit;
    public ViewSpot()
    {
        hit=false;
    }
    public boolean changeHit()//The else with a return of false is so that we can prompt the player to
                              //choose again if the method returns false so they cannot choose the
                              //same spot twice
    {
        if (hit==false)
        {
            hit=true;
            return true;
        }
        else
        {
            return false;
        }
    }
}

Read the description for changeHit in the viewspot class to know how to use it properly


package model;

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

/**
 * Created by Elliad on 2016-05-08.
 */
public class FileModelTest {
    @Test
    public void singletonTest() {
        assertNotNull(FileModel.getModel());
    }

    @Test
    public void fileReadTest() {
        FileModel.getModel().readFiles("A.txt", "B.txt");
        assertNotNull(FileModel.fileA);
        assertNotNull(FileModel.fileB);
    }

    @Test
    public void fileWriteTest() {

    }
}

package model;

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

/**
 * Created by Elliad on 2016-05-08.
 */
public class FileModelTest {
    @Test
    public void singletonTest() {
        assertNotNull(FileModel.getModel());
    }

    @Test
    public void fileReadTest() {
        FileModel.getModel().readFiles("A.txt", "B.txt");
        //assertArrayEquals(FileModel.fileA.);
        assertNotNull(FileModel.fileA);
        assertNotNull(FileModel.fileB);
    }

    @Test
    public void fileWriteTest() {

    }
}

Add Model Read test file 그리고 뭔지 모르겠는 경고가 하나 뜬다 ,,,;;


package org.ovirt.engine.ui.common.widget.table.column;

import org.ovirt.engine.core.common.businessentities.Permissions;

import com.google.gwt.resources.client.ImageResource;

/**
 * Image column that corresponds to XAML {@code PermissionTypeDataTemplate}.
 */
public class PermissionTypeColumn extends ImageResourceColumn<Permissions> {

    @Override
    public ImageResource getValue(Permissions user) {
        switch (user.getRoleType()) {
        case ADMIN:
            return getCommonResources().adminImage();
        case USER:
            return getCommonResources().userImage();
        default:
            return getCommonResources().userImage();
        }
    }

}

package org.ovirt.engine.ui.common.widget.table.column;

import java.util.Comparator;

import org.ovirt.engine.core.common.businessentities.Permissions;

import com.google.gwt.resources.client.ImageResource;

/**
 * Image column that corresponds to XAML {@code PermissionTypeDataTemplate}.
 */
public class PermissionTypeColumn extends ImageResourceColumn<Permissions> {

    public PermissionTypeColumn() {
        makeSortable(new Comparator<Permissions>() {

            @Override
            public int compare(Permissions o1, Permissions o2) {
                if (getValue(o1).equals(getValue(o2))) {
                    return 0;
                } else {
                    return (getCommonResources().userImage().equals(getValue(o1))) ? -1 : 1;
                }
            }
        });
    }

    @Override
    public ImageResource getValue(Permissions user) {
        switch (user.getRoleType()) {
        case ADMIN:
            return getCommonResources().adminImage();
        case USER:
            return getCommonResources().userImage();
        default:
            return getCommonResources().userImage();
        }
    }

}

webadmin: Implement permission sorting by role icon

Implemented sorting for permission subtabs according to the role icon
(ordinary user is lesser than administrator).

Change-Id: I3a2c97315bda060e44b662562e1e08652881d72f
Signed-off-by: Lior Vernia <0888e9bab805ddf64d6b8b84d91c33e7509a697e@redhat.com>


package io.tracee.contextlogger.jaxws.container;

import io.tracee.Tracee;
import io.tracee.TraceeBackend;
import io.tracee.TraceeLogger;
import io.tracee.jaxws.container.TraceeServerHandler;

import javax.xml.ws.handler.soap.SOAPMessageContext;

/**
 * JaxWs client side handler that detects uncaught exceptions and outputs contextual information.
 */
public class TraceeClientErrorLoggingHandler extends AbstractTraceeErrorLoggingHandler {

    private final TraceeLogger traceeLogger = this.getTraceeBackend().getLoggerFactory().getLogger(
            TraceeServerHandler.class);

    TraceeClientErrorLoggingHandler(TraceeBackend traceeBackend) {
        super(traceeBackend);
    }

    public TraceeClientErrorLoggingHandler() {
        this(Tracee.getBackend());
    }

    @Override
    protected final void handleIncoming(SOAPMessageContext context) {
        // Do nothing
    }

    @Override
    protected final void handleOutgoing(SOAPMessageContext context) {
        storeMessageInThreadLocal(context);
    }

}

package io.tracee.contextlogger.jaxws.container;

import io.tracee.Tracee;
import io.tracee.TraceeBackend;
import io.tracee.TraceeLogger;
import io.tracee.jaxws.container.TraceeServerHandler;

import javax.xml.ws.handler.soap.SOAPMessageContext;

/**
 * JaxWs client side handler that detects uncaught exceptions and outputs contextual information.
 */
public class TraceeClientErrorLoggingHandler extends AbstractTraceeErrorLoggingHandler {

    TraceeClientErrorLoggingHandler(TraceeBackend traceeBackend) {
        super(traceeBackend);
    }

    public TraceeClientErrorLoggingHandler() {
        this(Tracee.getBackend());
    }

    @Override
    protected final void handleIncoming(SOAPMessageContext context) {
        // Do nothing
    }

    @Override
    protected final void handleOutgoing(SOAPMessageContext context) {
        storeMessageInThreadLocal(context);
    }

}

Remove unused variables and fields

Remove unused variables and fields


/*++

NASM Assembly Language Plugin
Copyright (c) 2017-2018 Aidan Khoury. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

--*/

package com.nasmlanguage.psi;

import com.intellij.psi.tree.IElementType;
import com.nasmlanguage.NASMLanguage;
import org.jetbrains.annotations.*;

public class NASMElementType extends IElementType {

    public NASMElementType(@NotNull @NonNls String debugName) {
        super(debugName, NASMLanguage.INSTANCE);
    }
}

/*++

NASM Assembly Language Plugin
Copyright (c) 2017-2018 Aidan Khoury

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--*/

package com.nasmlanguage.psi;

import com.intellij.psi.tree.IElementType;
import com.nasmlanguage.NASMLanguage;
import org.jetbrains.annotations.*;

public class NASMElementType extends IElementType {

    public NASMElementType(@NotNull @NonNls String debugName) {
        super(debugName, NASMLanguage.INSTANCE);
    }
}

Update copyright notice with MIT license


package test;

import dotty.tools.dotc.core.Contexts;
import org.junit.*;

import java.lang.ref.WeakReference;
import java.util.LinkedList;
import java.util.List;

public abstract class ContextEscapeDetection {
    public static class TestContext{
        public TestContext(WeakReference<Contexts.Context> context, String testName) {
            this.context = context;
            this.testName = testName;
        }

        public final WeakReference<Contexts.Context> context;
        public final String testName;

    }
    public static final List<TestContext> contexts = new LinkedList<>();

    public abstract Contexts.Context getCtx();

    public abstract void clearCtx();

    @Before
    public synchronized void stealContext() {
        contexts.add(new TestContext(new WeakReference<>(this.getCtx()), this.getClass().getName()));
    }

    @After
    public synchronized void clearContext() {
        this.clearCtx();
    }

}

package test;

import dotty.tools.dotc.core.Contexts;
import org.junit.*;

import java.lang.ref.WeakReference;
import java.util.LinkedList;
import java.util.List;

public abstract class ContextEscapeDetection {
    public static class TestContext{
        public TestContext(WeakReference<Contexts.Context> context, String testName) {
            this.context = context;
            this.testName = testName;
        }

        public final WeakReference<Contexts.Context> context;
        public final String testName;

    }
    public static final List<TestContext> contexts = new LinkedList<TestContext>();

    public abstract Contexts.Context getCtx();

    public abstract void clearCtx();

    @Before
    public synchronized void stealContext() {
        contexts.add(new TestContext(new WeakReference<Contexts.Context>(this.getCtx()), this.getClass().getName()));
    }

    @After
    public synchronized void clearContext() {
        this.clearCtx();
    }

}

Make java file compile under 1.6.

Make java file compile under 1.6.

I still have 1.6 installed. So the two simple fixes are necessary to make my build pass for now.


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

import io.airlift.configuration.Config;

public class EventStreamConfig {
    private boolean enabled = true;

    @Config("event.stream.enabled")
    public void setEventStreamEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public boolean getEventStreamEnabled() {
        return enabled;
    }
}

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

import io.airlift.configuration.Config;

public class EventStreamConfig {
    private boolean enabled = false;

    @Config("event.stream.enabled")
    public void setEventStreamEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public boolean getEventStreamEnabled() {
        return enabled;
    }
}

Set default value for event stream module