package ge.edu.freeuni.sdp.arkanoid.presenter;

import ge.edu.freeuni.sdp.arkanoid.model.Beam;
import ge.edu.freeuni.sdp.arkanoid.model.BrickColor;
import ge.edu.freeuni.sdp.arkanoid.model.geometry.Size;

class BeamPresenter extends RectanglePresenter<Beam> {

    BeamPresenter(Size size, Beam gameObject) {
        super(gameObject, size);
    }

    @Override
    CellContent getContent() {
        Beam beam = getGameObject();
        return CellContent.Beam;
    }

}

package ge.edu.freeuni.sdp.arkanoid.presenter;

import ge.edu.freeuni.sdp.arkanoid.model.Beam;
import ge.edu.freeuni.sdp.arkanoid.model.BrickColor;
import ge.edu.freeuni.sdp.arkanoid.model.geometry.Size;

class BeamPresenter extends RectanglePresenter<Beam> {

    BeamPresenter(Beam gameObject, Size size) {
        super(gameObject, size);
    }

    @Override
    CellContent getContent() {
        Beam beam = getGameObject();
        return CellContent.Beam;
    }

}

Change parameter order to match other GobjPresenters


package net.mcft.copy.betterstorage.item.cardboard;

import net.mcft.copy.betterstorage.item.ItemBetterStorage;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraftforge.common.EnumHelper;

public class ItemCardboardSheet extends ItemBetterStorage {

	public static final EnumToolMaterial toolMaterial =
			EnumHelper.addToolMaterial("cardboard", 0, 48, 2.5F, 0.0F, 18);
	public static final EnumArmorMaterial armorMaterial =
			EnumHelper.addArmorMaterial("cardboard", 3, new int[]{ 1, 2, 2, 1 }, 20);

	public ItemCardboardSheet(int id) {
		super(id);
		setMaxStackSize(8);

		toolMaterial.customCraftingMaterial = this;
		armorMaterial.customCraftingMaterial = this;
	}

}

package net.mcft.copy.betterstorage.item.cardboard;

import net.mcft.copy.betterstorage.item.ItemBetterStorage;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraftforge.common.EnumHelper;

public class ItemCardboardSheet extends ItemBetterStorage {

	public static final EnumToolMaterial toolMaterial =
			EnumHelper.addToolMaterial("cardboard", 0, 64, 2.5F, 0.0F, 18);
	public static final EnumArmorMaterial armorMaterial =
			EnumHelper.addArmorMaterial("cardboard", 5, new int[]{ 1, 2, 2, 1 }, 20);

	public ItemCardboardSheet(int id) {
		super(id);
		setMaxStackSize(8);

		toolMaterial.customCraftingMaterial = this;
		armorMaterial.customCraftingMaterial = this;
	}

}

Increase durability of cardboard items

Increase durability of cardboard items


package com.crawljax.util;

import static org.junit.Assert.assertEquals;

import java.io.File;

import org.junit.Test;

public class PrettyHTMLTest {

	private static final String TESTFILE = "src/test/java/com/crawljax/util/tuduDombefore.html";
	private static final String CONTROLFILE =
	        "src/test/java/com/crawljax/util/tuduDombefore.html.tidy";

	@Test
	public void prettifyHTML() {
		String testdom = Helper.getContent(new File(TESTFILE));
		String controldom = Helper.getContent(new File(CONTROLFILE));

		testdom = PrettyHTML.prettyHTML(testdom);

		assertEquals(controldom, testdom);
	}
}

package com.crawljax.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.io.File;

import org.junit.Test;

public class PrettyHTMLTest {

	private static final String TESTFILE = "src/test/java/com/crawljax/util/tuduDombefore.html";
	private static final String CONTROLFILE =
	        "src/test/java/com/crawljax/util/tuduDombefore.html.tidy";

	@Test
	public void prettifyHTML() {
		String testdom = Helper.getContent(new File(TESTFILE));
		String controldom = Helper.getContent(new File(CONTROLFILE));

		assertNotNull("File should be read", testdom);
		assertNotNull("File should be read", controldom);

		testdom = PrettyHTML.prettyHTML(testdom);

		assertEquals(controldom, testdom);
	}
}

Make sure the files are loaded correctly

git-svn-id: 6e5f6f61bd1b925b71fe8065f445f9178a317ca5@350 7701cf9b-ed3c-0410-a7c3-1ff289697e89


package org.pdxfinder.admin.controllers;

import org.pdxfinder.admin.pojos.MappingContainer;
import org.pdxfinder.services.MappingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

/*
 * Created by csaba on 09/07/2018.
 */
@RestController
public class AjaxController {

    private MappingService mappingService;

    @Value("${diagnosis.mappings.file}")
    private String savedDiagnosisMappingsFile;

    @Autowired
    public AjaxController(MappingService mappingService) {
        this.mappingService = mappingService;
    }

    @RequestMapping(value = "/getmissingdiagnosismappings")
    @ResponseBody
    public MappingContainer getMissingMappings(@RequestParam("datasource") Optional<String> dataSource){

        String ds = null;
        if(dataSource.isPresent() && !dataSource.get().isEmpty()){
            ds = dataSource.get();
        }

        return mappingService.getMissingMappings(ds);
    }

}

package org.pdxfinder.admin.controllers;

import org.pdxfinder.admin.pojos.MappingContainer;
import org.pdxfinder.services.MappingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

/*
 * Created by csaba on 09/07/2018.
 */
@RestController
public class AjaxController {

    private MappingService mappingService;

    @Value("${diagnosis.mappings.file}")
    private String savedDiagnosisMappingsFile;

    @Autowired
    public AjaxController(MappingService mappingService) {
        this.mappingService = mappingService;
    }

    @RequestMapping(value = "/api/missingmapping/diagnosis")
    @ResponseBody
    public MappingContainer getMissingMappings(@RequestParam("ds") Optional<String> dataSource){

        String ds = null;
        if(dataSource.isPresent() && !dataSource.get().isEmpty()){
            ds = dataSource.get();
        }

        return mappingService.getMissingMappings(ds);
    }

}

Change url and param name

Change url and param name


/*
 * Mutability Detector
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 *
 * Further licensing information for this project can be found in
 * 		license/LICENSE.txt
 */

package org.mutabilitydetector.cli;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;

import org.junit.Ignore;
import org.junit.Test;

import com.google.classpath.ClassPathFactory;

public class NullPointerExceptionAnalysingRtJar {

    private final PrintStream errorStream = new PrintStream(new OutputStream() {
        @Override
        public void write(int b) throws IOException {
            // suppress output in tests
        }
    });

    @Ignore
    @Test
    public void checkNullPointerExceptionIsNotThrown() {
        String rtJarPath = System.getProperty("java.home") + "/lib/rt.jar";
        BatchAnalysisOptions options = new CommandLineOptions(errorStream, "-cp", rtJarPath);
        new RunMutabilityDetector(new ClassPathFactory().createFromPath(rtJarPath), options).run();
    }

}

/*
 * Mutability Detector
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 *
 * Further licensing information for this project can be found in
 * 		license/LICENSE.txt
 */

package org.mutabilitydetector.cli;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;

import org.junit.Ignore;
import org.junit.Test;

import com.google.classpath.ClassPathFactory;

public class NullPointerExceptionAnalysingRtJar {

    private final PrintStream errorStream = new PrintStream(new OutputStream() {
        @Override
        public void write(int b) throws IOException {
            // suppress output in tests
        }
    });

    @Ignore
    @Test
    public void checkNullPointerExceptionIsNotThrown() {
        String rtJarPath = System.getProperty("java.home") + "/lib/rt.jar";
        BatchAnalysisOptions options = new CommandLineOptions(errorStream, "-cp", rtJarPath);
        new RunMutabilityDetector(new ClassPathFactory().createFromPath(rtJarPath), options).run();
    }

    @Ignore
    @Test
    public void checkNullPointerExceptionIsNotThrownOnAbritaryCodebase() {
        String rtJarPath = "...";
        BatchAnalysisOptions options = new CommandLineOptions(errorStream, "-cp", rtJarPath);
        new RunMutabilityDetector(new ClassPathFactory().createFromPath(rtJarPath), options).run();
    }

}

Add convenience test for running against a filesystem codebase.

git-svn-id: ed609ce04ec9e3c0bc25e071e87814dd6d976548@417 c7a0535c-eda6-11de-83d8-6d5adf01d787


package org.gemoc.gemoc_language_workbench.api.core;

import java.util.Set;

import org.gemoc.execution.engine.trace.gemoc_execution_trace.LogicalStep;
import org.gemoc.gemoc_language_workbench.api.core.EngineStatus.RunStatus;
import org.gemoc.gemoc_language_workbench.api.engine_addon.IEngineAddon;

public interface IExecutionEngine extends IBasicExecutionEngine{

	public abstract IExecutionContext getExecutionContext();

	public abstract EngineStatus getEngineStatus();

	public abstract RunStatus getRunningStatus();

	public abstract void notifyEngineAboutToStart();

	public abstract void notifyEngineStarted();

	public abstract void notifyAboutToStop();

	public abstract void notifyEngineStopped();

	public abstract void notifyEngineAboutToDispose();

	public abstract void notifyAboutToExecuteLogicalStep(LogicalStep l);

	public abstract void notifyLogicalStepExecuted(LogicalStep l);

	public abstract <T extends IEngineAddon> boolean hasAddon(Class<T> type);

	public abstract <T extends IEngineAddon> T getAddon(Class<T> type);

	public abstract <T extends IEngineAddon> Set<T> getAddonsTypedBy(Class<T> type);

	public abstract void setEngineStatus(RunStatus stopped);

}

package org.gemoc.gemoc_language_workbench.api.core;

import java.util.Set;

import org.gemoc.execution.engine.trace.gemoc_execution_trace.LogicalStep;
import org.gemoc.gemoc_language_workbench.api.core.EngineStatus.RunStatus;
import org.gemoc.gemoc_language_workbench.api.engine_addon.IEngineAddon;

public interface IExecutionEngine extends IBasicExecutionEngine{

