/**
 * Copyright 2013 Asakusa Framework Team.
 *
 * 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.asakusafw.shafu.internal.asakusafw.preferences;

/**
 * Preference constants of Shafu Asakusa Plug-in.
 */
public final class ShafuAsakusaPreferenceConstants {

    /**
     * The preference key of catalog URL.
     */
    public static final String KEY_CATALOG_URL = "catalog"; //$NON-NLS-1$

    /**
     * The default value of catalog URL.
     */
    public static final String DEFAULT_CATALOG_URL =
            "http://www.asakusafw.com/download/gradle-plugin/template-catalog.txt"; //$NON-NLS-1$

    private ShafuAsakusaPreferenceConstants() {
        return;
    }
}

/**
 * Copyright 2013 Asakusa Framework Team.
 *
 * 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.asakusafw.shafu.internal.asakusafw.preferences;

/**
 * Preference constants of Shafu Asakusa Plug-in.
 */
public final class ShafuAsakusaPreferenceConstants {

    /**
     * The URL (prefix) of download site.
     */
    private static final String URL_DOWNLOAD_SITE = "http://www.asakusafw.com/download/gradle-plugin/"; //$NON-NLS-1$

    /**
     * The preference key of catalog URL.
     */
    public static final String KEY_CATALOG_URL = "catalog"; //$NON-NLS-1$

    /**
     * The default value of catalog URL.
     */
    public static final String DEFAULT_CATALOG_URL = URL_DOWNLOAD_SITE + "template-catalog-release.txt"; //$NON-NLS-1$

    private ShafuAsakusaPreferenceConstants() {
        return;
    }
}

Change asakusafw project template catalog URL.


package ${packageName};

import static org.junit.Assert.*;

public class ${testClassName} {

    private final ${productionClassName} production = new ${productionClassName}("value");

    @org.junit.Test
    public void testOne() throws Exception {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testOne - " + i);
            System.err.println("Some test error  from ${testClassName}.testOne - " + i);
            if (i % 50 == 0) {
                Thread.sleep(1);
            }
        }
        assertEquals(production.getProperty(), "value");
    }

    @org.junit.Test
    public void testTwo() throws Exception {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testTwo - " + i);
            System.err.println("Some test error  from ${testClassName}.testTwo - " + i);
            if (i % 50 == 0) {
                Thread.sleep(1);
            }
        }
        String expected = <%= binding.hasVariable("halfTestsFail") && binding.halfTestsFail ? "\"foo\"" : "\"value\"" %>;
        assertEquals(production.getProperty(), expected);
    }
}

package ${packageName};

import static org.junit.Assert.*;

public class ${testClassName} {

    private final ${productionClassName} production = new ${productionClassName}("value");

    @org.junit.Test
    public void testOne() throws Exception {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testOne - " + i);
            System.err.println("Some test error  from ${testClassName}.testOne - " + i);
            if (i % 20 == 0) {
                Thread.sleep(1);
            }
        }
        assertEquals(production.getProperty(), "value");
    }

    @org.junit.Test
    public void testTwo() throws Exception {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testTwo - " + i);
            System.err.println("Some test error  from ${testClassName}.testTwo - " + i);
            if (i % 20 == 0) {
                Thread.sleep(1);
            }
        }
        String expected = <%= binding.hasVariable("halfTestsFail") && binding.halfTestsFail ? "\"foo\"" : "\"value\"" %>;
        assertEquals(production.getProperty(), expected);
    }
}

Make tests more realistic by doing some “work” other than writing console output, moreso.


//Foobar
package ch.uzh.ifi.dachs.pizza;

public class Pizza {

	public static void main(String[] args) {
		// Parameter inpute filename
		System.out.println("Dachs Pizza");
	}

}

//Foobar
package ch.uzh.ifi.dachs.pizza;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Pizza {

	static {
		StackTraceElement[] stack = Thread.currentThread().getStackTrace();
		StackTraceElement main = stack[stack.length - 1];
		PROGRAM_NAME = main.getClassName();
	}

	public static String PROGRAM_NAME;

	public static void main(String[] args) throws FileNotFoundException {
		// Parameter inpute filename
		if(args.length != 1) {
			System.out.println("Usage: " + Pizza.PROGRAM_NAME + " input_filename");
			return;
		}

		String filename = args[0];
		Scanner scanner = new Scanner(new File(filename));

		int rows = scanner.nextInt();
		int columns = scanner.nextInt();
		int ingredients = scanner.nextInt();
		int max_cells = scanner.nextInt();

		Pizza solution = new Pizza(rows, columns, ingredients, max_cells);

		String line;
		int i = 0;
		while(scanner.hasNextLine()) {
			line = scanner.nextLine();
			if(line.isEmpty()) {
				continue;
			}
			for(int j = 0; j < columns; j++) {
				solution.setCell(i, j, line.charAt(j));
			}
			i++;
		}

		scanner.close();

		System.out.println(solution.asciiMatrix());
	}

	private int rows;
	private int columns;
	private int ingredients;
	private int max_cells;

	private static final boolean T = true;
	private static final boolean M = false;

	private boolean pizza[][];

	public Pizza(int rows, int columns, int ingredients, int max_cells) {
		this.rows = rows;
		this.columns = columns;
		this.ingredients = ingredients;
		this.max_cells = max_cells;

		this.pizza = new boolean[rows][columns];
	}

	private boolean parseCellValue(char cell) {
		return cell == 'T';
	}

	private String asciiCellValue(boolean cell) {
		return cell ? "T" : "M";
	}

	public void setCell(int row, int column, char cell) {
		this.pizza[row][column] = this.parseCellValue(cell);
	}

	public String asciiMatrix() {
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < this.rows; i++) {
			for(int j = 0; j < this.columns; j++) {
				sb.append(this.asciiCellValue(this.pizza[i][j]));
			}
			sb.append("\n");
		}
		return sb.toString();
	}
}

Read input and print matrix (pizza) state


package com.azure.tools.apiview.processor.diagnostics.rules;

import com.azure.tools.apiview.processor.diagnostics.DiagnosticRule;
import com.azure.tools.apiview.processor.model.APIListing;
import com.azure.tools.apiview.processor.model.Diagnostic;
import com.github.javaparser.ast.CompilationUnit;

import java.util.regex.Pattern;

import static com.azure.tools.apiview.processor.analysers.util.ASTUtils.*;

public class PackageNameDiagnosticRule implements DiagnosticRule {
    final static Pattern regex = Pattern.compile("^com.azure.[a-z0-9]*(\\.[a-z0-9]+)+[0-9a-z]$");

    @Override
    public void scan(final CompilationUnit cu, final APIListing listing) {
        getPackageName(cu).ifPresent(packageName -> {
            // we need to map the issue to the class id, because package text isn't printed in the APIView output
            getClassName(cu).map(listing.getKnownTypes()::get).ifPresent(typeId -> {
                if (!regex.matcher(packageName).matches()) {
                    listing.addDiagnostic(new Diagnostic(typeId,
                            "Package name must start with 'com.azure', and it must be lower-case, with no underscores or hyphens."));
                }
            });
        });
    }
}

package com.azure.tools.apiview.processor.diagnostics.rules;

import com.azure.tools.apiview.processor.diagnostics.DiagnosticRule;
import com.azure.tools.apiview.processor.model.APIListing;
import com.azure.tools.apiview.processor.model.Diagnostic;
import com.github.javaparser.ast.CompilationUnit;

import java.util.regex.Pattern;

import static com.azure.tools.apiview.processor.analysers.util.ASTUtils.*;

public class PackageNameDiagnosticRule implements DiagnosticRule {
    final static Pattern regex = Pattern.compile("^com.azure(\\.[a-z0-9]+)+$");

    @Override
    public void scan(final CompilationUnit cu, final APIListing listing) {
        getPackageName(cu).ifPresent(packageName -> {
            // we need to map the issue to the class id, because package text isn't printed in the APIView output
            getClassName(cu).map(listing.getKnownTypes()::get).ifPresent(typeId -> {
                if (!regex.matcher(packageName).matches()) {
                    listing.addDiagnostic(new Diagnostic(typeId,
                            "Package name must start with 'com.azure', and it must be lower-case, with no underscores or hyphens."));
                }
            });
        });
    }
}

Fix regex for package naming diagnostic


package ee.tuleva.onboarding.account;

import ee.tuleva.onboarding.auth.principal.Person;
import ee.tuleva.onboarding.epis.EpisService;
import ee.tuleva.onboarding.epis.account.FundBalanceDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

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

@Service
@Slf4j
@RequiredArgsConstructor
public class AccountStatementService {

  private final EpisService episService;
  private final FundBalanceDtoToFundBalanceConverter fundBalanceConverter;

  public List<FundBalance> getAccountStatement(Person person) {
    List<FundBalanceDto> accountStatement = episService.getAccountStatement(person);

    return accountStatement.stream()
        .map(fundBalanceDto -> convertToFundBalance(fundBalanceDto, person))
        .collect(toList());
  }

  private FundBalance convertToFundBalance(FundBalanceDto fundBalanceDto, Person person) {
    try {
      return fundBalanceConverter.convert(fundBalanceDto);
    } catch(IllegalArgumentException e) {
      throw new IllegalStateException("Could not convert fund balance for person " + person, e);
    }
  }
}

package ee.tuleva.onboarding.account;

import ee.tuleva.onboarding.auth.principal.Person;
import ee.tuleva.onboarding.epis.EpisService;
import ee.tuleva.onboarding.epis.account.FundBalanceDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

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

@Service
@Slf4j
@RequiredArgsConstructor
public class AccountStatementService {

  private final EpisService episService;
  private final FundBalanceDtoToFundBalanceConverter fundBalanceConverter;

  public List<FundBalance> getAccountStatement(Person person) {
    List<FundBalanceDto> accountStatement = episService.getAccountStatement(person);

    return accountStatement.stream()
        .map(fundBalanceDto -> convertToFundBalance(fundBalanceDto, person))
        .collect(toList());
  }

  private FundBalance convertToFundBalance(FundBalanceDto fundBalanceDto, Person person) {
    try {
        if (log.isDebugEnabled()) {
            log.debug("Fund Balance DTO:" + fundBalanceDto);
        }
      return fundBalanceConverter.convert(fundBalanceDto);
    } catch(IllegalArgumentException e) {
      throw new IllegalStateException("Could not convert fund balance for person " + person, e);
    }
  }
}

Allow log-in for people who don+t have pension account Enable DTO debug


// (c) 2012 B Smith-Mannschott -- Distributed under the Eclipse Public License
package bpsm.edn.model;

import bpsm.edn.parser.util.Interner;

public final class Keyword implements Named, Comparable<Keyword> {
    private final Symbol sym;

    public final String getPrefix() {
        return sym.getPrefix();
    }

    public final String getName() {
        return sym.getName();
    }

    public static Keyword newKeyword(Symbol sym) {
        return INTERNER.intern(sym, new Keyword(sym));
    }

    private Keyword(Symbol sym) {
        if (sym == null) {
            throw new NullPointerException();
        }
        this.sym = sym;
    }

    public String toString() {
        return ":" + sym.toString();
    }

    public int compareTo(Keyword o) {
        return sym.compareTo(o.sym);
    }

    private static final Interner<Symbol, Keyword> INTERNER =
            new Interner<Symbol, Keyword>();

}

// (c) 2012 B Smith-Mannschott -- Distributed under the Eclipse Public License
package bpsm.edn.model;

import bpsm.edn.parser.util.Interner;

public final class Keyword implements Named, Comparable<Keyword> {
    private final Symbol sym;

    public final String getPrefix() {
        return sym.getPrefix();
    }

    public final String getName() {
        return sym.getName();
    }

    public static Keyword newKeyword(Symbol sym) {
        return INTERNER.intern(sym, new Keyword(sym));
    }

    private Keyword(Symbol sym) {
        if (sym == null) {
            throw new NullPointerException();
        }
        this.sym = sym;
    }

    public String toString() {
        return ":" + sym.toString();
    }

    public int compareTo(Keyword o) {
    	if (this==o) return 0;
        return sym.compareTo(o.sym);
    }

    private static final Interner<Symbol, Keyword> INTERNER =
            new Interner<Symbol, Keyword>();

}

Add fast path for comparing to an identical (interned) keyword


/*
 * Copyright (C) 2014 Red Hat, Inc.
 *
 * 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
 *
 *  Authors : Dave Tucker
 */

package org.opendaylight.neutron.northbound.api;

import org.opendaylight.neutron.spi.INeutronObject;

import java.util.List;

public interface INeutronRequest<T extends INeutronObject> {
    public T getSingleton();
    public boolean isSingleton();
    public List<T> getBulk();
}

/*
 * Copyright (C) 2014 Red Hat, Inc.
 *
 * 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
 *
 *  Authors : Dave Tucker
 */

package org.opendaylight.neutron.northbound.api;

import org.opendaylight.neutron.spi.INeutronObject;

import java.util.List;

public interface INeutronRequest<T extends INeutronObject> {
    T getSingleton();
    boolean isSingleton();
    List<T> getBulk();
}

Remove redundant modifiers from northbound interfaces


package org.ovirt.engine.core.utils;

import org.ovirt.engine.core.common.utils.EnumUtils;

import junit.framework.TestCase;

public class EnumUtilsTest extends TestCase {
    public void testConvertToStringWithSpaces() {
        assertEquals("Hello There", EnumUtils.ConvertToStringWithSpaces("HelloThere"));
    }
}

package org.ovirt.engine.core.utils;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.ovirt.engine.core.common.utils.EnumUtils;

public class EnumUtilsTest {

    @Test
    public void convertToStringWithSpaces() {
        assertEquals("Hello There", EnumUtils.ConvertToStringWithSpaces("HelloThere"));
    }
}

Change to JUnit 4 test


package io.quarkus.smallrye.reactivemessaging.runtime;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

import javax.enterprise.context.Dependent;
import javax.enterprise.event.Observes;
import javax.inject.Inject;

import io.quarkus.runtime.StartupEvent;
import io.smallrye.reactive.messaging.extension.MediatorManager;

@Dependent
public class SmallRyeReactiveMessagingLifecycle {

    @Inject
    MediatorManager mediatorManager;