	public abstract IExecutionContext getExecutionContext();

	public abstract EngineStatus getEngineStatus();

	public abstract RunStatus getRunningStatus();

	public abstract void notifyEngineAboutToStart();

	public abstract void notifyEngineStarted();

	public abstract void notifyAboutToStop();

	public abstract void notifyEngineStopped();

	public abstract void notifyEngineAboutToDispose();

	public abstract void notifyAboutToExecuteLogicalStep(LogicalStep l);

	public abstract void notifyLogicalStepExecuted(LogicalStep l);

	public abstract <T extends IEngineAddon> boolean hasAddon(Class<T> type);

	public abstract <T extends IEngineAddon> T getAddon(Class<T> type);

	public abstract void setEngineStatus(RunStatus stopped);

}

Remove redundant service declaration in exeengine services


/**
 * SMTI06, 54411850, M Haidar Hanif
 * Task Five: Automated Teller Machine
 * Auteline | Simple ATM simulator with basic features
 */

// Screen.java
// Represents the screen of the ATM

package main.java;

public class Screen {

  // display a message without a carriage return
  public void displayMessage(String message) {
    System.out.print(message);
  }

  // display a message with a carriage return
  public void displayMessageLine(String message) {
    System.out.println(message);
  }

  // displays a dollar amount
  public void displayDollarAmount(double amount) {
    System.out.printf("$%,.2f", amount);
  }

}

/**
 * SMTI06, 54411850, M Haidar Hanif
 * Task Five: Automated Teller Machine
 * Auteline | Simple ATM simulator with basic features
 */

// Screen.java
// Represents the screen of the ATM

package main.java;

public class Screen {

  // display a message without a carriage return
  public void displayMessage(String message) {
    System.out.print(message);
  }

  // display a message with a carriage return
  public void displayMessageLine(String message) {
    System.out.println(message);
  }

  // displays a dollar amount
  public void displayDollarAmount(double amount) {
    System.out.printf("$%,.2f", amount);
  }

  // get message with a carriage return
  public String getMessage(String message) {
    return message;
  }

  // get dollar amount
  public String getDollarAmount(double amount) {
    return String.format("$%,.2f", amount);
  }

}

Create new methods to get specific string


/*
 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
module org.opendaylight.yangtools.yang.parser.spi {
    exports org.opendaylight.yangtools.yang.parser.spi;
    exports org.opendaylight.yangtools.yang.parser.spi.meta;
    exports org.opendaylight.yangtools.yang.parser.spi.source;
    exports org.opendaylight.yangtools.yang.parser.spi.validation;

    requires transitive org.opendaylight.yangtools.yang.model.api;
    requires org.opendaylight.yangtools.yang.common;
    requires org.slf4j;

    // Annotations
    requires static com.github.spotbugs.annotations;
    requires static org.eclipse.jdt.annotation;
}

/*
 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
module org.opendaylight.yangtools.yang.parser.spi {
    exports org.opendaylight.yangtools.yang.parser.spi;
    exports org.opendaylight.yangtools.yang.parser.spi.meta;
    exports org.opendaylight.yangtools.yang.parser.spi.source;
    exports org.opendaylight.yangtools.yang.parser.spi.validation;

    requires transitive org.opendaylight.yangtools.yang.model.api;
    requires com.google.common;
    requires org.opendaylight.yangtools.yang.common;
    requires org.slf4j;

    // Annotations
    requires static com.github.spotbugs.annotations;
    requires static org.eclipse.jdt.annotation;
}

Add guava to yang-parser-spi requirements

This is just another edit, we really need to do an audit.

Change-Id: I27dcc75d07d38d9c7e94c70d4cdfeb6d954b4c48
Signed-off-by: Robert Varga <91ae5aa8c7a9f7e57b701db766e23e544aaa6ae9@pantheon.tech>


package net.hexid.jfx;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;

public class LabeledField extends HBox {
	private TextField field;

	public TextField getField() {
		return field;
	}

	public void setText(String text) {
		field.setText(text);
	}
	public String getText() {
		return field.getText();
	}

	public LabeledField(Class<? extends TextField> cls, String label) {
		super(3.0);
		HBox.setHgrow(this, Priority.ALWAYS);
		UtilsFX.setVBoxMargin(this);

		try {
			field = cls.newInstance();
		} catch(InstantiationException | IllegalAccessException ex) {
			field = new TextField();
		}
		HBox.setHgrow(field, Priority.ALWAYS);

		getChildren().addAll(new Label(label), field);
	}
}

package net.hexid.jfx;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import net.hexid.hexbot.bot.BotTab;

public class LabeledField extends HBox {
	private TextField field;

	public TextField getField() {
		return field;
	}

	public void setText(String text) {
		field.setText(text);
	}
	public String getText() {
		return field.getText();
	}

	public LabeledField(Class<? extends TextField> cls, String label) {
		super(3.0);
		HBox.setHgrow(this, Priority.ALWAYS);
		VBox.setMargin(this, BotTab.INSETS);

		try {
			field = cls.newInstance();
		} catch(InstantiationException | IllegalAccessException ex) {
			field = new TextField();
		}
		HBox.setHgrow(field, Priority.ALWAYS);

		getChildren().addAll(new Label(label), field);
	}
}

Change from using UtilsFX to BotTab for static variables


package annis.gui.admin.reflinks;

import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TextField;

public class MigrationPanel extends Panel {

  /**
   *
   */
  private static final long serialVersionUID = -6893786947746535332L;

  @Override
  public void attach() {
    super.attach();

    TextField serviceUrl = new TextField("ANNIS service URL");
    TextField serviceUsername = new TextField("Username for ANNIS service");
    TextField servicePassword = new TextField("Password for ANNIS service");

    FormLayout layout = new FormLayout(serviceUrl, serviceUsername, servicePassword);
    setContent(layout);
  }

}

package annis.gui.admin.reflinks;

import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

public class MigrationPanel extends Panel {

  /**
   *
   */
  private static final long serialVersionUID = -6893786947746535332L;

  @Override
  public void attach() {
    super.attach();

    TextField serviceUrl = new TextField("ANNIS service URL");
    TextField serviceUsername = new TextField("Username for ANNIS service");
    TextField servicePassword = new TextField("Password for ANNIS service");
    CheckBox skipExisting = new CheckBox("Skip existing UUIDs");

    FormLayout formLayout =
        new FormLayout(serviceUrl, serviceUsername, servicePassword, skipExisting);

    Button btMigrate = new Button("Start migration");

    VerticalLayout layout = new VerticalLayout(formLayout, btMigrate);
    setContent(layout);
  }

}

Add more fields to the migration panel

Add more fields to the migration panel


package com.nincraft.ninbot.command;

import com.nincraft.ninbot.command.util.CommandParser;
import com.nincraft.ninbot.util.MessageUtils;
import lombok.val;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;

public class HelpCommand extends AbstractCommand {

    public HelpCommand() {
        length = 2;
        name = "help";
        description = "Displays this awesome message";
    }

    @Override
    public void executeCommand(MessageReceivedEvent event) {
        val map = CommandParser.getCommandHashMap();
        StringBuilder stringBuilder = new StringBuilder();
        for (val key : map.keySet()) {
            if (!map.get(key).isHidden()) {
                stringBuilder.append(map.get(key));
                stringBuilder.append("\n");
            }
        }
        MessageUtils.sendMessage(event.getChannel(), stringBuilder.toString());
    }
}

package com.nincraft.ninbot.command;

import com.nincraft.ninbot.command.util.CommandParser;
import com.nincraft.ninbot.util.MessageUtils;
import lombok.val;
import net.dv8tion.jda.core.EmbedBuilder;
import net.dv8tion.jda.core.MessageBuilder;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;

import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class HelpCommand extends AbstractCommand {

    public HelpCommand() {
        length = 2;
        name = "help";
        description = "Displays this awesome message";
    }

    @Override
    public void executeCommand(MessageReceivedEvent event) {
        val map = CommandParser.getCommandHashMap();
        MessageBuilder messageBuilder = new MessageBuilder();
        EmbedBuilder embedBuilder = new EmbedBuilder();
        embedBuilder.setTitle("List of commands");
        embedBuilder.setColor(Color.BLUE);
        List<String> keyList = new ArrayList<>(map.keySet());
        Collections.sort(keyList);
        for (val key : keyList) {
            if (!map.get(key).isHidden()) {
                embedBuilder.addField(key, map.get(key).getDescription(), false);
            }
        }
        messageBuilder.setEmbed(embedBuilder.build());
        MessageUtils.sendMessage(event.getChannel(), messageBuilder.build());
    }
}

Make Help command more fancy

Make Help command more fancy


package org.k13n.swtstubber.util;

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

public class FileUtil {

  public static byte[] writeStreamToArray(InputStream stream)
      throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    byte[] buffer = new byte[1024];
    int length = 0;
    while ((length = stream.read(buffer)) != -1)
      baos.write(buffer, 0, length);
    return baos.toByteArray();
  }

}

package org.k13n.swtstubber.util;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class FileUtil {

  public static byte[] writeStreamToArray(InputStream stream)
      throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    byte[] buffer = new byte[1024];
    int length = 0;
    while ((length = stream.read(buffer)) != -1)
      baos.write(buffer, 0, length);
    return baos.toByteArray();
  }

  public static void writeBytecode(String targetDirectory, String className,
      byte[] bytecode) throws IOException {
    String packageName = packageName(className);
    createPackageHierarchy(targetDirectory, packageName);
    String file = targetDirectory + File.separator + className + ".class";
    FileOutputStream stream = new FileOutputStream(new File(file));
    stream.write(bytecode, 0, bytecode.length);
    stream.flush();
    stream.close();
  }

  private static String createPackageHierarchy(String targetDirectory,
      String packageName) {
    String path = targetDirectory;
    for (String folder : packageName.split("\\.")) {
      path = path + File.separator + folder;
      createDirectoryIfNotExists(path);
    }
    return path;
  }

  private static void createDirectoryIfNotExists(String directory) {
    File file = new File(directory);
    if (file.exists()) {
      if (!file.isDirectory()) {
        String msg = "Path " + directory + " exists, but is not a directory";
        throw new RuntimeException(msg);
      }
    } else {
      file.mkdir();
    }
  }

  private static String packageName(String internalName) {
    int separatorPos = internalName.lastIndexOf("/");
    String packageName = internalName.substring(0, separatorPos);
    return packageName.replace('/', '.');
  }

}

Add methods to write the transformed bytecode to a file


package org.limeprotocol.util;

import java.util.LinkedHashMap;
import java.util.Map;

public class StringUtils {

    public static boolean isNullOrEmpty(String string){
        return string == null || string.equals("");
    }

    public static boolean isNullOrWhiteSpace(String string){
        return isNullOrEmpty(string) || string.trim().length() == 0;
    }

    public static String format(String pattern, Object... values){

        Map<String, Object> tags = new LinkedHashMap<String, Object>();

        for (int i=0; i<values.length; i++){
            tags.put("\\{" + i + "\\}", values[i]);
        }

        String formatted = pattern;
        for (Map.Entry<String, Object> tag : tags.entrySet()) {
            // bottleneck, creating temporary String objects!
            formatted = formatted.replaceAll(tag.getKey(), tag.getValue().toString());
        }
        return formatted;
    }

    public static String trimEnd(String string, String finalCharacter){
        string.trim();
        if(string.endsWith(finalCharacter)){
            return string.substring(0, string.length()-1);
        }

        return string;
    }
}

package org.limeprotocol.util;

import java.util.LinkedHashMap;
import java.util.Map;

public class StringUtils {

    public static boolean isNullOrEmpty(String string){
        return string == null || string.equals("");
    }

    public static boolean isNullOrWhiteSpace(String string){
        return isNullOrEmpty(string) || string.trim().length() == 0;
    }

    public static String format(String pattern, Object... values){

        Map<String, Object> tags = new LinkedHashMap<String, Object>();

        for (int i=0; i<values.length; i++){
            tags.put("\\{" + i + "\\}", values[i]==null ? "" : values[i]);
        }

        String formatted = pattern;
        for (Map.Entry<String, Object> tag : tags.entrySet()) {
            // bottleneck, creating temporary String objects!
            formatted = formatted.replaceAll(tag.getKey(), tag.getValue().toString());
        }
        return formatted;
    }

    public static String trimEnd(String string, String finalCharacter){
        string.trim();
        if(string.endsWith(finalCharacter)){
            return string.substring(0, string.length()-1);
        }

        return string;
    }
}

Transform null values to empty string

Transform null values to empty string


package com.pqbyte.coherence;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.pqbyte.coherence.Coherence;

public class AndroidLauncher extends AndroidApplication {
	@Override
	protected void onCreate (Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
		initialize(new Coherence2(), config);
	}
}

package com.pqbyte.coherence;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;

public class AndroidLauncher extends AndroidApplication {
	@Override
	protected void onCreate (Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
		initialize(new Coherence(), config);
	}
}

Change initialize in onCreate to Coherence


/*
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016, 2017
 */
package com.ibm.streamsx.topology.internal.context.remote;

import static com.ibm.streamsx.topology.internal.gson.GsonUtilities.object;

import java.io.File;
import java.io.IOException;
import java.util.concurrent.Future;

import com.google.gson.JsonObject;
import com.ibm.streamsx.topology.internal.streaminganalytics.VcapServices;

public class RemoteBuildAndSubmitRemoteContext extends ZippedToolkitRemoteContext {
	@Override
    public Type getType() {
        return Type.ANALYTICS_SERVICE;
    }

	@Override
	public Future<File> submit(JsonObject submission) throws Exception {
		Future<File> archive = super.submit(submission);
		JsonObject deploy = object(submission, "deploy");
		doSubmit(deploy, archive.get());
       return archive;
	}

	private void doSubmit(JsonObject deploy, File archive) throws IOException{
		JsonObject service = VcapServices.getVCAPService(key -> deploy.get(key));
        JsonObject credentials = object(service,  "credentials");

        BuildServiceRemoteRESTWrapper wrapper = new BuildServiceRemoteRESTWrapper(credentials);
        wrapper.remoteBuildAndSubmit(deploy, archive);
	}
}

/*
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016, 2017
 */
package com.ibm.streamsx.topology.internal.context.remote;

import static com.ibm.streamsx.topology.internal.gson.GsonUtilities.object;

import java.io.File;
import java.io.IOException;
import java.util.concurrent.Future;

import com.google.gson.JsonObject;
import com.ibm.streamsx.topology.internal.streaminganalytics.VcapServices;

public class RemoteBuildAndSubmitRemoteContext extends ZippedToolkitRemoteContext {
	@Override
    public Type getType() {
        return Type.ANALYTICS_SERVICE;
    }

	@Override
	public Future<File> submit(JsonObject submission) throws Exception {
	    JsonObject deploy = object(submission, "deploy");
	    JsonObject service = VcapServices.getVCAPService(key -> deploy.get(key));

		Future<File> archive = super.submit(submission);

		doSubmit(deploy, service, archive.get());
       return archive;
	}

	private void doSubmit(JsonObject deploy, JsonObject service, File archive) throws IOException{

        JsonObject credentials = object(service,  "credentials");

        BuildServiceRemoteRESTWrapper wrapper = new BuildServiceRemoteRESTWrapper(credentials);
        wrapper.remoteBuildAndSubmit(deploy, archive);
	}
}

Check VCAP info as soon as possible

Check VCAP info as soon as possible


package it.smc.liferay.privacy.web.application.list;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

import com.liferay.application.list.BasePanelApp;
import com.liferay.application.list.PanelApp;
import com.liferay.application.list.constants.PanelCategoryKeys;
import com.liferay.portal.kernel.model.Portlet;

import it.smc.liferay.privacy.web.util.PrivacyPortletKeys;

@Component(
	immediate = true,
	property = {
		"panel.app.order:Integer=300",
		"panel.category.key=" + PanelCategoryKeys.SITE_ADMINISTRATION_CONTENT
	},
	service = PanelApp.class
)
public class PrivacyPanelApp extends BasePanelApp {

	@Override
	public String getPortletId() {
		return PrivacyPortletKeys.PRIVACY_ADMIN;
	}

	@Override
	@Reference(
		target = "(javax.portlet.name=" + PrivacyPortletKeys.PRIVACY_ADMIN + ")",
		unbind = "-"
	)
	public void setPortlet(Portlet portlet) {
		super.setPortlet(portlet);
	}

}

package it.smc.liferay.privacy.web.application.list;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

import com.liferay.application.list.BasePanelApp;
import com.liferay.application.list.PanelApp;
import com.liferay.application.list.constants.PanelCategoryKeys;
import com.liferay.portal.kernel.model.Portlet;

import it.smc.liferay.privacy.web.util.PrivacyPortletKeys;

@Component(
	immediate = true,
	property = {
		"panel.app.order:Integer=300",
		"panel.category.key=" + PanelCategoryKeys.SITE_ADMINISTRATION_CONFIGURATION
	},
	service = PanelApp.class
)
public class PrivacyPanelApp extends BasePanelApp {

	@Override
	public String getPortletId() {
		return PrivacyPortletKeys.PRIVACY_ADMIN;
	}

	@Override
	@Reference(
		target = "(javax.portlet.name=" + PrivacyPortletKeys.PRIVACY_ADMIN + ")",
		unbind = "-"
	)
	public void setPortlet(Portlet portlet) {
		super.setPortlet(portlet);
	}

}

Move the privacy config portlet to the Configuration section


package com.sequenceiq.common.api.type;

public enum ImageType {
    FREEIPA,
    DATAHUB,
    DATALAKE,
    RUNTIME,
    UNKNOWN
}

package com.sequenceiq.common.api.type;

public enum ImageType {
    FREEIPA,
    RUNTIME,
    UNKNOWN
}

CB-14466: Remove the obsoleted DATAHUB/DATALAKE enum values


package arez.integration.dagger.codegen;

import arez.integration.AbstractArezIntegrationTest;
import javax.annotation.Nonnull;
import static org.testng.Assert.*;

public class AbstractCodegenIntegrationTest
  extends AbstractArezIntegrationTest
{
  final void assertClassNotPresent( @Nonnull final String className )
  {
    assertThrows( ClassNotFoundException.class, () -> Class.forName( "arez.integration.dagger.codegen." + className ) );
  }

  final void assertClassPresent( @Nonnull final String className )
    throws ClassNotFoundException
  {
    assertNotNull( Class.forName( "arez.integration.dagger.codegen." + className ) );
  }
}

package arez.integration.dagger.codegen;

import arez.integration.AbstractArezIntegrationTest;
import javax.annotation.Nonnull;
import static org.testng.Assert.*;

public class AbstractCodegenIntegrationTest
  extends AbstractArezIntegrationTest
{
  protected final void assertClassNotPresent( @Nonnull final String className )
  {
    assertThrows( ClassNotFoundException.class, () -> Class.forName( getPackagePrefix() + className ) );
  }

  protected final void assertClassPresent( @Nonnull final String className )
    throws ClassNotFoundException
  {
    assertNotNull( Class.forName( getPackagePrefix() + className ) );
  }

  @Nonnull
  private String getPackagePrefix()
  {
    return getClass().getCanonicalName().replaceAll( "^(.*\\.)[^.]+$", "$1" );
  }
}

Make assertions work in other packages

Make assertions work in other packages


package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.templates.commands.*;

/**
 * Main Robot Class.
 */
public class RobotMain extends IterativeRobot {

    private ImageProcess ip;

    /**
     * This function is run when the robot is first started up and should be
     * used for any initialization code.
     */
    public void robotInit() {
        //ip = new ImageProcess();
        // Initialize all subsystems
        CommandBase.init();
    }

    public void autonomousInit() {
        ip.start();
    }

    /**
     * This function is called periodically during autonomous
     */
    public void autonomousPeriodic() {
        Scheduler.getInstance().run();
    }