    void onApplicationStart(@Observes StartupEvent event) {
        CompletableFuture<Void> future = mediatorManager.initializeAndRun();
        try {
            future.get();
        } catch (ExecutionException e) {
            throw new RuntimeException(e.getCause());
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

}

package io.quarkus.smallrye.reactivemessaging.runtime;

import javax.enterprise.context.Dependent;
import javax.enterprise.event.Observes;
import javax.inject.Inject;

import io.quarkus.runtime.StartupEvent;
import io.smallrye.reactive.messaging.extension.MediatorManager;

@Dependent
public class SmallRyeReactiveMessagingLifecycle {

    @Inject
    MediatorManager mediatorManager;

    void onApplicationStart(@Observes StartupEvent event) {
        try {
            mediatorManager.initializeAndRun();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}

Update how is started the Reactive Messaging provider


package ca.intelliware.ihtsdo.mlds.registration;

import java.util.List;

import javax.annotation.Resource;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:applicationContext.xml", "classpath:applicationContext-integrationTest.xml"})
public class UserRegistrationIntegrationTest {
	@Resource
	UserRegistrationController controller;

	@Resource
	UserRegistrationRepository userRegistrationRepository;

	@Test
	public void createRegistrationViaAPIAndFindIt() throws Exception {
		String email = "email" + System.currentTimeMillis() + "@example.com";
		controller.createRegistration(email);

		List<UserRegistration> found = userRegistrationRepository.findByEmail(email);
		Assert.assertTrue("found some", !found.isEmpty());

	}
}

package ca.intelliware.ihtsdo.mlds.registration;

import java.util.List;

import javax.annotation.Resource;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={
		"classpath:applicationContext.xml",
		"classpath:applicationContext-integrationTest.xml",
		"file:src/main/webapp/WEB-INF/dispatcher-servlet.xml"})
public class UserRegistrationIntegrationTest {
	@Resource
	UserRegistrationController controller;

	@Resource
	UserRegistrationRepository userRegistrationRepository;

	@Test
	public void createRegistrationViaAPIAndFindIt() throws Exception {
		String email = "email" + System.currentTimeMillis() + "@example.com";
		controller.createRegistration(email);

		List<UserRegistration> found = userRegistrationRepository.findByEmail(email);
		Assert.assertTrue("found some", !found.isEmpty());

	}
}

Fix up test definition to account for pushing @Controller definitions out to servlet context


package org.atlasapi.application.auth;

import static com.google.common.base.Preconditions.checkNotNull;

import javax.servlet.http.HttpServletRequest;

import org.atlasapi.application.Application;
import org.atlasapi.application.ApplicationSources;
import org.atlasapi.application.ApplicationStore;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;

public class ApiKeySourcesFetcher implements ApplicationSourcesFetcher {

    public static final String API_KEY_QUERY_PARAMETER = "key";

    private final ApplicationStore reader;

    public ApiKeySourcesFetcher(ApplicationStore reader) {
        this.reader = checkNotNull(reader);
    }

    @Override
    public ImmutableSet<String> getParameterNames() {
        return ImmutableSet.of(API_KEY_QUERY_PARAMETER);
    }

    @Override
    public Optional<ApplicationSources> sourcesFor(HttpServletRequest request) throws InvalidApiKeyException  {
        String apiKey = request.getParameter(API_KEY_QUERY_PARAMETER);
        if (apiKey == null) {
            apiKey = request.getHeader(API_KEY_QUERY_PARAMETER);
        }
        if (apiKey != null) {
            Optional<Application> app = reader.applicationForKey(apiKey);
            if (!app.isPresent() || app.get().isRevoked()) {
                throw new InvalidApiKeyException(apiKey);
            }
            return Optional.of(app.get().getSources());
        }
        return Optional.absent();
    }
}

package org.atlasapi.application.auth;

import static com.google.common.base.Preconditions.checkNotNull;

import javax.servlet.http.HttpServletRequest;

import org.atlasapi.application.Application;
import org.atlasapi.application.ApplicationSources;
import org.atlasapi.application.ApplicationStore;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;

public class ApiKeySourcesFetcher implements ApplicationSourcesFetcher {

    public static final String API_KEY_QUERY_PARAMETER = "key";

    private final ApplicationStore reader;

    public ApiKeySourcesFetcher(ApplicationStore reader) {
        this.reader = checkNotNull(reader);
    }

    @Override
    public ImmutableSet<String> getParameterNames() {
        return ImmutableSet.of();
    }

    @Override
    public Optional<ApplicationSources> sourcesFor(HttpServletRequest request) throws InvalidApiKeyException  {
        String apiKey = request.getParameter(API_KEY_QUERY_PARAMETER);
        if (apiKey == null) {
            apiKey = request.getHeader(API_KEY_QUERY_PARAMETER);
        }
        if (apiKey != null) {
            Optional<Application> app = reader.applicationForKey(apiKey);
            if (!app.isPresent() || app.get().isRevoked()) {
                throw new InvalidApiKeyException(apiKey);
            }
            return Optional.of(app.get().getSources());
        }
        return Optional.absent();
    }
}

Revert "Revert "api key deleted from the list of required parameters""


/*
 * Copyright 2015 Real Logic Ltd.
 *
 * 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 uk.co.real_logic.benchmarks.latency;

public class Configuration
{
    public static final int MAX_THREAD_COUNT = 4;
    public static final int SEND_QUEUE_CAPACITY = 64 * 1024;
    public static final int RESPONSE_QUEUE_CAPACITY = 4 * 1024;
}

/*
 * Copyright 2015 Real Logic Ltd.
 *
 * 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 uk.co.real_logic.benchmarks.latency;

public class Configuration
{
    public static final int MAX_THREAD_COUNT = 4;
    public static final int SEND_QUEUE_CAPACITY = 64 * 1024;
    public static final int RESPONSE_QUEUE_CAPACITY = 32 * 1024;
}

Increase size of response queue.


package de.timroes.axmlrpc.serializer;

import java.text.SimpleDateFormat;

import org.w3c.dom.Element;

import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import fr.turri.jiso8601.Iso8601Deserializer;

/**
 *
 * @author timroes
 */
public class DateTimeSerializer implements Serializer {

	private static final String DATETIME_FORMAT = "yyyyMMdd'T'HHmmss";
	private final SimpleDateFormat DATE_FORMATER = new SimpleDateFormat(DATETIME_FORMAT);

	@Override
	public Object deserialize(Element content) throws XMLRPCException {
		return deserialize(XMLUtil.getOnlyTextContent(content.getChildNodes()));
	}

	public Object deserialize(String dateStr) throws XMLRPCException {
		try {
			return Iso8601Deserializer.toDate(dateStr);
		} catch (Exception ex) {
			throw new XMLRPCException("Unable to parse given date.", ex);
		}
	}

	@Override
	public XmlElement serialize(Object object) {
		return XMLUtil.makeXmlTag(SerializerHandler.TYPE_DATETIME,
				DATE_FORMATER.format(object));
	}

}

package de.timroes.axmlrpc.serializer;

import java.text.SimpleDateFormat;

import org.w3c.dom.Element;

import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import fr.turri.jiso8601.Iso8601Deserializer;

/**
 *
 * @author timroes
 */
public class DateTimeSerializer implements Serializer {

	private static final String DATETIME_FORMAT = "yyyyMMdd'T'HHmmss";
	private final SimpleDateFormat DATE_FORMATER = new SimpleDateFormat(DATETIME_FORMAT);

	@Override
	public Object deserialize(Element content) throws XMLRPCException {
		return deserialize(XMLUtil.getOnlyTextContent(content.getChildNodes()));
	}

	public Object deserialize(String dateStr) throws XMLRPCException {
		if (dateStr==null || dateStr.trim().length()==0)
			return null;
		try {
			return Iso8601Deserializer.toDate(dateStr);
		} catch (Exception ex) {
			throw new XMLRPCException("Unable to parse given date.", ex);
		}
	}

	@Override
	public XmlElement serialize(Object object) {
		return XMLUtil.makeXmlTag(SerializerHandler.TYPE_DATETIME,
				DATE_FORMATER.format(object));
	}

}

Return empty datetime elements as NULL


package org.ligoj.app.plugin.prov.model;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import lombok.Getter;
import lombok.Setter;

/**
 * Storage price for a storage type.

 * The meaning to the cost attribute is the monthly cost of 1GiB (1024 MiB).
 */
@Getter
@Setter
@Entity
@Table(name = "LIGOJ_PROV_STORAGE_PRICE", uniqueConstraints = @UniqueConstraint(columnNames = { "type", "location" }))
public class ProvStoragePrice extends AbstractPrice<ProvStorageType> {

	/**
	 * The monthly cost of 1GiB (Gibibyte Bytes).
	 * @see https://en.wikipedia.org/wiki/Gibibyte
	 */
	private double costGb = 0;

	/**
	 * The cost per transaction. May be 0.
	 */
	private double costTransaction;
}

package org.ligoj.app.plugin.prov.model;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import lombok.Getter;
import lombok.Setter;

/**
 * Storage price for a storage type.

 * The meaning to the cost attribute is the monthly cost of 1GiB (1024 MiB).
 */
@Getter
@Setter
@Entity
@Table(name = "LIGOJ_PROV_STORAGE_PRICE", uniqueConstraints = @UniqueConstraint(columnNames = { "type", "location" }))
public class ProvStoragePrice extends AbstractPrice<ProvStorageType> {

	/**
	 * The monthly cost of 1GiB (Gibibyte Bytes).
	 * @see https://en.wikipedia.org/wiki/Gibibyte
	 */
	private double costGb = 0;

	/**
	 * The cost per million transactions. May be 0.
	 */
	private double costTransaction;
}

Use 1M transaction cost model instead of 10,000


package org.sagebionetworks.web.client.cookie;

/**
 * The cookie key master.  Don't tell the cookie monster!
 *
 * @author jmhill
 *
 */
public class CookieKeys {

	/**
	 * Key for the selected columns shown in the datasets table.
	 */
	public static String SELECTED_DATASETS_COLUMNS = "org.sagebionetworks.datasets.selected.columns";

	/**
	 * Key for the selected filters applied on the datasets table.
	 */
	public static String APPLIED_DATASETS_FILTERS = "org.sagebionetworks.datasets.applied.filters";

	/**
	 * Login token
	 */
	public static String USER_LOGIN_TOKEN = "org.sagbionetworks.security.user.login.token";

	/**
	 * Login token
	 */
	public static String SHOW_DEMO = "org.sagbionetworks.synapse.show.demo";

	/**
	 * Last Place in the app
	 */
	public static String LAST_PLACE = "org.sagbionetworks.synapse.place.last.place";

	/**
	 * Current Place in the app
	 */
	public static String CURRENT_PLACE = "org.sagbionetworks.synapse.place.current.place";

	/**
	 * LinkedIn requestToken key
	 */
	public static String LINKEDIN = "org.sagebionetworks.synapse.linkedin";

	/**
	 * Get Satisfaction fastpass key
	 */
	public static String FASTPASS = "fastpass";
}

package org.sagebionetworks.web.client.cookie;

/**
 * The cookie key master.  Don't tell the cookie monster!
 *
 * @author jmhill
 *
 */
public class CookieKeys {

	/**
	 * Key for the selected columns shown in the datasets table.
	 */
	public static String SELECTED_DATASETS_COLUMNS = "org.sagebionetworks.datasets.selected.columns";

	/**
	 * Key for the selected filters applied on the datasets table.
	 */
	public static String APPLIED_DATASETS_FILTERS = "org.sagebionetworks.datasets.applied.filters";

	/**
	 * Login token
	 */
	public static String USER_LOGIN_TOKEN = "org.sagebionetworks.security.user.login.token";

	/**
	 * Login token
	 */
	public static String SHOW_DEMO = "org.sagebionetworks.synapse.show.demo";

	/**
	 * Last Place in the app
	 */
	public static String LAST_PLACE = "org.sagebionetworks.synapse.place.last.place";

	/**
	 * Current Place in the app
	 */
	public static String CURRENT_PLACE = "org.sagebionetworks.synapse.place.current.place";

	/**
	 * LinkedIn requestToken key
	 */
	public static String LINKEDIN = "org.sagebionetworks.synapse.linkedin";

	/**
	 * Get Satisfaction fastpass key
	 */
	public static String FASTPASS = "fastpass";
}

Fix cookie keys to be 'sagebio' not 'sagbio'


package org.orienteer.core.behavior;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxClientInfoBehavior;
import org.orienteer.core.OrienteerWebSession;

/**
 * Behavior to gather ClientInfo only once
 */
public class OneTimeAjaxClientInfoBehavior extends AjaxClientInfoBehavior {

	@Override
	public boolean isEnabled(Component component) {
		return !OrienteerWebSession.get().isClientInfoAvailable();
	}

	@Override
	public boolean isTemporary(Component component) {
		return !isEnabled(component);
	}
}

package org.orienteer.core.behavior;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxClientInfoBehavior;
import org.orienteer.core.OrienteerWebSession;

/**
 * Behavior to gather ClientInfo only once
 */
public class OneTimeAjaxClientInfoBehavior extends AjaxClientInfoBehavior {

	@Override
	public boolean isEnabled(Component component) {
		return !OrienteerWebSession.get().isClientInfoAvailable();
	}
}

Fix InvalidBehaviorIdException due to dynamic swith to temporal behavior


package com.github.aureliano.achmed.server.service;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.Map;

import com.github.aureliano.achmed.common.exception.AchmedException;
import com.github.aureliano.achmed.common.helper.FileHelper;
import com.github.aureliano.achmed.common.helper.StringHelper;
import com.github.aureliano.achmed.server.AchmedServerHandler;

public class ReadFileService implements IService {

	public ReadFileService() {}

	@Override
	public byte[] consume(Map<String, String> parameters) {
		String resourcePath = parameters.get("resource");
		if (StringHelper.isEmpty(resourcePath)) {
			throw new AchmedException("Empty resource path.");
		}

		File requestedFile = FileHelper.buildFile(AchmedServerHandler.instance().getFileRepository(), resourcePath);
		if (!(requestedFile.exists() && requestedFile.isFile())) {
			try {
				return (" >>> Resource path: " + resourcePath).getBytes("UTF-8");
			} catch (UnsupportedEncodingException ex) {
				throw new AchmedException(ex);
			}
		}

		return new byte[0];
	}
}

package com.github.aureliano.achmed.server.service;

import java.io.File;
import java.util.Map;
import java.util.logging.Logger;

import com.github.aureliano.achmed.common.exception.AchmedException;
import com.github.aureliano.achmed.common.helper.FileHelper;
import com.github.aureliano.achmed.common.helper.StringHelper;
import com.github.aureliano.achmed.common.logging.LoggingFactory;
import com.github.aureliano.achmed.server.AchmedServerHandler;

public class ReadFileService implements IService {

	private static final Logger logger = LoggingFactory.createLogger(ReadFileService.class);

	public ReadFileService() {}

	@Override
	public byte[] consume(Map<String, String> parameters) {
		String resourcePath = parameters.get("resource");
		if (StringHelper.isEmpty(resourcePath)) {
			throw new AchmedException("Empty resource path.");
		}

		File requestedFile = FileHelper.buildFile(AchmedServerHandler.instance().getFileRepository(), resourcePath);
		if (!(requestedFile.exists() && requestedFile.isFile())) {
			logger.warning("Requested resource path [ " + requestedFile + " ] does not exist.");
			return new byte[0];
		}

		return new byte[0];
	}
}

Return empty array if requested file does not exist.


/*
 * #%L
 * BroadleafCommerce Framework
 * %%
 * Copyright (C) 2009 - 2014 Broadleaf Commerce
 * %%
 * 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.
 * #L%
 */
package org.broadleafcommerce.openadmin.server.service.persistence.module.provider.extension;

import org.broadleafcommerce.common.extension.ExtensionHandler;
import org.broadleafcommerce.common.extension.ExtensionResultHolder;
import org.broadleafcommerce.common.extension.ExtensionResultStatusType;
import org.broadleafcommerce.common.media.domain.Media;

/**
 * For internal usage. Allows extending API calls without subclassing the entity.
 *
 * @author Jeff Fischer
 */
public interface MediaFieldPersistenceProviderExtensionHandler extends ExtensionHandler {

    ExtensionResultStatusType transformId(Media media, ExtensionResultHolder<Long> resultHolder);

    ExtensionResultStatusType postAdd(Media media);

    ExtensionResultStatusType postUpdate(Media media);

    public static final int DEFAULT_PRIORITY = Integer.MAX_VALUE;

}

/*
 * #%L
 * BroadleafCommerce Framework
 * %%
 * Copyright (C) 2009 - 2014 Broadleaf Commerce
 * %%
 * 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.
 * #L%
 */
package org.broadleafcommerce.openadmin.server.service.persistence.module.provider.extension;

import org.broadleafcommerce.common.extension.ExtensionHandler;
import org.broadleafcommerce.common.extension.ExtensionResultHolder;
import org.broadleafcommerce.common.extension.ExtensionResultStatusType;
import org.broadleafcommerce.common.media.domain.Media;

/**
 * For internal usage. Allows extending API calls without subclassing the entity.
 *
 * @author Jeff Fischer
 */
public interface MediaFieldPersistenceProviderExtensionHandler extends ExtensionHandler {

    ExtensionResultStatusType transformId(Media media, ExtensionResultHolder<Long> resultHolder);

    ExtensionResultStatusType postAdd(Media media);

    ExtensionResultStatusType postUpdate(Media media);

    ExtensionResultStatusType checkDirtyState(Media oldMedia, Media newMedia, ExtensionResultHolder<Boolean> resultHolder);

    public static final int DEFAULT_PRIORITY = Integer.MAX_VALUE;

}

Make sure dirty state is detected appropriately during a promote


enum BeamType {

    FAR(1.0f, 0.1f, 3.0f, 0.5f, 5.0f),
    MIDDLE(2.0f, 0.2f, 6.0f, 0.7f, 7.0f),
    NEAR(3.0f, 0.3f, 9.0f, 0.9f, 9.0f);

    final float velocity;
    final float acceleration;
    final float terminalVelocity;
    final float opacity;
    final float size;

    BeamType(float velocity, float acceleration, float terminalVelocity, float opacity, float size) {
        this.velocity = velocity;
        this.acceleration = acceleration;
        this.terminalVelocity = terminalVelocity;
        this.opacity = opacity * 255;
        this.size = size;
    }

    float velocity() {
        return velocity;
    }

    float acceleration() {
        return acceleration;
    }

    float terminalVelocity() {
        return terminalVelocity;
    }

    float opacity() {
        return opacity;
    }

    float size() {
        return size;
    }
}

Fix statement exceeding 100-character line limit


/**
 * Copyright 2015 Palantir Technologies
 *
 * Licensed under the BSD-3 License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://opensource.org/licenses/BSD-3-Clause
 *
 * 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.palantir.nexus.db.sql;

import java.util.List;

public interface AgnosticResultSet {

    List<AgnosticResultRow> rows();

    AgnosticResultRow get(int row);

    int size();

}

/**
 * Copyright 2015 Palantir Technologies
 *
 * Licensed under the BSD-3 License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://opensource.org/licenses/BSD-3-Clause
 *
 * 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.palantir.nexus.db.sql;

import java.util.List;

public interface AgnosticResultSet {

    List<? extends AgnosticResultRow> rows();

    AgnosticResultRow get(int row);

    int size();

}

Support extends of the interface


package io.katharsis.example.jersey;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.katharsis.locator.SampleJsonServiceLocator;
import io.katharsis.queryParams.DefaultQueryParamsParser;
import io.katharsis.queryParams.QueryParamsBuilder;
import io.katharsis.rs.KatharsisFeature;
import io.katharsis.rs.KatharsisProperties;
import org.glassfish.jersey.server.ResourceConfig;

import javax.ws.rs.ApplicationPath;

@ApplicationPath("/")
public class JerseyApplication extends ResourceConfig {

    public static final String APPLICATION_URL = "http://localhost:8080/";

    public JerseyApplication() {
        property(KatharsisProperties.RESOURCE_SEARCH_PACKAGE, "io.katharsis.example.jersey.domain");
        property(KatharsisProperties.RESOURCE_DEFAULT_DOMAIN, APPLICATION_URL);
        register(new KatharsisFeature(new ObjectMapper(), new QueryParamsBuilder(new DefaultQueryParamsParser()), new SampleJsonServiceLocator()));

    }
}

package io.katharsis.example.jersey;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.katharsis.locator.SampleJsonServiceLocator;
import io.katharsis.queryParams.DefaultQueryParamsParser;
import io.katharsis.queryParams.QueryParamsBuilder;
import io.katharsis.rs.KatharsisFeature;
import io.katharsis.rs.KatharsisProperties;
import org.glassfish.jersey.server.ResourceConfig;

import javax.ws.rs.ApplicationPath;

@ApplicationPath("/")
public class JerseyApplication extends ResourceConfig {

    public static final String APPLICATION_URL = "http://localhost:8080";

    public JerseyApplication() {
        property(KatharsisProperties.RESOURCE_SEARCH_PACKAGE, "io.katharsis.example.jersey.domain");
        property(KatharsisProperties.RESOURCE_DEFAULT_DOMAIN, APPLICATION_URL);
        register(new KatharsisFeature(new ObjectMapper(), new QueryParamsBuilder(new DefaultQueryParamsParser()), new SampleJsonServiceLocator()));

    }
}

Remove slash at the end of APPLICATION_URL


/*
 * SecurityConfig.java
 *
 * Copyright (C) 2017 [ A Legge Up ]
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

package com.aleggeup.confagrid.config;

import java.security.SecureRandom;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.aleggeup.confagrid.filter.JwtFilter;

@Configuration
public class SecurityConfig {

    @Bean
    public FilterRegistrationBean jwtFilter() {
        final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        registrationBean.setFilter(new JwtFilter());
        registrationBean.addUrlPatterns("/api/*");

        return registrationBean;
    }

    @Bean
    public SecureRandom secureRandom() {
        return new SecureRandom();
    }
}

/*
 * SecurityConfig.java
 *
 * Copyright (C) 2017 [ A Legge Up ]
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

package com.aleggeup.confagrid.config;

import java.security.SecureRandom;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.aleggeup.confagrid.filter.JwtFilter;

@Configuration
public class SecurityConfig {

    @Bean
    public FilterRegistrationBean jwtFilter() {
        final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        registrationBean.setFilter(new JwtFilter());

        return registrationBean;
    }

    @Bean
    public SecureRandom secureRandom() {
        return new SecureRandom();
    }
}

Remove url pattern from filter so that it will filter all paths


package li.cil.oc.example.architecture;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

/**
 * This mod demonstrates how to create tile entities that are treated as
 * components by OpenComputers, i.e. tile entities that provide methods which
 * can be called from a program running on a computer.
 * <p/>
 * The mod tries to keep everything else to a minimum, to focus on the mod-
 * specific parts. It is not intended for use or distribution, but you're free
 * to base a proper addon on this code.
 */
@Mod(modid = "OpenComputers|ExampleTileEntity",
        name = "OpenComputers Addon Example - TileEntity",
        version = "1.0.0",
        dependencies = "required-after:OpenComputers@[1.2.0,)")
public class ModExampleTileEntity {
    @Mod.Instance
    public static ModExampleTileEntity instance;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent e) {
    	li.cil.oc.api.Machine.add(PseudoArchitecture.class);
    }
}

package li.cil.oc.example.architecture;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

/**
 * This mod demonstrates how to create tile entities that are treated as
 * components by OpenComputers, i.e. tile entities that provide methods which
 * can be called from a program running on a computer.
 * <p/>
 * The mod tries to keep everything else to a minimum, to focus on the mod-
 * specific parts. It is not intended for use or distribution, but you're free
 * to base a proper addon on this code.
 */
@Mod(modid = "OpenComputers|ExampleArchitecture",
        name = "OpenComputers Addon Example - Architecture",
        version = "1.0.0",
        dependencies = "required-after:OpenComputers@[1.4.0,)")
public class ModExampleArchitecture {
    @Mod.Instance
    public static ModExampleArchitecture instance;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent e) {
    	li.cil.oc.api.Machine.add(PseudoArchitecture.class);
    }
}

Change Mod Class and name


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

public final class JMXSupport {

    private JMXSupport() {
    }

    public static String encodeObjectNamePart(String part) {
        // return ObjectName.quote(part);
        String answer = part.replaceAll("[\\:\\,\\'\\\"]", "_");
        answer = answer.replaceAll("\\?", "&qe;");
        answer = answer.replaceAll("=", "&");
        answer = answer.replaceAll("\\*", "*");
        return answer;
    }
}

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

import java.util.regex.Pattern;

public final class JMXSupport {

    private static final Pattern PART_1 = Pattern.compile("[\\:\\,\\'\\\"]");
    private static final Pattern PART_2 = Pattern.compile("\\?");
    private static final Pattern PART_3 = Pattern.compile("=");
    private static final Pattern PART_4 = Pattern.compile("\\*");

    private JMXSupport() {
    }

    public static String encodeObjectNamePart(String part) {
        String answer = PART_1.matcher(part).replaceAll("_");
        answer = PART_2.matcher(answer).replaceAll("&qe;");
        answer = PART_3.matcher(answer).replaceAll("&");
        answer = PART_4.matcher(answer).replaceAll("*");
        return answer;
    }

}

Use pre compiled pattern when doing string replaceAll as its faster.


/*
 * Copyright 2015-2015 Groupon, Inc
 * Copyright 2015-2015 The Billing Project, LLC
 *
 * The Billing Project 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.killbill.billing.plugin.notification.templates;

import java.util.Map;

import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;

public class MustacheTemplateEngine implements TemplateEngine {

    @Override
    public String executeTemplateText(final String templateText, final Map<String, Object> data) {
        final Template template = Mustache.compiler().compile(templateText);
        return template.execute(data);
    }
}

/*
 * Copyright 2015-2015 Groupon, Inc
 * Copyright 2015-2015 The Billing Project, LLC
 *
 * The Billing Project 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.killbill.billing.plugin.notification.templates;

import java.util.Map;

import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;

public class MustacheTemplateEngine implements TemplateEngine {

    @Override
    public String executeTemplateText(final String templateText, final Map<String, Object> data) {
        final Template template = Mustache.compiler().nullValue("").compile(templateText);
        return template.execute(data);
    }
}

Fix Mustache compiler to default null values to empty strings, not throw exception.


package com.airbnb.lotte.layers;

import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;

import com.airbnb.lotte.utils.LotteTransform3D;
import com.airbnb.lotte.utils.Observable;

public class RootLotteAnimatableLayer extends LotteAnimatableLayer {
    public RootLotteAnimatableLayer(Drawable.Callback callback) {
        super(0, callback);
    }

    @Override
    public void draw(@NonNull Canvas canvas) {
        setTransform(new Observable<>(new LotteTransform3D()));
        super.draw(canvas);
        canvas.clipRect(getBounds());
    }
}

package com.airbnb.lotte.layers;

import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;

public class RootLotteAnimatableLayer extends LotteAnimatableLayer {
    public RootLotteAnimatableLayer(Drawable.Callback callback) {
        super(0, callback);
    }

    @Override
    public void draw(@NonNull Canvas canvas) {
        super.draw(canvas);
        canvas.clipRect(getBounds());
    }
}

Remove transform from root layer


/*
 * VowlThing.java
 *
 */

package de.uni_stuttgart.vis.vowl.owl2vowl.model.entities.nodes.classes;

import de.uni_stuttgart.vis.vowl.owl2vowl.constants.NodeType;
import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Standard_Iris;

import de.uni_stuttgart.vis.vowl.owl2vowl.model.annotation.Annotation;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.visitor.VowlElementVisitor;
import org.semanticweb.owlapi.model.IRI;

/**
 *
 */
public class VowlThing extends AbstractClass {
	public static final String THING_IRI = Standard_Iris.OWL_THING_CLASS_URI;