    public void teleopInit() {
    }

    /**
     * This function is called periodically during operator control.
     */
    public void teleopPeriodic() {
        Scheduler.getInstance().run();
    }

    /**
     * This function is called periodically during test mode.
     */
    public void testPeriodic() {
        LiveWindow.run();
    }

    public void disabledPeriodic() {
    }

    public void disabledInit() {
        System.out.println("Robot Main disabledInit(): Called");
    }

}

package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.templates.commands.*;

/**
 * Main Robot Class.
 */
public class RobotMain extends IterativeRobot {

    /**
     * This function is run when the robot is first started up and should be
     * used for any initialization code.
     */
    public void robotInit() {
        // Initialize all subsystems
        CommandBase.init();
    }

    public void autonomousInit() {
        ImageProcess ip = new ImageProcess();
        ip.start();
    }

    /**
     * This function is called periodically during autonomous
     */
    public void autonomousPeriodic() {
        Scheduler.getInstance().run();
    }

    public void teleopInit() {
    }

    /**
     * This function is called periodically during operator control.
     */
    public void teleopPeriodic() {
        Scheduler.getInstance().run();
    }

    /**
     * This function is called periodically during test mode.
     */
    public void testPeriodic() {
        LiveWindow.run();
    }

    public void disabledPeriodic() {
    }

    public void disabledInit() {
        System.out.println("Robot Main disabledInit(): Called");
    }
}

Move this out of RobotInit so we can use the robot for other things. Swap to "autonomous" mode to trigger the ImageProcess event.

In the near future this should either be moved to a self-instantiated default-command from the related subsystem, or it should be triggered with a joystick button or other event.


package net.glowstone.block.data;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

@SuppressWarnings("unchecked")
public class BlockDataStoreTest {
    @Test
    public void testGetBlockDataById() {
        SingletonBlockData<Waterlogged> signNoWl = BlockDataStore.getBlockDataById(0);
        SingletonBlockData<Waterlogged> signYesWl = BlockDataStore.getBlockDataById(1);

        assertThat(signNoWl.mutate().isWaterlogged(), is(false));
        assertThat(signYesWl.mutate().isWaterlogged(), is(true));
        assertThat(signNoWl.getGlobalPaletteId(), is(0));
        assertThat(signYesWl.getGlobalPaletteId(), is(1));
    }

    @Test
    public void testGetIdForBlockData() {
        SingletonBlockData<Waterlogged> signNoWl = BlockDataStore.getBlockDataById(0);
        SingletonBlockData<Waterlogged> signYesWl = BlockDataStore.getBlockDataById(1);

        Waterlogged mutatedNoWl = signNoWl.mutate();
        Waterlogged mutatedYesWl = signYesWl.mutate();

        assertThat(BlockDataStore.getBlockDataPaletteId(mutatedNoWl), is(0));
        assertThat(BlockDataStore.getBlockDataPaletteId(mutatedYesWl), is(1));
    }
}

package net.glowstone.block.data;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

@SuppressWarnings("unchecked")
public class BlockDataStoreTest {
    @Test
    public void testGetBlockDataById() {
        SingletonBlockData<Waterlogged> signNoWl = BlockDataStore.getBlockDataById(0);
        SingletonBlockData<Waterlogged> signYesWl = BlockDataStore.getBlockDataById(1);

        assertThat(signNoWl.mutate().isWaterlogged(), is(false));
        assertThat(signYesWl.mutate().isWaterlogged(), is(true));
        assertThat(signNoWl.getGlobalPaletteId(), is(0));
        assertThat(signYesWl.getGlobalPaletteId(), is(1));
    }

    @Test
    public void testGetIdForBlockData() {
        SingletonBlockData<Waterlogged> signNoWl = BlockDataStore.getBlockDataById(0);
        SingletonBlockData<Waterlogged> signYesWl = BlockDataStore.getBlockDataById(1);

        Waterlogged mutatedNoWl = signNoWl.mutate();
        Waterlogged mutatedYesWl = signYesWl.mutate();

        assertThat(BlockDataStore.getBlockDataPaletteId(mutatedNoWl), is(0));
        assertThat(BlockDataStore.getBlockDataPaletteId(mutatedYesWl), is(1));
    }

    @Test
    public void testMutatedBlockData() {
        SingletonBlockData<Waterlogged> singleton = BlockDataStore.getBlockDataById(0);
        Waterlogged mutable = singleton.mutate();
        assertThat(mutable.isWaterlogged(), is(false));

        mutable.setWaterlogged(true);
        int newId = BlockDataStore.getBlockDataPaletteId(mutable);
        assertThat(newId, is(1));
    }
}

Add test for mutated state changing IDs

Add test for mutated state changing IDs


/*
 *  Copyright (C) 2016 VSCT
 *
 *  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.vsct.dt.strowgr.admin.template.template;

import java.util.StringJoiner;

public class DefaultTemplates {
    public static final String SYSLOG_DEFAULT_TEMPLATE = new StringJoiner("\n")
            .add("source s_{{application}}_{{platform}} { udp(ip(127.0.0.1) port({{syslog_port}})); };")
            .add("destination d_{{application}}_{{platform}} { file(\"/HOME/hapadm/{{application}}/logs/{{application}}{{platform}}/haproxy.log\", perm(0664)); };")
            .add("log { source(s_{{application}}_{{platform}}); filter(f_local0); destination(d_{{application}}_{{platform}}); };")
            .add("\n")
            .toString();
}

/*
 *  Copyright (C) 2016 VSCT
 *
 *  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.vsct.dt.strowgr.admin.template.template;

import java.util.StringJoiner;

public class DefaultTemplates {
    public static final String SYSLOG_DEFAULT_TEMPLATE = new StringJoiner("\n")
            .add("source s_{{application}}_{{platform}} { udp(ip(127.0.0.1) port({{syslog_port}})); };")
            .add("destination d_{{application}}_{{platform}} { file(\"/HOME/hapadm/{{application}}/logs/{{application}}{{platform}}/haproxy{{application}}{{platform}}.log\", perm(0664)); };")
            .add("log { source(s_{{application}}_{{platform}}); filter(f_local0); destination(d_{{application}}_{{platform}}); };")
            .add("\n")
            .toString();
}

Add {{application}}{{platform}} to log filename


package com.thoughtworks.acceptance.someobjects;

import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter;

public class ZConverter extends AbstractSingleValueConverter {

    public boolean canConvert(Class type) {
        return type.equals(Z.class);
    }

    public Object fromString(String str) {
        return new Z("z");
    }

}

package com.thoughtworks.acceptance.someobjects;

import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;

public class ZConverter extends AbstractBasicConverter {

    public boolean canConvert(Class type) {
        return type.equals(Z.class);
    }

    protected Object fromString(String str) {
        return new Z("z");
    }

}

Revert to 1.1.1 converter ... it is part of compatibility test.


package openblocks.api;

import java.lang.annotation.*;

/**
 * Static variables marked with this annotation will be filled with instance
 * of requested API (defined by type of variable).
 *
 * All variables must have type that implements {@link IApiInterface}.
 * If requested type is not provided by OpenPeripheralAddons, variable will not be set.
 *
 * All variables should be filled in 'init'. Value in 'preInit' is undefined.
 *
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ApiHolder {}

package openblocks.api;

import java.lang.annotation.*;

/**
 * Static variables marked with this annotation will be filled with instance
 * of requested API (defined by type of variable).
 *
 * Static methods marked with this annotation will be called with instance of requested API.
 * Methods must have single argument, which will be used to select API.
 *
 * All used types must implements {@link IApiInterface}.
 * If requested type is not provided by OpenPeripheralAddons, variable will not be set.
 *
 * All variables should be filled in 'init'. Value in 'preInit' is undefined.
 *
 */
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface ApiHolder {}

Allow API annotation to be placed on methods, expand docs


package de.fau.amos.virtualledger.server.banking.adorsys.api;

import org.springframework.stereotype.Component;

/**
 * Class that holds all configuration required for the banking api access
 * examples: URL of the banking api, dummy configuration, ...
 */
@Component

public class BankingApiConfiguration {

    private final String bankingApiUrlAbsolute = "https://multibanking-service.dev.adorsys.de:443/api/v1/";
    private final String bankAccessApiUrlRelative = "users/{userId}/bankaccesses";
    private final String bankAccountApiUrlRelative = "users/{userId}/bankaccesses/{accessId}/accounts";
    private final String bankAccountSyncApiUrlRelative = "users/{userId}/bankaccesses/{accessId}/accounts/{accountId}/sync";

    /**
     * username of the test user that does not use adorsys api but dummies
     */
    private final String testUserName = "test@user.de";

    public String getBankingApiUrlAbsolute() {
        return bankingApiUrlAbsolute;
    }

    public String getBankAccessApiUrlRelative() {
        return bankAccessApiUrlRelative;
    }

    public String getBankAccountApiUrlRelative() {
        return bankAccountApiUrlRelative;
    }

    public String getBankAccountSyncApiUrlRelative() {
        return bankAccountSyncApiUrlRelative;
    }

    public String getTestUserName() {
        return testUserName;
    }
}

package de.fau.amos.virtualledger.server.banking.adorsys.api;

import org.springframework.stereotype.Component;

/**
 * Class that holds all configuration required for the banking api access
 * examples: URL of the banking api, dummy configuration, ...
 */
@Component

public class BankingApiConfiguration {

    private final String bankingApiUrlAbsolute = "https://multibanking-service.dev.adorsys.de:443/api/v1/";
    private final String bankAccessApiUrlRelative = "bankaccesses";
    private final String bankAccountApiUrlRelative = "bankaccesses/{accessId}/accounts";
    private final String bankAccountSyncApiUrlRelative = "bankaccesses/{accessId}/accounts/{accountId}/sync";

    /**
     * username of the test user that does not use adorsys api but dummies
     */
    private final String testUserName = "test@user.de";

    public String getBankingApiUrlAbsolute() {
        return bankingApiUrlAbsolute;
    }

    public String getBankAccessApiUrlRelative() {
        return bankAccessApiUrlRelative;
    }