	protected VowlThing(IRI iri, String type) {
		super(iri, type);
	}

	public VowlThing(IRI iri) {
		super(iri, NodeType.TYPE_THING);
		getAnnotations().addLabel(new Annotation("label", "Thing"));
	}

	@Override
	public void accept(VowlElementVisitor visitor) {
		visitor.visit(this);
	}
}

/*
 * VowlThing.java
 *
 */

package de.uni_stuttgart.vis.vowl.owl2vowl.model.entities.nodes.classes;

import de.uni_stuttgart.vis.vowl.owl2vowl.constants.NodeType;
import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Standard_Iris;

import de.uni_stuttgart.vis.vowl.owl2vowl.model.annotation.Annotation;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.visitor.VowlElementVisitor;
import org.semanticweb.owlapi.model.IRI;

/**
 *
 */
public class VowlThing extends AbstractClass {
	public static final String THING_IRI = Standard_Iris.OWL_THING_CLASS_URI;
	public static final IRI GENERIC_THING_IRI = IRI.create(THING_IRI);

	protected VowlThing(IRI iri, String type) {
		super(iri, type);
	}

	public VowlThing(IRI iri) {
		super(iri, NodeType.TYPE_THING);
		getAnnotations().addLabel(new Annotation("label", "Thing"));
	}

	@Override
	public void accept(VowlElementVisitor visitor) {
		visitor.visit(this);
	}
}

Fix bug with missing iri


package com.nilhcem.mowitnow;

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

import org.apache.commons.io.FileUtils;

/**
 * Starting point of the application.
 *
 * <p>
 * Opens file passed in args and calls the Mower interpreter.
 * </p>
 */
public final class App {

	public static void main(String[] args) throws IOException {
		List<String> instructions = App.getInstructionsFromArgFile(args);
	}

	private static List<String> getInstructionsFromArgFile(String[] args) throws IOException {
		if (args.length != 1) {
			throw new IllegalArgumentException("App is expecting one (and only one) parameter: the mower instructions file");
		}

		File instructions = new File(args[0]);
		return FileUtils.readLines(instructions, "UTF-8");
	}
}

package com.nilhcem.mowitnow;

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

import org.apache.commons.io.FileUtils;

import com.nilhcem.mowitnow.core.Mower;
import com.nilhcem.mowitnow.core.instruction.MowerInstruction;
import com.nilhcem.mowitnow.core.instruction.parser.InstructionsParser;

/**
 * Starting point of the application.
 * <p>
 * Opens file passed in args and calls the Mower interpreter.
 * </p>
 */
public final class App {

	private App() {
	}

	public static void main(String[] args) throws IOException {
		List<String> instructions = App.getInstructionsFromArgFile(args);
		runInstructions(instructions);
	}

	private static List<String> getInstructionsFromArgFile(String[] args) throws IOException {
		if (args.length != 1) {
			throw new IllegalArgumentException("App is expecting one (and only one) parameter: the mower instructions file");
		}

		File instructions = new File(args[0]);
		return FileUtils.readLines(instructions, "UTF-8");
	}

	private static void runInstructions(List<String> data) {
		InstructionsParser parser = new InstructionsParser(data);

		Mower mower = parser.getNextMower();
		while (mower != null) {
			List<MowerInstruction> instrs = parser.getInstructionsForMower(mower);
			for (MowerInstruction instr : instrs) {
				mower.process(instr);
			}
			System.out.println(mower.getPosition());
			mower = parser.getNextMower();
		}
	}
}

Add main code (while calls core methods and displays result)


package org.helioviewer.plugins.eveplugin.view;

import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import org.helioviewer.plugins.eveplugin.view.linedataselector.LineDateSelectorTablePanel;

public class TimelinePluginPanel extends JPanel {

    private static final long serialVersionUID = -2175620741820580148L;
    private JTabbedPane tabs;

    public TimelinePluginPanel() {
        super();
        initVisualComponents();
    }

    private void initVisualComponents() {
        tabs = new JTabbedPane();
        tabs.addTab("Layers", new ControlsPanel());
        tabs.addTab("Radio Options", new RadioOptionsPanel());

        setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
        add(tabs);
        add(new LineDateSelectorTablePanel());
    }
}

package org.helioviewer.plugins.eveplugin.view;

import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import org.helioviewer.plugins.eveplugin.view.linedataselector.LineDateSelectorTablePanel;

public class TimelinePluginPanel extends JPanel {

    private static final long serialVersionUID = -2175620741820580148L;
    private JTabbedPane tabs;

    public TimelinePluginPanel() {
        super();
        initVisualComponents();
    }

    private void initVisualComponents() {
        setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
        add(new LineDateSelectorTablePanel());
    }
}

Remove the old line selector panel


package com.topsy.jmxproxy.jmx.tests;

import com.topsy.jmxproxy.jmx.ConnectionCredentials;
import org.junit.Test;

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

public class ConnectionCredentialsTest {
    @Test
    public void compareEquals() throws Exception {
        final ConnectionCredentials auth1 = new ConnectionCredentials("user", "pass");
        final ConnectionCredentials auth2 = new ConnectionCredentials("user", "pass");

        assertTrue(auth1.equals(auth2));
    }

    @Test
    public void compareNotEquals() throws Exception {
        final ConnectionCredentials auth1 = new ConnectionCredentials("user", "pass");
        final ConnectionCredentials auth2 = new ConnectionCredentials("pass", "user");

        assertFalse(auth1.equals(auth2));
    }

    @Test
    public void compareNotEqualsNull() throws Exception {
        final ConnectionCredentials auth1 = new ConnectionCredentials("user", "pass");

        assertFalse(auth1.equals(null));
    }
}

package com.topsy.jmxproxy.jmx.tests;

import com.topsy.jmxproxy.jmx.ConnectionCredentials;
import org.junit.Test;

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

public class ConnectionCredentialsTest {
    @Test
    public void compareEquals() throws Exception {
        final ConnectionCredentials auth1 = new ConnectionCredentials(new String("user"), new String("pass"));
        final ConnectionCredentials auth2 = new ConnectionCredentials(new String("user"), new String("pass"));

        assertTrue(auth1.equals(auth2));
    }

    @Test
    public void compareNotEquals() throws Exception {
        final ConnectionCredentials auth1 = new ConnectionCredentials(new String("user"), new String("pass"));
        final ConnectionCredentials auth2 = new ConnectionCredentials(new String("pass"), new String("user"));

        assertFalse(auth1.equals(auth2));
    }

    @Test
    public void compareNotEqualsNull() throws Exception {
        final ConnectionCredentials auth = new ConnectionCredentials(new String("user"), new String("pass"));

        assertFalse(auth.equals(null));
    }
}

Make the test a bit less idiotic.


/**
 * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
 *
 * 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 io.gravitee.repository.api;

import io.gravitee.repository.model.Api;

import java.util.Optional;
import java.util.Set;

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public interface ApiRepository {

    Optional<Api> findByName(String apiName);

    Set<Api> findAll();

    Set<Api> findByTeam(String teamName);

    Api create(Api api);

    Api update(Api api);

    void delete(String apiName);

    int countByUser(String username);

    int countByTeam(String teamName);
}

/**
 * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
 *
 * 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 io.gravitee.repository.api;

import io.gravitee.repository.model.Api;

import java.util.Optional;
import java.util.Set;

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public interface ApiRepository {

    Optional<Api> findByName(String apiName);

    Set<Api> findAll();

    Set<Api> findByTeam(String teamName);

    Set<Api> findByUser(String username);

    Api create(Api api);

    Api update(Api api);

    void delete(String apiName);

    int countByUser(String username);

    int countByTeam(String teamName);
}

Add service to retrieve list of APIs by user


package sizebay.catalog.client.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@Accessors(chain = true)
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserProfile implements Serializable {

    String id;
    String email;
    String facebook;
    String password;

    List<UserProfileIdentification> profiles;

    public static UserProfile empty() {

        UserProfile user = new UserProfile();
        List<UserProfileIdentification> profile = new ArrayList<>();

        profile.add(UserProfileIdentification.empty());

        user.setProfiles(profile);

        return user;

    }

}

package sizebay.catalog.client.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@Accessors(chain = true)
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserProfile implements Serializable {

    String id;
    String email;
    String facebook;
    String password;

    List<UserProfileIdentification> profiles;

    public static UserProfile empty(String id) {

        List<UserProfileIdentification> profile = new ArrayList<>();
        profile.add(UserProfileIdentification.empty());

        UserProfile user = new UserProfile().setId(id).setProfiles(profile);

        return user;

    }

}

Refactor and change signature of the method that returns an empty profile


package com.adleritech.flexibee.core.api;

import com.adleritech.flexibee.core.api.domain.WinstromRequest;
import com.adleritech.flexibee.core.api.domain.WinstromResponse;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.http.Body;
import retrofit2.http.PUT;
import retrofit2.http.Path;

import java.io.IOException;

public class FlexibeeClient {

    private static final String API_BASE_URL = "https://demo.flexibee.eu:5434";
    private final String company;
    private final Api client;

    public FlexibeeClient(String username, String password, String company) {
        this.company = company;
        client = RetrofitClientFactory.createService(Api.class, API_BASE_URL, username, password);
    }

    public WinstromResponse createInvoice(WinstromRequest winstromRequest) throws IOException {
        Response<WinstromResponse> response = client.issueInvoice(company, winstromRequest).execute();
        return response.body();
    }

    interface Api {
        @PUT("/c/{company}/faktura-vydana.xml")
        Call<WinstromResponse> issueInvoice(@Path("company") String company, @Body WinstromRequest request);
    }

}

package com.adleritech.flexibee.core.api;

import com.adleritech.flexibee.core.api.domain.WinstromRequest;
import com.adleritech.flexibee.core.api.domain.WinstromResponse;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.http.Body;
import retrofit2.http.PUT;
import retrofit2.http.Path;

import java.io.IOException;

public class FlexibeeClient {

    private static final String API_BASE_URL = "https://demo.flexibee.eu:5434";
    private final String company;
    private final Api client;

    public FlexibeeClient(String username, String password, String company) {
        this.company = company;
        client = RetrofitClientFactory.createService(Api.class, API_BASE_URL, username, password);
    }

    public FlexibeeClient(String username, String password, String company, String apiBaseUrl) {
        this.company = company;
        client = RetrofitClientFactory.createService(Api.class, apiBaseUrl, username, password);
    }

    public WinstromResponse createInvoice(WinstromRequest winstromRequest) throws IOException {
        Response<WinstromResponse> response = client.issueInvoice(company, winstromRequest).execute();
        return response.body();
    }

    interface Api {
        @PUT("/c/{company}/faktura-vydana.xml")
        Call<WinstromResponse> issueInvoice(@Path("company") String company, @Body WinstromRequest request);
    }

}

Allow to change flexibee url


package org.apache.jackrabbit.oak.jcr.state;

import org.apache.jackrabbit.oak.jcr.json.JsonValue;
import org.apache.jackrabbit.oak.model.AbstractPropertyState;

public class PropertyStateImpl extends AbstractPropertyState {
private final String name;
private final JsonValue value;

public PropertyStateImpl(String name, JsonValue value) {
    this.name = name;
    this.value = value;
}

    public JsonValue getValue() {
        return value;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getEncodedValue() {
        return value.toJson();
    }

    @Override
    public String toString() {
        return name + ':' + getEncodedValue();
    }
}

Clean up oak-jcr - formatting


/*
 * Copyright 2011-2013 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 org.hibernate.cache.redis.serializer;

import java.nio.charset.Charset;

/**
 * Serializer for Redis Key or Value
 *
 * @author sunghyouk.bae@gmail.com
 * @since 13. 4. 9 오후 10:20
 */
public interface RedisSerializer<T> {

    public byte[] EMPTY_BYTES = new byte[0];

    public Charset UTF_8 = Charset.forName("UTF-8");

    /**
     * Serialize Object
     */
    byte[] serialize(final T graph);

    /**
     * Deserialize to object
     */
    T deserialize(final byte[] bytes);
}

/*
 * Copyright 2011-2013 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 org.hibernate.cache.redis.serializer;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
 * Serializer for Redis Key or Value
 *
 * @author sunghyouk.bae@gmail.com
 * @since 13. 4. 9 오후 10:20
 */
public interface RedisSerializer<T> {

    public byte[] EMPTY_BYTES = new byte[0];

    public Charset UTF_8 = StandardCharsets.UTF_8;

    /**
     * Serialize Object
     */
    byte[] serialize(final T graph);

    /**
     * Deserialize to object
     */
    T deserialize(final byte[] bytes);
}

Revert "StandardCharsets을 jdk6에서 지원하지 않아 Charset.forName으로 변경"


package com.googlecode.jslint4java.maven;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import java.io.File;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import com.googlecode.jslint4java.formatter.JSLintResultFormatter;
import com.googlecode.jslint4java.formatter.JSLintXmlFormatter;

public class ReportWriterTest {

    @Rule
    public TemporaryFolder tmpf = new TemporaryFolder();

    private final JSLintResultFormatter formatter = new JSLintXmlFormatter();

    private ReportWriter createReportWriter(String filename) {
        return new ReportWriter(new File(tmpf.getRoot(), filename), formatter);
    }

    @Test
    public void createsNonEmptyFile() {
        ReportWriter rw = createReportWriter("report.xml");
        rw.open();
        rw.close();
        assertThat(rw.getReportFile().exists(), is(true));
        assertThat(rw.getReportFile().length(), is(not(0L)));
    }
}

package com.googlecode.jslint4java.maven;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import java.io.File;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import com.googlecode.jslint4java.formatter.JSLintResultFormatter;
import com.googlecode.jslint4java.formatter.JSLintXmlFormatter;

public class ReportWriterTest {

    @Rule
    public TemporaryFolder tmpf = new TemporaryFolder();

    private final JSLintResultFormatter formatter = new JSLintXmlFormatter();

    private ReportWriter createReportWriter(String filename) {
        return new ReportWriter(new File(tmpf.getRoot(), filename), formatter);
    }

    @Test
    public void createsNonEmptyFile() {
        ReportWriter rw = createReportWriter("report.xml");
        rw.open();
        rw.close();
        assertThat(rw.getReportFile().exists(), is(true));
        assertThat(rw.getReportFile().length(), is(not(0L)));
    }

    @Test
    public void makesParentDirectory() {
        File parent = new File(tmpf.getRoot(), "somedir");
        ReportWriter rw = new ReportWriter(new File(parent, "report.xml"), formatter);
        rw.open();
        rw.close();
        assertThat(parent.exists(), is(true));
    }
}

Check ReportWriter makes parent directories.


package mib.microservice.commons.persistence;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 * Created by matthias.popp on 18.07.2014.
 * <p/>
 * Class containing needed perisistence helper methods. This class also creates and manages the entity manager instance.
 */
public class PersistenceUtils {

    private static EntityManagerFactory emf;
    /**
     * No instances should be created.
     */
    private PersistenceUtils(){}

    /**
     * Initialization of the entity manager. This is an EXPENSIVE operation. Only call that once on application level
     * when starting up the application.
     */
    public static void initialize(String persistenceUnitName) {
        emf = Persistence.createEntityManagerFactory(persistenceUnitName);
    }

    public static EntityManager openEm() {
        return emf.createEntityManager();
    }

    public static void closeEm(EntityManager em) {em.close();}

    public static void startTransaction(EntityManager em){
        em.getTransaction().begin();
    }

    public static void commitTransaction(EntityManager em){
        em.getTransaction().commit();
    }

    public static boolean isTransactionActive(EntityManager em){
        return em.getTransaction().isActive();
    }
}

package mib.microservice.commons.persistence;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 * Created by matthias.popp on 18.07.2014.
 * <p/>
 * Class containing needed perisistence helper methods. This class also creates and manages the entity manager instance.
 */
public class PersistenceUtils {

    private static EntityManagerFactory emf;
    /**
     * No instances should be created.
     */
    private PersistenceUtils(){}

    /**
     * Initialization of the entity manager. This is an EXPENSIVE operation. Only call that once on application level
     * when starting up the application.
     */
    public static void initialize(String persistenceUnitName) {
        emf = Persistence.createEntityManagerFactory(persistenceUnitName);
    }

    public static EntityManager openEm() {
        return emf.createEntityManager();
    }

    public static void closeEm(EntityManager em) {em.close();}

    public static void startTransaction(EntityManager em){
        em.getTransaction().begin();
    }

    public static void commitTransaction(EntityManager em){
        em.getTransaction().commit();
    }

    public static boolean isTransactionActive(EntityManager em){
        return em.getTransaction().isActive();
    }

	public static void rollbackTransaction(EntityManager em) {
		em.getTransaction().rollback();
	}
}

Allow transactions to be rollbacked


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

import static com.google.common.truth.Truth.assertThat;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Tests for {@link SingleStatRecorder}. */
@RunWith(JUnit4.class)
public class SingleStatRecorderTest {

  @Test
  public void meanAndstandardDeviation() {
    SingleStatRecorder recorder = new SingleStatRecorder(null, 2);
    recorder.addStat(43, null);
    recorder.addStat(49, null);
    recorder.addStat(51, null);
    recorder.addStat(57, null);
    MetricData metrics = recorder.snapshot();
    assertThat(metrics.getAvg()).isWithin(.01).of(50);
    assertThat(metrics.getStdDev()).isWithin(.01).of(5);
  }
}

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

import static com.google.common.truth.Truth.assertThat;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Tests for {@link SingleStatRecorder}. */
@RunWith(JUnit4.class)
public class SingleStatRecorderTest {