    public String getBankAccountApiUrlRelative() {
        return bankAccountApiUrlRelative;
    }

    public String getBankAccountSyncApiUrlRelative() {
        return bankAccountSyncApiUrlRelative;
    }

    public String getTestUserName() {
        return testUserName;
    }
}

Remove old user from adorsys url paths

Remove old user from adorsys url paths


package devopsdistilled.operp.client.stock.panes.controllers;

import devopsdistilled.operp.client.abstracts.SubTaskPaneController;
import devopsdistilled.operp.client.exceptions.EntityValidationException;
import devopsdistilled.operp.server.data.entity.stock.Warehouse;

public interface TransferStockPaneController extends SubTaskPaneController {

	public void validate(Warehouse fromWarehouse, Warehouse toWarehouse,
			Long quantity) throws EntityValidationException;

	public void transfer(Warehouse fromWarehouse, Warehouse toWarehouse,
			Long quantity);

}

package devopsdistilled.operp.client.stock.panes.controllers;

import devopsdistilled.operp.client.abstracts.SubTaskPaneController;
import devopsdistilled.operp.client.exceptions.EntityValidationException;
import devopsdistilled.operp.client.stock.panes.models.TransferStockPaneModel;

public interface TransferStockPaneController extends SubTaskPaneController {

	public void validate() throws EntityValidationException;

	public void transfer();

	public TransferStockPaneModel getModel();

}

Declare validate(), transfer() and getModel()

OPEN - task 24: Create a stock module
http://github.com/DevOpsDistilled/OpERP/issues/issue/24


/*
 * Copyright 2013 Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>.
 *
 * 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 ca.corefacility.bioinformatics.irida.model.enums;

/**
 * When sorting a collection of generic objects you should be able to specify
 * the order of the sort.
 *
 * @author Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>
 */
public enum Order {

    ASCENDING("ASCENDING"),
    DESCENDING("DESCENDING");
    private String code;

    private Order(String code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return code;
    }

    public static Order fromString(String code) {
        switch (code.toUpperCase()) {
            case "ASCENDING":
                return ASCENDING;
            case "DESCENDING":
                return DESCENDING;
            default:
                throw new IllegalArgumentException("[" + code + "] is not a valid type of Order.");
        }
    }
}

/*
 * Copyright 2013 Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>.
 *
 * 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 ca.corefacility.bioinformatics.irida.model.enums;

/**
 * When sorting a collection of generic objects you should be able to specify
 * the order of the sort.
 *
 * @author Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>
 */
public enum Order {

    ASCENDING("ASCENDING"),
    DESCENDING("DESCENDING"),
    NONE("NONE");
    private String code;

    private Order(String code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return code;
    }

    public static Order fromString(String code) {
        switch (code.toUpperCase()) {
            case "ASCENDING":
                return ASCENDING;
            case "DESCENDING":
                return DESCENDING;
            default:
                return NONE;
        }
    }
}

Add a NONE order option to sort order.

Add a NONE order option to sort order.


/*
 * 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.jmeter.report.processor;

/**
 * The interface ResultData represents a result from samples processing.
 *
 * @since 3.0
 */
public interface ResultData {

    /**
     * Accepts the specified visitor.
     *
     * @param visitor
     *            the visitor (must not be {@code null})
     * @paran <T> type of the results of the {@link ResultDataVisitor}
     */
    <T> T accept(ResultDataVisitor<T> visitor);
}

/*
 * 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.jmeter.report.processor;

/**
 * The interface ResultData represents a result from samples processing.
 *
 * @since 3.0
 */
public interface ResultData {

    /**
     * Accepts the specified visitor.
     *
     * @param visitor
     *            the visitor (must not be {@code null})
     * @param <T>
     *            type of the results of the {@link ResultDataVisitor}
     * @return result of the vist
     */
    <T> T accept(ResultDataVisitor<T> visitor);
}

Javadoc: Correct typo and add missing return description

git-svn-id: 5ccfe34f605a6c2f9041ff2965ab60012c62539a@1776143 13f79535-47bb-0310-9956-ffa450edef68


package Reaction;

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

import static org.junit.Assert.*;

public class ReactionParserTest {

    @Before
    public void setUp() throws Exception {

    }

    @After
    public void tearDown() throws Exception {

    }

    @Test
    public void testReadReactant() throws Exception {

    }
}

package Reaction;

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

import java.io.File;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

public class ReactionParserTest {

    ReactionParser reactionParser;

    @Before
    public void setUp() throws Exception {
        String DESKTOP_PATH = System.getProperty("user.dir");
        String FILE_NAME = DESKTOP_PATH + "\\assets\\react.txt";

        File file = new File(FILE_NAME);
        reactionParser = new ReactionParser(file);
    }

    @After
    public void tearDown() throws Exception {

    }

    @Test
    public void testReadReactant() throws Exception {
        Reaction reaction;
        while ((reaction = reactionParser.readReaction()) != null) {
            if (reactionParser.isEndOfBlock()) {
                break;
            }
        }
        assertNotNull(reaction);
        assertEquals(reaction.getUniqueId(), "[RXN0-6375]");
    }
}

Add and Pass ReactionParser Test

Add and Pass ReactionParser Test


package org.aac.average.java.impl;

import org.aac.average.java.impl.function.Function;
import org.aac.average.java.impl.function.FunctionParameter;
import org.aac.average.java.impl.datatypes.ConcreteInteger;

public class Average {
    public static void main(String[] args) {
        Function<Integer> average;

        average = new Function<>().addParameter(new FunctionParameter<Integer>("a"))
                                  .addParameter(new FunctionParameter<Integer>("b"));

        ConcreteInteger firstNumber = new ConcreteInteger.Builder()
                                                         .addDigit(ConcreteInteger.Digit.TWO)
                                                         .build();
        ConcreteInteger secondNumber = new ConcreteInteger.Builder()
                                                          .addDigit(ConcreteInteger.Digit.ONE)
                                                          .addDigit(ConcreteInteger.Digit.EIGHT)
                                                          .build();
    }
}

package org.aac.average.java.impl;

import org.aac.average.java.impl.function.Function;
import org.aac.average.java.impl.function.FunctionParameter;
import org.aac.average.java.impl.datatypes.ConcreteInteger;

public class Average {
    public static void main(String[] args) {
        Function<ConcreteInteger> averageTwoIntegers;

        averageTwoIntegers = new Function<>().addParameter(new FunctionParameter<ConcreteInteger>("a"))
                                             .addParameter(new FunctionParameter<ConcreteInteger>("b"));

        ConcreteInteger firstNumber = new ConcreteInteger.Builder()
                                                         .addDigit(ConcreteInteger.Digit.TWO)
                                                         .build();
        ConcreteInteger secondNumber = new ConcreteInteger.Builder()
                                                          .addDigit(ConcreteInteger.Digit.ONE)
                                                          .addDigit(ConcreteInteger.Digit.EIGHT)
                                                          .build();
    }
}

Change function to take ConcreteIntegers


package yokohama.unit.ast_junit;

import lombok.Value;

@Value
public class ClassType implements NonArrayType {
    private String name;
    private Span span;

    @Override
    public <T> T accept(NonArrayTypeVisitor<T> visitor) {
        return visitor.visitClassType(this);
    }
}

package yokohama.unit.ast_junit;

import lombok.Value;

@Value
public class ClassType implements NonArrayType {
    private String name;
    private Span span;

    public ClassType(String name, Span span) {
        this.name = name;
        this.span = span;
    }

    public ClassType(String name) {
        this.name = name;
        this.span = Span.dummySpan();
    }

    @Override
    public <T> T accept(NonArrayTypeVisitor<T> visitor) {
        return visitor.visitClassType(this);
    }
}

Add utility constructor that sets dummy span


package fi.helsinki.cs.tmc.cli.io;

import static org.junit.Assert.assertTrue;

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

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

public class TerminalIoTest {

    Io io = new TerminalIo();
    OutputStream os;

    @Before
    public void setUp() {
        os = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(os);
        System.setOut(ps);
    }

    @Test
    public void printlnWorksRight() {
        io.println("foo");
        assertTrue(os.toString().equals("foo\n"));
    }
}

package fi.helsinki.cs.tmc.cli.io;

import static org.junit.Assert.assertTrue;

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

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

public class TerminalIoTest {

    Io io = new TerminalIo();
    OutputStream os;

    @Before
    public void setUp() {
        os = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(os);
        System.setOut(ps);
    }

    @Test
    public void printWord() {
        io.print("foo");
        assertTrue(os.toString().equals("foo"));
    }

    @Test
    public void printLineWithNewLine() {
        io.println("foo");
        assertTrue(os.toString().equals("foo\n"));
    }

    @Test
    public void printNull() {
        io.print(null);
        assertTrue(os.toString().equals("null"));
    }

    @Test
    public void printInteger() {
        io.print(5);
        assertTrue(os.toString().equals("5"));
    }
}

Add more terminal io tests.

Add more terminal io tests.


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

package org.chromium.sdk;

import java.io.IOException;

import org.chromium.sdk.util.MethodIsBlockingException;

/**
 * Abstraction of a remote JavaScript virtual machine which is embedded into
 * some application and accessed via TCP/IP connection to a port opened by
 * DebuggerAgent. Clients can use it to conduct debugging process.
 */
public interface StandaloneVm extends JavascriptVm {
  /**
   * Connects to the target VM.
   *
   * @param listener to report the debug events to
   * @throws IOException if there was a transport layer error
   * @throws UnsupportedVersionException if the SDK protocol version is not
   *         compatible with that supported by the browser
     * @throws MethodIsBlockingException because initialization implies couple of remote calls
     *     (to request version etc)
   */
  void attach(DebugEventListener listener)
      throws IOException, UnsupportedVersionException, MethodIsBlockingException;

  /**
   * @return name of embedding application as it wished to name itself; might be null
   */
  String getEmbedderName();

  /**
   * @return version of V8 implementation, format is unspecified; must not be null if
   *         {@link StandaloneVm} has been attached
   */
  // TODO: align this with {@link JavascriptVm#getVersion()} method.
  String getVmVersion();

  /**
   * @return message explaining why VM is detached; may be null
   */
  String getDisconnectReason();
}

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

package org.chromium.sdk;

import java.io.IOException;

import org.chromium.sdk.util.MethodIsBlockingException;

/**
 * Abstraction of a remote JavaScript virtual machine which is embedded into
 * some application and accessed via TCP/IP connection to a port opened by
 * DebuggerAgent. Clients can use it to conduct debugging process.
 */
public interface StandaloneVm extends JavascriptVm {
  /**
   * Connects to the target VM.
   *
   * @param listener to report the debug events to
   * @throws IOException if there was a transport layer error
   * @throws UnsupportedVersionException if the SDK protocol version is not
   *         compatible with that supported by the browser
     * @throws MethodIsBlockingException because initialization implies couple of remote calls
     *     (to request version etc)
   */
  void attach(DebugEventListener listener)
      throws IOException, UnsupportedVersionException, MethodIsBlockingException;

  /**
   * @return name of embedding application as it wished to name itself; might be null
   */
  String getEmbedderName();

  /**
   * This version should correspond to {@link JavascriptVm#getVersion()}. However it gets available
   * earlier, at the transport handshake stage.
   * @return version of V8 implementation, format is unspecified; must not be null if
   *         {@link StandaloneVm} has been attached
   */
  String getVmVersion();

  /**
   * @return message explaining why VM is detached; may be null
   */
  String getDisconnectReason();
}

Drop TODO for getVmVersion method

Drop TODO for getVmVersion method

Review URL: https://codereview.chromium.org/12324002

git-svn-id: 1dc80909446f7a7ee3e21dd4d1b8517df524e9ee@1139 fc8a088e-31da-11de-8fef-1f5ae417a2df


package co.phoenixlab.discord.api;

/**
 * Contains various useful API URLs and paths
 */
public class ApiConst {

    /**
     * Utility class
     */
    private ApiConst() {
    }

    /**
     * The base URL from which Discord runs
     */
    public static final String BASE_URL = "https://discordapp.com/";
    /**
     * Base API path
     */
    public static final String API_BASE_PATH = "api";
    /**
     * The endpoint for accessing user information
     */
    public static final String USERS_ENDPOINT = API_BASE_PATH + "/users/";
    /**
     * The endpoint for logging in
     */
    public static final String LOGIN_ENDPOINT = API_BASE_PATH + "/auth/login";
    /**
     * The endpoint for logging out
     */
    public static final String LOGOUT_ENDPOINT = API_BASE_PATH + "/auth/logout";
    /**
     * The endpoint for accessing server information
     */
    public static final String SERVERS_ENDPOINT = API_BASE_PATH + "/guilds/";
    /**
     * The endpoint for accessing channel information
     */
    public static final String CHANNELS_ENDPOINT = API_BASE_PATH + "/channels/";
    /**
     * The endpoint for accepting invites
     */
    public static final String INVITE_ENDPOINT = API_BASE_PATH + "/invite";
    /**
     * The format string for avatar URLs
     */
    public static final String AVATAR_URL_PATTERN = "https://cdn.discordapp.com/avatars/%1$s/%2$s.jpg";

}

package co.phoenixlab.discord.api;

/**
 * Contains various useful API URLs and paths
 */
public class ApiConst {

    /**
     * Utility class
     */
    private ApiConst() {
    }

    /**
     * The base URL from which Discord runs
     */
    public static final String BASE_URL = "https://discordapp.com/";
    /**
     * Base API path
     */
    public static final String API_BASE_PATH = BASE_URL + "api";
    /**
     * The endpoint for accessing user information
     */
    public static final String USERS_ENDPOINT = API_BASE_PATH + "/users/";
    /**
     * The endpoint for logging in
     */
    public static final String LOGIN_ENDPOINT = API_BASE_PATH + "/auth/login";
    /**
     * The endpoint for logging out
     */
    public static final String LOGOUT_ENDPOINT = API_BASE_PATH + "/auth/logout";
    /**
     * The endpoint for accessing server information
     */
    public static final String SERVERS_ENDPOINT = API_BASE_PATH + "/guilds/";
    /**
     * The endpoint for accessing channel information
     */
    public static final String CHANNELS_ENDPOINT = API_BASE_PATH + "/channels/";
    /**
     * The endpoint for accepting invites
     */
    public static final String INVITE_ENDPOINT = API_BASE_PATH + "/invite";
    /**
     * The format string for avatar URLs
     */
    public static final String AVATAR_URL_PATTERN = "https://cdn.discordapp.com/avatars/%1$s/%2$s.jpg";

}

Prepend the base URL to all endpoints

Prepend the base URL to all endpoints


/*
 * Copyright 2016 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.gradle.api.internal.project.taskfactory;

import org.gradle.api.Task;
import org.gradle.internal.Cast;

import java.util.Map;

/**
 * Class for easy access to task property validation from the validator task.
 */
public class TaskPropertyValidationAccess {
    @SuppressWarnings("unused")
    public static void collectTaskValidationProblems(Class<?> task, Map<String, Boolean> problems) {
        TaskClassInfoStore infoStore = new DefaultTaskClassInfoStore(new DefaultTaskClassValidatorExtractor(new ClasspathPropertyAnnotationHandler()));
        TaskClassInfo info = infoStore.getTaskClassInfo(Cast.<Class<? extends Task>>uncheckedCast(task));
        for (String nonAnnotatedPropertyName : info.getNonAnnotatedPropertyNames()) {
            problems.put(String.format("Task type '%s' declares property that is not annotated: '%s'.", task.getName(), nonAnnotatedPropertyName), Boolean.FALSE);
        }
    }
}

/*
 * Copyright 2016 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.gradle.api.internal.project.taskfactory;

import org.gradle.api.Task;
import org.gradle.internal.Cast;

import java.util.Map;

/**
 * Class for easy access to task property validation from the validator task.
 */
public class TaskPropertyValidationAccess {
    @SuppressWarnings("unused")
    public static void collectTaskValidationProblems(Class<?> task, Map<String, Boolean> problems) {
        TaskClassInfoStore infoStore = new DefaultTaskClassInfoStore(new DefaultTaskClassValidatorExtractor(new ClasspathPropertyAnnotationHandler(), new CompileClasspathPropertyAnnotationHandler()));
        TaskClassInfo info = infoStore.getTaskClassInfo(Cast.<Class<? extends Task>>uncheckedCast(task));
        for (String nonAnnotatedPropertyName : info.getNonAnnotatedPropertyNames()) {
            problems.put(String.format("Task type '%s' declares property that is not annotated: '%s'.", task.getName(), nonAnnotatedPropertyName), Boolean.FALSE);
        }
    }
}

Fix task validation to recognize `@CompileClasspath`


/*
 * 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.commons.codec;

/**
 * Decodes a String into a String.
 *
 * @author Apache Software Foundation
 * @version $Id$
 */
public interface StringDecoder extends Decoder {

    /**
     * Decodes a String and returns a String.
     *
     * @param pString a String to encode
     *
     * @return the encoded String
     *
     * @throws DecoderException thrown if there is
     *  an error conidition during the Encoding process.
     */
    String decode(String pString) throws DecoderException;
}

/*
 * 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.commons.codec;

/**
 * Decodes a String into a String.
 *
 * @author Apache Software Foundation
 * @version $Id$
 */
public interface StringDecoder extends Decoder {

    /**
     * Decodes a String and returns a String.
     *
     * @param source the String to decode
     *
     * @return the encoded String
     *
     * @throws DecoderException thrown if there is
     *  an error condition during the Encoding process.
     */
    String decode(String source) throws DecoderException;
}

Fix typos and use a better parameter name.

git-svn-id: cde5a1597f50f50feab6f72941f6b219c34291a1@1075403 13f79535-47bb-0310-9956-ffa450edef68


package org.realityforge.tarrabah;

import org.apache.deltaspike.cdise.api.CdiContainer;
import org.apache.deltaspike.cdise.api.CdiContainerLoader;
import org.apache.deltaspike.cdise.api.ContextControl;
import org.apache.deltaspike.core.api.provider.BeanProvider;
import org.realityforge.tarrabah.cdi.ext.pipeline.Pipeline;
import org.realityforge.tarrabah.cdi.ext.pipeline.PipelineScoped;

public class MainApp
{
  public static void main( final String[] args )
  {
    final CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
    cdiContainer.boot();

    // Starting the application-context allows to use @PipelineScoped beans
    final ContextControl contextControl = cdiContainer.getContextControl();
    contextControl.startContext( PipelineScoped.class );
    contextControl.startContexts();

    Pipeline.activate( new Pipeline( "foo" ) );

    final SyslogUDPServer udpServer = BeanProvider.getContextualReference( SyslogUDPServer.class );

    System.out.println( "Active" );

    /*
    for ( int i = 0; i < 2; i++ )
    {
      try
      {
        Thread.sleep( 1000 );
      }
      catch ( final InterruptedException ie )
      {
        //ignored
      }
    }
    */

    contextControl.stopContext( PipelineScoped.class );
    Pipeline.deactivate();

    //contextControl.stopContexts();
    cdiContainer.shutdown();
    System.out.println( "Inactive" );
  }
}

package org.realityforge.tarrabah;

import org.apache.deltaspike.cdise.api.CdiContainer;
import org.apache.deltaspike.cdise.api.CdiContainerLoader;
import org.apache.deltaspike.cdise.api.ContextControl;
import org.apache.deltaspike.core.api.provider.BeanProvider;
import org.realityforge.tarrabah.cdi.ext.pipeline.Pipeline;
import org.realityforge.tarrabah.cdi.ext.pipeline.PipelineScoped;