  @Test
  public void meanAndStandardDeviation() {
    SingleStatRecorder recorder = new SingleStatRecorder(null, 2);
    recorder.addStat(43, null);
    recorder.addStat(49, null);
    recorder.addStat(51, null);
    recorder.addStat(57, null);
    MetricData metrics = recorder.snapshot();
    assertThat(metrics.getAvg()).isWithin(.01).of(50);
    assertThat(metrics.getStdDev()).isWithin(.01).of(5);
  }
}

Fix camelCasing the method name.


package miwax.java_conf.gr.jp.frugalitycalc.model;

import java.math.BigDecimal;

public enum Operation {
    PLUS     { BigDecimal apply(BigDecimal x, BigDecimal y) {return x.add(y);} },
    MINUS    { BigDecimal apply(BigDecimal x, BigDecimal y) {return x.subtract(y);} },
    MULTIPLE { BigDecimal apply(BigDecimal x, BigDecimal y) {return x.multiply(y);} },
    DIVIDE   { BigDecimal apply(BigDecimal x, BigDecimal y) {return x.divide(y, 8, BigDecimal.ROUND_HALF_UP);} };

    abstract BigDecimal apply(BigDecimal x, BigDecimal y);
}

package miwax.java_conf.gr.jp.frugalitycalc.model;

import java.math.BigDecimal;
import java.math.MathContext;

public enum Operation {
    PLUS     { BigDecimal apply(BigDecimal x, BigDecimal y) {return x.add(y);} },
    MINUS    { BigDecimal apply(BigDecimal x, BigDecimal y) {return x.subtract(y);} },
    MULTIPLE { BigDecimal apply(BigDecimal x, BigDecimal y) {return x.multiply(y);} },
    DIVIDE   { BigDecimal apply(BigDecimal x, BigDecimal y) {return x.divide(y, MathContext.DECIMAL128);} };

    abstract BigDecimal apply(BigDecimal x, BigDecimal y);
}

Change the accuracy of the division to the IEEE 754R Decimal28


package org.zaproxy.zap.extension.websocket.ui.httppanel.views.large;

import org.zaproxy.zap.extension.httppanel.Message;
import org.zaproxy.zap.extension.httppanel.view.largeresponse.LargeResponseUtil;
import org.zaproxy.zap.extension.websocket.WebSocketMessageDTO;

public class WebSocketLargePayloadUtil extends LargeResponseUtil {

	public static boolean isLargePayload(Message aMessage) {
		if (aMessage instanceof WebSocketMessageDTO) {
			WebSocketMessageDTO message = (WebSocketMessageDTO) aMessage;
			if (message.payloadLength == null) {
				return false;
			}
			return message.payloadLength > minContentLength;
		}

		return false;
	}
}

package org.zaproxy.zap.extension.websocket.ui.httppanel.views.large;

import org.zaproxy.zap.extension.httppanel.Message;
import org.zaproxy.zap.extension.httppanel.view.largeresponse.LargeResponseUtil;
import org.zaproxy.zap.extension.websocket.WebSocketMessageDTO;

public class WebSocketLargePayloadUtil extends LargeResponseUtil {

	public static boolean isLargePayload(Message aMessage) {
		if (aMessage instanceof WebSocketMessageDTO) {
			WebSocketMessageDTO message = (WebSocketMessageDTO) aMessage;
			if (message.payloadLength == null || minContentLength == -1) {
				return false;
			}
			return message.payloadLength > minContentLength;
		}

		return false;
	}
}

Handle 'unlimited' large payload size


package sizebay.catalog.client.model;

import lombok.*;

@Getter
@Setter
@EqualsAndHashCode
@ToString
public class ModelingSizeMeasures   {

  String sizeName = null;
  ModelingMeasureRange chest = null;
  ModelingMeasureRange hip = null;
  ModelingMeasureRange waist = null;
  ModelingMeasureRange sleeve = null;
  ModelingMeasureRange length = null;
  ModelingMeasureRange insideLeg = null;
  ModelingMeasureRange biceps = null;
  ModelingMeasureRange height = null;
  ModelingMeasureRange fist = null;
  ModelingMeasureRange neck = null;
  ModelingMeasureRange thigh = null;
  ModelingMeasureRange centralSeam = null;
  ModelingMeasureRange underBust = null;
  ModelingMeasureRange shoulderWidth = null;
  ModelingMeasureRange insoleLength = null;
  ModelingMeasureRange insoleWidth = null;
  ModelingMeasureRange waistUpper = null;
  ModelingMeasureRange waistLower = null;

  ModelingMeasureRange label1 = null;
  ModelingMeasureRange label2 = null;
  ModelingMeasureRange label3 = null;

  ModelingMeasureRange ageChart = null;
  ModelingMeasureRange weightChart = null;

}

package sizebay.catalog.client.model;

import lombok.*;

@Getter
@Setter
@EqualsAndHashCode
@ToString
public class ModelingSizeMeasures   {

  String sizeName = null;
  ModelingMeasureRange chest = null;
  ModelingMeasureRange hip = null;
  ModelingMeasureRange waist = null;
  ModelingMeasureRange sleeve = null;
  ModelingMeasureRange length = null;
  ModelingMeasureRange insideLeg = null;
  ModelingMeasureRange biceps = null;
  ModelingMeasureRange height = null;
  ModelingMeasureRange fist = null;
  ModelingMeasureRange neck = null;
  ModelingMeasureRange thigh = null;
  ModelingMeasureRange centralSeam = null;
  ModelingMeasureRange underBust = null;
  ModelingMeasureRange shoulderWidth = null;
  ModelingMeasureRange insoleLength = null;
  ModelingMeasureRange insoleWidth = null;
  ModelingMeasureRange waistUpper = null;
  ModelingMeasureRange waistLower = null;

  ModelingMeasureRange label1 = null;
  ModelingMeasureRange label2 = null;
  ModelingMeasureRange label3 = null;

  ModelingMeasureRange ageChart = null;
  ModelingMeasureRange weightChart = null;
  ModelingMeasureRange equivalence = null;

}

Add new measures for shoe -> equivalence


package com.creatubbles.api.model.partner_application;

import android.support.annotation.NonNull;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author Pawel Szymanski
 */
public enum VideoProvider {
    NONE(""),
    YOUTUBE("youtube"),
    VIMEO("vimeo");

    private String name;

    @JsonCreator
    VideoProvider(String name) {
        this.name = name;
    }

    @JsonValue
    @NonNull
    public String getName() {
        return name;
    }
}

package com.creatubbles.api.model.partner_application;

import android.support.annotation.NonNull;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author Pawel Szymanski
 */
public enum VideoProvider {
    NONE(""),
    YOUTUBE("youtube"),
    VIMEO("vimeo"),
    DIRECT("ctbs3");

    private String name;

    VideoProvider(String name) {
        this.name = name;
    }

    @JsonCreator
    public static VideoProvider fromName(String name) {
        for (VideoProvider videoProvider : values()) {
            if (videoProvider.name.equals(name)) {
                return videoProvider;
            }
        }
        return NONE;
    }

    @JsonValue
    @NonNull
    public String getName() {
        return name;
    }
}

Add new partner video provider type


package io.appium.android.bootstrap.handler;

import io.appium.android.bootstrap.AndroidCommand;
import io.appium.android.bootstrap.AndroidCommandResult;
import io.appium.android.bootstrap.CommandHandler;

import java.util.Hashtable;

import org.json.JSONException;
import org.json.JSONObject;

import com.android.uiautomator.core.UiDevice;

/**
 * This handler is used to PressKeyCode.
 *
 */
public class PressKeyCode extends CommandHandler {
  public Integer keyCode;
  public Integer metaState;

  /*
   * @param command The {@link AndroidCommand} used for this handler.
   *
   * @return {@link AndroidCommandResult}
   *
   * @throws JSONException
   *
   * @see io.appium.android.bootstrap.CommandHandler#execute(io.appium.android.
   * bootstrap.AndroidCommand)
   */
  @Override
  public AndroidCommandResult execute(final AndroidCommand command)
      throws JSONException {
    try {
      final Hashtable<String, Object> params = command.params();
      keyCode = (Integer) params.get("keycode");

      if (params.get("metastate") != JSONObject.NULL) {
        metaState = (Integer) params.get("metastate");
      }

      UiDevice.getInstance().pressKeyCode(keyCode, metaState);

      return getSuccessResult(true);
    } catch (final Exception e) {
      return getErrorResult(e.getMessage());
    }
  }
}

package io.appium.android.bootstrap.handler;

import io.appium.android.bootstrap.AndroidCommand;
import io.appium.android.bootstrap.AndroidCommandResult;
import io.appium.android.bootstrap.CommandHandler;

import java.util.Hashtable;

import org.json.JSONException;
import org.json.JSONObject;

import com.android.uiautomator.core.UiDevice;

/**
 * This handler is used to PressKeyCode.
 *
 */
public class PressKeyCode extends CommandHandler {
  public Integer keyCode;
  public Integer metaState;

  /*
   * @param command The {@link AndroidCommand} used for this handler.
   *
   * @return {@link AndroidCommandResult}
   *
   * @throws JSONException
   *
   * @see io.appium.android.bootstrap.CommandHandler#execute(io.appium.android.
   * bootstrap.AndroidCommand)
   */
  @Override
  public AndroidCommandResult execute(final AndroidCommand command)
      throws JSONException {
    try {
      final Hashtable<String, Object> params = command.params();
      keyCode = (Integer) params.get("keycode");

      if (params.get("metastate") != JSONObject.NULL) {
        metaState = (Integer) params.get("metastate");
        UiDevice.getInstance().pressKeyCode(keyCode, metaState);
      } else {
        UiDevice.getInstance().pressKeyCode(keyCode);
      }

      return getSuccessResult(true);
    } catch (final Exception e) {
      return getErrorResult(e.getMessage());
    }
  }
}

Make sure 'keyevent' works if metastate is null.


package org.cyclops.integrateddynamics.core.logicprogrammer;

import org.cyclops.integrateddynamics.IntegratedDynamics;
import org.cyclops.integrateddynamics.api.logicprogrammer.ILogicProgrammerElement;
import org.cyclops.integrateddynamics.api.logicprogrammer.ILogicProgrammerElementTypeRegistry;

/**
 * All types of logic programmer element types.
 * @author rubensworks
 */
public class LogicProgrammerElementTypes {

    public static final ILogicProgrammerElementTypeRegistry REGISTRY = IntegratedDynamics._instance.getRegistryManager().getRegistry(ILogicProgrammerElementTypeRegistry.class);

    public static void load() {}