public class MainApp
{
  public static void main( final String[] args )
  {
    final CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
    cdiContainer.boot();

    // Starting the application-context allows to use @PipelineScoped beans
    final ContextControl contextControl = cdiContainer.getContextControl();
    contextControl.startContext( PipelineScoped.class );
    contextControl.startContexts();

    Pipeline.activate( new Pipeline( "foo" ) );

    final SyslogUDPServer udpServer = BeanProvider.getContextualReference( SyslogUDPServer.class );

    System.err.println( "Active" );

    /*
    for ( int i = 0; i < 2; i++ )
    {
      try
      {
        Thread.sleep( 1000 );
      }
      catch ( final InterruptedException ie )
      {
        //ignored
      }
    }
    */

    contextControl.stopContext( PipelineScoped.class );
    Pipeline.deactivate();

    //contextControl.stopContexts();
    cdiContainer.shutdown();
    System.err.println( "Inactive" );
  }
}

Convert stdout to stderr so it is flushed immediately


import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;

public class RobotTest {

    private static final String EXPECTED_ROBOT_NAME_PATTERN = "\\w{2}\\d{3}";
    private final Robot robot = new Robot();

    @Test
    public void hasName() {
        assertIsValidName(robot.getName());
    }

    @Test
    public void differentRobotsHaveDifferentNames() {
        assertThat(robot.getName(), not(equalTo(new Robot().getName())));
    }

    @Test
    public void resetName() {
        final String name = robot.getName();
        robot.reset();
        final String name2 = robot.getName();
        assertThat(name, not(equalTo(name2)));
        assertIsValidName(name2);
    }

    private static void assertIsValidName(String name) {
        assertThat(name.matches(EXPECTED_ROBOT_NAME_PATTERN), is(true));
    }
}

import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;

public class RobotTest {

    private static final String EXPECTED_ROBOT_NAME_PATTERN = "[A-Z]{2}\\d{3}";
    private final Robot robot = new Robot();

    @Test
    public void hasName() {
        assertIsValidName(robot.getName());
    }

    @Test
    public void differentRobotsHaveDifferentNames() {
        assertThat(robot.getName(), not(equalTo(new Robot().getName())));
    }

    @Test
    public void resetName() {
        final String name = robot.getName();
        robot.reset();
        final String name2 = robot.getName();
        assertThat(name, not(equalTo(name2)));
        assertIsValidName(name2);
    }

    private static void assertIsValidName(String name) {
        assertThat(name.matches(EXPECTED_ROBOT_NAME_PATTERN), is(true));
    }
}

Fix regex to only allow uppercased letters for the the first 2 characters.


package com.feedblocker.integrations;

import com.feedblocker.model.FeedApplication;

public class Facebook extends FeedApplication
{
    @Override
    public String[] getAppResumeLogIndicators()
    {
        // AppStateLogger to the rescue
        return new String[]{
                "Activity activity.FbMainTabActivity changed state to Started"
        };
    }

    @Override
    public String[] getAppPauseLogIndicators()
    {
        // AppStateLogger to the rescue
        return new String[]{
                "Activity activity.FbMainTabActivity changed state to Paused"
        };
    }
}

package com.feedblocker.integrations;

import com.feedblocker.model.FeedApplication;

public class Facebook extends FeedApplication
{
    @Override
    public String[] getAppResumeLogIndicators()
    {
        return new String[]{
                "LocalFbBroadcastManager: Called registerBroadcastReceiver twice"
        };
    }

    @Override
    public String[] getAppPauseLogIndicators()
    {
        return new String[]{
                "moveTaskToBack: TaskRecord",
                "START u0 {act=com.android.systemui.recents.SHOW_RECENTS",
                "START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME]"

        };
    }
}

Update logcat strings to identify FB app resume/pause

Closes #2.


package joliex.wsdl;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Francesco
 */
public enum NameSpacesEnum {

	//TNS("tns","http://www.italianasoftware.com/wsdl/FirstServiceByWSDL4J.wsdl"),
	//TNS_SCH("tnsxs","http://www.italianasoftware.com/wsdl/FirstServiceByWSDL4J.xsd"),
	XML_SCH("xs","http://www.w3.org/2001/XMLSchema"),
	SOAP("soap","http://schemas.xmlsoap.org/wsdl/soap/"),
	SOAPoverHTTP("soapOhttp","http://schemas.xmlsoap.org/soap/http/"),
	WSDL("wsdl","http://schemas.xmlsoap.org/wsdl/");

	private String prefix;
        private String nameSpaceURI;

	NameSpacesEnum(String prefix,String nameSpaceURI){
            this.prefix=prefix;
            this.nameSpaceURI=nameSpaceURI;
	}

	/**
	 * @return the nameSpace
	 */ public String getNameSpaceURI()
	{
		return nameSpaceURI;
	}

	/**
	 * @return the prefix
	 */ public String getNameSpacePrefix()
	{
		return prefix;
	}

}

package joliex.wsdl;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Francesco
 */
public enum NameSpacesEnum {

	//TNS("tns","http://www.italianasoftware.com/wsdl/FirstServiceByWSDL4J.wsdl"),
	//TNS_SCH("tnsxs","http://www.italianasoftware.com/wsdl/FirstServiceByWSDL4J.xsd"),
	XML_SCH("xs","http://www.w3.org/2001/XMLSchema"),
	SOAP("soap","http://schemas.xmlsoap.org/wsdl/soap/"),
	SOAPoverHTTP("soapOhttp","http://schemas.xmlsoap.org/soap/http"),
	WSDL("wsdl","http://schemas.xmlsoap.org/wsdl/");

	private String prefix;
        private String nameSpaceURI;

	NameSpacesEnum(String prefix,String nameSpaceURI){
            this.prefix=prefix;
            this.nameSpaceURI=nameSpaceURI;
	}

	/**
	 * @return the nameSpace
	 */ public String getNameSpaceURI()
	{
		return nameSpaceURI;
	}

	/**
	 * @return the prefix
	 */ public String getNameSpacePrefix()
	{
		return prefix;
	}

}

Fix namespace of HTTP binding for jolie2wsdl.


package org.bndtools.builder;

import org.osgi.framework.BundleContext;

public class BuilderPlugin extends org.eclipse.core.runtime.Plugin {

	private static BuilderPlugin instance = null;

	public static BuilderPlugin getInstance() {
		synchronized (BuilderPlugin.class) {
			return instance;
		}
	}

	public void start(BundleContext context) throws Exception {
		super.start(context);
		synchronized (BuilderPlugin.class) {
			instance = this;
		}
	}

	public void stop(BundleContext context) throws Exception {
		synchronized (BuilderPlugin.class) {
			instance = null;
		}
		super.stop(context);
	}

}

package org.bndtools.builder;

import org.osgi.framework.BundleContext;

public class BuilderPlugin extends org.eclipse.core.runtime.Plugin {

    private static BuilderPlugin instance = null;

    public static BuilderPlugin getInstance() {
        synchronized (BuilderPlugin.class) {
            return instance;
        }
    }

    @Override
    public void start(BundleContext context) throws Exception {
        super.start(context);
        synchronized (BuilderPlugin.class) {
            instance = this;
        }
    }

    @Override
    public void stop(BundleContext context) throws Exception {
        synchronized (BuilderPlugin.class) {
            instance = null;
        }
        super.stop(context);
    }

}

Add 2 missing @Override annotations

Add 2 missing @Override annotations

Signed-off-by: Ferry Huberts <66e11f9f5d965b69497c7e73d5e808f8b13c1218@pelagic.nl>


package seedu.address.logic.parser;

import static seedu.address.logic.parser.CliSyntax.KEYWORDS_ARGS_FORMAT_LIST;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;

import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.ListCommand;

/**
 * Parses input arguments and creates a new ListCommand object
 */
public class ListCommandParser {

    private ListCommandParser() {
    }
    /**
     * Parses the given {@code String} of arguments in the context of the FindCommand
     * and returns an FindCommand object for execution.
     */
    public static Command parse(String args) {
        if (args == null) {
            return new ListCommand();
        }

        // if not match, show all the unfinished task
        final Matcher matcher = KEYWORDS_ARGS_FORMAT_LIST.matcher(args.trim());
        if (!matcher.matches()) {
            return new ListCommand();
        }

        // keywords delimited by whitespace
        final String[] keywords = matcher.group("keywords").split("\\s+");
        final Set<String> keywordSet = new HashSet<>(Arrays.asList(keywords));
        return new ListCommand(keywordSet);
    }

}

package seedu.address.logic.parser;

import static seedu.address.logic.parser.CliSyntax.KEYWORDS_ARGS_FORMAT_LIST;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;

import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.ListCommand;

/**
 * Parses input arguments and creates a new ListCommand object
 */
public class ListCommandParser {

    private ListCommandParser() {
    }

    private static final String LIST_SEPARATOR = "\\s+";
    /**
     * Parses the given {@code String} of arguments in the context of the FindCommand
     * and returns an FindCommand object for execution.
     */
    public static Command parse(String args) {
        if (args == null) {
            return new ListCommand();
        }

        // if not match, show all the unfinished task
        final Matcher matcher = KEYWORDS_ARGS_FORMAT_LIST.matcher(args.trim());
        if (!matcher.matches()) {
            return new ListCommand();
        }

        // keywords delimited by whitespace
        final String[] keywords = matcher.group("keywords").split(LIST_SEPARATOR);
        final Set<String> keywordSet = new HashSet<>(Arrays.asList(keywords));
        return new ListCommand(keywordSet);
    }

}

Refactor - remove magic string

[V0.4][Logic] Refactor - remove magic string


/**
 * Copyright 2019 The CloudEvents 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 io.cloudevents.fun;

import java.util.Map;

import io.cloudevents.format.Format;

/**
 *
 * @author fabiojose
 *
 */
@FunctionalInterface
public interface FormatBuilder<P> {

	/**
	 * Builds a format to be used for the wire serialization
	 */
	Format<P> build(P payload, Map<String, Object> headers);

}

/**
 * Copyright 2019 The CloudEvents 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 io.cloudevents.fun;

import java.util.Map;

import io.cloudevents.format.Wire;

/**
 *
 * @author fabiojose
 *
 */
@FunctionalInterface
public interface WireBuilder<P, K, V> {

	/**
	 * Builds a wire format
	 */
	Wire<P, K, V> build(P payload, Map<K, V> headers);

}