    public static final OperatorLPElementType OPERATOR  = REGISTRY.addType(new OperatorLPElementType());
    public static final ValueTypeLPElementType VALUETYPE = REGISTRY.addType(new ValueTypeLPElementType());

    public static boolean areEqual(ILogicProgrammerElement e1, ILogicProgrammerElement e2) {
        if(e1 == null) {
            return e2 == null;
        }
        if(e2 == null) {
            return false;
        }
        return e1.getType().getName().equals(e2.getType().getName()) && e1.getType().getName(e1).equals(e2.getType().getName(e2));
    }

}

package org.cyclops.integrateddynamics.core.logicprogrammer;

import org.cyclops.integrateddynamics.IntegratedDynamics;
import org.cyclops.integrateddynamics.api.logicprogrammer.ILogicProgrammerElement;
import org.cyclops.integrateddynamics.api.logicprogrammer.ILogicProgrammerElementTypeRegistry;

/**
 * All types of logic programmer element types.
 * @author rubensworks
 */
public class LogicProgrammerElementTypes {

    public static final ILogicProgrammerElementTypeRegistry REGISTRY = IntegratedDynamics._instance.getRegistryManager().getRegistry(ILogicProgrammerElementTypeRegistry.class);

    public static void load() {}

    public static final ValueTypeLPElementType VALUETYPE = REGISTRY.addType(new ValueTypeLPElementType());
    public static final OperatorLPElementType OPERATOR  = REGISTRY.addType(new OperatorLPElementType());

    public static boolean areEqual(ILogicProgrammerElement e1, ILogicProgrammerElement e2) {
        if(e1 == null) {
            return e2 == null;
        }
        if(e2 == null) {
            return false;
        }
        return e1.getType().getName().equals(e2.getType().getName()) && e1.getType().getName(e1).equals(e2.getType().getName(e2));
    }

}

Move value types before operators in logic programmer


/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.livedata.resolver;

import java.util.Collection;
import java.util.Map;

import com.opengamma.livedata.LiveDataSpecification;
import com.opengamma.livedata.server.DistributionSpecification;

/**
 * Determines how market data should be distributed to clients.
 */
public interface DistributionSpecificationResolver extends Resolver<LiveDataSpecification, DistributionSpecification> {

  /**
   * Determines how market data should be distributed to clients.
   *
   * @param liveDataSpecificationFromClient what the client wants. Different specs from the client can map to the same distribution spec.
   * @return a valid distribution specification. Null if the distribution spec cannot be built.
   */
  DistributionSpecification resolve(LiveDataSpecification liveDataSpecificationFromClient);

  /**
   * Same as calling {@link #resolve(LiveDataSpecification)}
   * individually, but since it works in bulk, may be more efficient.
   *
   * @param liveDataSpecifications what the client wants. Different specs from the client can map to the same distribution spec.
   * @return map from request to result.
   * For each input spec, there must be an entry in the map.
   * @throws IllegalArgumentException if the distribution spec cannot be built.
   */
  Map<LiveDataSpecification, DistributionSpecification> resolve(Collection<LiveDataSpecification> liveDataSpecifications);

}

/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.livedata.resolver;

import java.util.Collection;
import java.util.Map;

import com.opengamma.livedata.LiveDataSpecification;
import com.opengamma.livedata.server.DistributionSpecification;

/**
 * Determines how market data should be distributed to clients.
 */
public interface DistributionSpecificationResolver extends Resolver<LiveDataSpecification, DistributionSpecification> {

  /**
   * Determines how market data should be distributed to clients.
   *
   * @param liveDataSpecificationFromClient what the client wants. Different specs from the client can map to the same distribution spec.
   * @return a valid distribution specification. Null if the distribution spec cannot be built.
   */
  DistributionSpecification resolve(LiveDataSpecification liveDataSpecificationFromClient);

  /**
   * Same as calling {@link #resolve(LiveDataSpecification)}
   * individually, but since it works in bulk, may be more efficient.
   *
   * @param liveDataSpecifications what the client wants. Different specs from the client can map to the same distribution spec.
   * @return map from request to result.
   * For each input spec, there must be an entry in the map.
   * The value will be null if the distribution spec cannot be build for that spec
   */
  Map<LiveDataSpecification, DistributionSpecification> resolve(Collection<LiveDataSpecification> liveDataSpecifications);

}

Comment the semantics of the spec resolver to match the (more useful) semantics of the implementations


package es.tid.bdp.platform.cluster.server;

/**
 *
 * @author dmicol
 */
public class ClusterServerMain {
    public static void main(String[] args) {
        try {
            ClusterServer server = new ClusterServer();
            server.start();
        } catch (Exception ex) {
            System.exit(1);
        }
    }

    private ClusterServerMain() {
    }
}

package es.tid.bdp.platform.cluster.server;

import org.apache.log4j.Logger;

/**
 *
 * @author dmicol
 */
public class ClusterServerMain {
    private static final Logger LOG = Logger.getLogger(ClusterServer.class);

    public static void main(String[] args) {
        try {
            ClusterServer server = new ClusterServer();
            server.start();
        } catch (Exception ex) {
            LOG.fatal(ex.getMessage());
            System.exit(1);
        }
    }

    private ClusterServerMain() {
    }
}

Add logging to the main file.


package com.uwetrottmann.getglue.services;

import com.uwetrottmann.getglue.BaseTestCase;
import com.uwetrottmann.getglue.entities.GetGlueInteraction;
import com.uwetrottmann.getglue.entities.GetGlueInteractionResource;

import java.util.List;

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

public class InteractionServiceTest extends BaseTestCase {

    public static final String SAMPLE_INTERACTION = "getgluejava/2013-10-24T18:30:38Z";

    public void test_get() {
        InteractionService service = getManager().interactionService();
        GetGlueInteractionResource resource = service.get(SAMPLE_INTERACTION);
        assertThat(resource).isNotNull();
        assertThat(resource.interaction).isNotNull();
        assertThat(resource.interaction._object).isNotNull();
        assertThat(resource.interaction._object.id).isEqualTo("tv_shows/how_i_met_your_mother");
        assertThat(resource.interaction._object.title).isEqualTo("How I Met Your Mother");
        assertThat(resource.interaction.comment).isEqualTo("Testing getglue-java.");
    }

    public void test_votes() {
        InteractionService service = getManager().interactionService();
        List<GetGlueInteraction> resource = service.votes(SAMPLE_INTERACTION);
        assertThat(resource).isNotNull();
    }

    public void test_replies() {
        InteractionService service = getManager().interactionService();
        List<GetGlueInteraction> resource = service.replies(SAMPLE_INTERACTION);
        assertThat(resource).isNotNull();
    }

}

package com.uwetrottmann.getglue.services;

import com.uwetrottmann.getglue.BaseTestCase;
import com.uwetrottmann.getglue.entities.GetGlueInteraction;
import com.uwetrottmann.getglue.entities.GetGlueInteractionResource;

import java.util.List;

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

public class InteractionServiceTest extends BaseTestCase {

    public static final String SAMPLE_INTERACTION = "getgluejava/2014-04-22T17:08:08Z";

    public void test_get() {
        InteractionService service = getManager().interactionService();
        GetGlueInteractionResource resource = service.get(SAMPLE_INTERACTION);
        assertThat(resource).isNotNull();
        assertThat(resource.interaction).isNotNull();
        assertThat(resource.interaction._object).isNotNull();
        assertThat(resource.interaction._object.id).isEqualTo("tv_shows/how_i_met_your_mother");
        assertThat(resource.interaction._object.title).isEqualTo("How I Met Your Mother");
        assertThat(resource.interaction.comment).isEqualTo("Testing getglue-java.");
    }

    public void test_votes() {
        InteractionService service = getManager().interactionService();
        List<GetGlueInteraction> resource = service.votes(SAMPLE_INTERACTION);
        assertThat(resource).isNotNull();
    }

    public void test_replies() {
        InteractionService service = getManager().interactionService();
        List<GetGlueInteraction> resource = service.replies(SAMPLE_INTERACTION);
        assertThat(resource).isNotNull();
    }

}

Fix interaction test: use newer interaction.


package totemic_commons.pokefenn.misc;

import java.util.List;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import totemic_commons.pokefenn.ModBlocks;
import totemic_commons.pokefenn.lib.Strings;

public class CreativeTabTotemic extends CreativeTabs
{
    public CreativeTabTotemic(int id, String name)
    {
        super(id, name);
    }

    @SideOnly(Side.CLIENT)
    @Override
    public Item getTabIconItem()
    {
        return Item.getItemFromBlock(ModBlocks.tipi);
    }

    @SideOnly(Side.CLIENT)
    @Override
    public void displayAllReleventItems(List<ItemStack> list)
    {
        super.displayAllReleventItems(list);

        ItemStack stack = new ItemStack(Items.spawn_egg);
        NBTTagCompound eggTag = new NBTTagCompound();
        eggTag.setString("entity_name", "totemic." + Strings.BUFFALO_NAME);
        stack.setTagCompound(eggTag);
        list.add(stack);
    }
}

package totemic_commons.pokefenn.misc;

import java.util.List;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import totemic_commons.pokefenn.ModBlocks;
import totemic_commons.pokefenn.lib.Strings;

public class CreativeTabTotemic extends CreativeTabs
{
    public CreativeTabTotemic(int id, String name)
    {
        super(id, name);
    }

    @SideOnly(Side.CLIENT)
    @Override
    public Item getTabIconItem()
    {
        return Item.getItemFromBlock(ModBlocks.tipi);
    }

    @SideOnly(Side.CLIENT)
    @Override
    public void displayAllReleventItems(List<ItemStack> list)
    {
        super.displayAllReleventItems(list);

        list.add(getEgg("totemic." + Strings.BUFFALO_NAME));
        list.add(getEgg("totemic." + Strings.BAYKOK_NAME));
    }

    public static ItemStack getEgg(String entityName)
    {
        ItemStack stack = new ItemStack(Items.spawn_egg);
        NBTTagCompound eggTag = new NBTTagCompound();
        eggTag.setString("entity_name", entityName);
        stack.setTagCompound(eggTag);
        return stack;
    }
}

Add Baykok spawn egg to creative tab