Rename to wire instead of format

Rename to wire instead of format

Signed-off-by: Fabio José <34f3a7e4e4d9fe971c99ebc4af947a5309eca653@gmail.com>


package io.github.lukehutch.fastclasspathscanner.classloaderhandler;

import io.github.lukehutch.fastclasspathscanner.classloaderhandler.ClassLoaderHandler;
import io.github.lukehutch.fastclasspathscanner.scanner.ClasspathFinder;
import io.github.lukehutch.fastclasspathscanner.utils.LogNode;
import io.github.lukehutch.fastclasspathscanner.utils.ReflectionUtils;

public class WebsphereTraditionalClassLoaderHandler implements ClassLoaderHandler {

    public boolean handle(ClassLoader classloader, ClasspathFinder classpathFinder, LogNode log) throws Exception {
        for (Class<?> c = classloader.getClass(); c != null; c = c.getSuperclass()) {
            if (!"com.ibm.ws.classloader.CompoundClassLoader".equals(c.getName())) {
                continue;
            }
            String classpath = (String) ReflectionUtils.invokeMethod(classloader, "getClassPath");
            return classpathFinder.addClasspathElements(classpath, classloader, log);
        }
        return false;
    }

}

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

import io.github.lukehutch.fastclasspathscanner.scanner.ClasspathFinder;
import io.github.lukehutch.fastclasspathscanner.utils.LogNode;
import io.github.lukehutch.fastclasspathscanner.utils.ReflectionUtils;

public class WebsphereTraditionalClassLoaderHandler implements ClassLoaderHandler {

    @Override
    public boolean handle(final ClassLoader classloader, final ClasspathFinder classpathFinder, final LogNode log)
            throws Exception {
        for (Class<?> c = classloader.getClass(); c != null; c = c.getSuperclass()) {
            if (!"com.ibm.ws.classloader.CompoundClassLoader".equals(c.getName())) {
                continue;
            }
            final String classpath = (String) ReflectionUtils.invokeMethod(classloader, "getClassPath");
            return classpathFinder.addClasspathElements(classpath, classloader, log);
        }
        return false;
    }

}

Add copyright and license info

Add copyright and license info


package org.owasp.appsensor.analysis;

import javax.inject.Inject;
import javax.inject.Named;

import org.owasp.appsensor.AppSensorClient;
import org.owasp.appsensor.Response;
import org.owasp.appsensor.logging.Loggable;
import org.owasp.appsensor.response.ResponseHandler;
import org.owasp.appsensor.storage.ResponseStore;
import org.slf4j.Logger;

/**
 * This is a reference {@link Response} analysis engine,
 * and is an implementation of the Observer pattern.
 *
 * It is notified with implementations of the {@link Response} class.
 *
 * The implementation is trivial and simply delegates the work to the configured
 * {@link ResponseHandler} for processing.
 *
 * @author John Melton (jtmelton@gmail.com) http://www.jtmelton.com/
 */
@Named
@Loggable
public class ReferenceResponseAnalysisEngine extends ResponseAnalysisEngine {

	private Logger logger;

	@Inject
	private AppSensorClient appSensorClient;

	/**
	 * This method simply catches responses and calls the
	 * configured {@link ResponseHandler} to process them.
	 *
	 * @param response {@link Response} that has been added to the {@link ResponseStore}.
	 */
	@Override
	public void analyze(Response response) {
		if (response != null) {
			logger.info("Response executed for user <" + response.getUser().getUsername() + "> - executing response action " + response.getAction());

			appSensorClient.getResponseHandler().handle(response);
		}
	}

}

package org.owasp.appsensor.analysis;

import javax.inject.Named;

import org.owasp.appsensor.Response;
import org.owasp.appsensor.logging.Loggable;
import org.owasp.appsensor.storage.ResponseStore;
import org.slf4j.Logger;

/**
 * This is a reference {@link Response} analysis engine,
 * and is an implementation of the Observer pattern.
 *
 * It is notified with implementations of the {@link Response} class.
 *
 * The implementation is trivial and simply logs the {@link Response}
 *
 * @author John Melton (jtmelton@gmail.com) http://www.jtmelton.com/
 */
@Named
@Loggable
public class ReferenceResponseAnalysisEngine extends ResponseAnalysisEngine {

	private Logger logger;

	/**
	 * This method simply logs responses.
	 *
	 * @param response {@link Response} that has been added to the {@link ResponseStore}.
	 */
	@Override
	public void analyze(Response response) {
		if (response != null) {
			logger.info("NO-OP Response for user <" + response.getUser().getUsername() + "> - should be executing response action " + response.getAction());
		}
	}

}

Remove execution of response from analysis engine. This should be done client-side, not server side.


package com.sap.cloud.lm.sl.cf.process.actions;

import javax.inject.Inject;

import org.springframework.stereotype.Component;

import com.sap.cloud.lm.sl.cf.core.flowable.AdditionalProcessAction;
import com.sap.cloud.lm.sl.cf.core.flowable.FlowableFacade;
import com.sap.cloud.lm.sl.cf.core.flowable.RetryProcessAction;
import com.sap.cloud.lm.sl.cf.process.Constants;
import com.sap.cloud.lm.sl.cf.process.steps.StepPhase;

@Component
public class SetRetryPhaseAdditionalProcessAction implements AdditionalProcessAction {

    private FlowableFacade flowableFacade;

    @Inject
    public SetRetryPhaseAdditionalProcessAction(FlowableFacade flowableFacade) {
        this.flowableFacade = flowableFacade;
    }

    @Override
    public void executeAdditionalProcessAction(String processInstanceId) {
        flowableFacade.getActiveProcessExecutions(processInstanceId)
            .stream()
            .map(execution -> execution.getProcessInstanceId())
            .forEach(executionProcessId -> flowableFacade.getProcessEngine()
                .getRuntimeService()
                .setVariable(executionProcessId, Constants.VAR_STEP_PHASE, StepPhase.RETRY));
    }

    @Override
    public String getApplicableActionId() {
        return RetryProcessAction.ACTION_ID_RETRY;
    }

}

package com.sap.cloud.lm.sl.cf.process.actions;

import javax.inject.Inject;

import org.springframework.stereotype.Component;

import com.sap.cloud.lm.sl.cf.core.flowable.AdditionalProcessAction;
import com.sap.cloud.lm.sl.cf.core.flowable.FlowableFacade;
import com.sap.cloud.lm.sl.cf.core.flowable.RetryProcessAction;
import com.sap.cloud.lm.sl.cf.process.Constants;
import com.sap.cloud.lm.sl.cf.process.steps.StepPhase;

@Component
public class SetRetryPhaseAdditionalProcessAction implements AdditionalProcessAction {

    private FlowableFacade flowableFacade;

    @Inject
    public SetRetryPhaseAdditionalProcessAction(FlowableFacade flowableFacade) {
        this.flowableFacade = flowableFacade;
    }

    @Override
    public void executeAdditionalProcessAction(String processInstanceId) {
        flowableFacade.getActiveProcessExecutions(processInstanceId)
            .stream()
            .map(execution -> execution.getProcessInstanceId())
            .forEach(executionProcessId -> flowableFacade.getProcessEngine()
                .getRuntimeService()
                .setVariable(executionProcessId, Constants.VAR_STEP_PHASE, StepPhase.RETRY.toString()));
    }

    @Override
    public String getApplicableActionId() {
        return RetryProcessAction.ACTION_ID_RETRY;
    }

}

Fix setting of StepPhase in the Retry action

Change-Id: I92b5f1d6892dab5659eccdc15ab46aaa60986da7


package zero.zd.zquestionnaire;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

public class QnaBuilderActivity extends AppCompatActivity {

    public static Intent getStartIntent(Context context) {
        return new Intent(context, QnaBuilderActivity.class);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_qna_builder);

        if (getSupportActionBar() != null)
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_qna_builder, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {

            case R.id.action_save:
                // @TODO add action to write to a file
                break;

            case android.R.id.home:
                finish();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

    public void onClickAdd(View view) {
        // @TODO add action to add QnA
        Toast.makeText(QnaBuilderActivity.this, "ADD!!!", Toast.LENGTH_SHORT).show();
    }
}

package zero.zd.zquestionnaire;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

public class QnaBuilderActivity extends AppCompatActivity {

    public static Intent getStartIntent(Context context) {
        return new Intent(context, QnaBuilderActivity.class);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_qna_builder);

        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setTitle("QnA Builder");
            actionBar.setDisplayHomeAsUpEnabled(true);
        }

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_qna_builder, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {

            case R.id.action_save:
                // @TODO add action to write to a file
                break;

            case android.R.id.home:
                finish();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

    public void onClickAdd(View view) {
        // @TODO add action to add QnA
        Toast.makeText(QnaBuilderActivity.this, "ADD!!!", Toast.LENGTH_SHORT).show();
    }
}

Add ActionBar title on QnaBuilder

Add ActionBar title on QnaBuilder


package util;

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

/**
 * Created by neiro on 22.05.17.
 */
public class CommandChecker {

    private static Map<String, ParseType> supportedCommandsMap;

    static {
        supportedCommandsMap = new HashMap<>();

        supportedCommandsMap.put("grep", ParseType.GREP);
        supportedCommandsMap.put("regex", ParseType.REGEX);
    }

    public static boolean isCommandSupported(String command) {
        return supportedCommandsMap.containsKey(command);
    }

}

package util;

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

/**
 * Created by neiro on 22.05.17.
 */
public class CommandChecker {

    private static Map<String, ParseType> supportedCommandsMap;

    static {
        supportedCommandsMap = new HashMap<>();

        // Supported
        supportedCommandsMap.put("grep", ParseType.GREP);

        // May supported in future (see implementation in ParseHandler.handle)
//        supportedCommandsMap.put("regex", ParseType.REGEX);
    }

    public static boolean isCommandSupported(String command) {
        return supportedCommandsMap.containsKey(command);
    }

}

Mark "regex" command as unsupported

Mark "regex" command as unsupported