// Path: src/main/java/me/itzg/mccy/types/MccyConstants.java
// public class MccyConstants {
// 
// 
//     public static final String MCCY_LABEL_PREFIX = MccySwarmApplication.class.getPackage().getName();
//     public static final String MCCY_LABEL = MCCY_LABEL_PREFIX;
//     public static final String MCCY_LABEL_MODPACK_URL = MCCY_LABEL_PREFIX+".modpack-url";
//     public static final String MCCY_LABEL_NAME = MCCY_LABEL_PREFIX+".name";
//     public static final String MCCY_LABEL_PUBLIC = MCCY_LABEL_PREFIX+".public";
//     public static final String MCCY_LABEL_OWNER = MCCY_LABEL_PREFIX+".owner";
// 
//     public static final int SERVER_CONTAINER_PORT_INT = 25565;
//     public static final String SERVER_CONTAINER_PORT = String.valueOf(SERVER_CONTAINER_PORT_INT)+ "/tcp";
//     public static final String IP_ADDR_ALL_IF = "0.0.0.0";
// 
//     public static final String X_XSRF_TOKEN = "X-XSRF-TOKEN";
// 
//     public static final String FILE_MOD_INFO = "mod.info";
//     public static final String FILE_MCMOD_INFO = "mcmod.info";
//     public static final String FILE_PLUGIN_META = "plugin.yml";
// 
//     public static final String TEMP_PREFIX = "temp-";
// 
//     public static final String CATEGORY_WORLDS = "worlds";
//     public static final String CATEGORY_MODS = "mods";
// 
//     public static final ComparableVersion[] FORGE_VERSIONS_SQUASHED = new ComparableVersion[]{
//             ComparableVersion.of("1.8"),
//             ComparableVersion.of("1.8.8")
//     };
//     public static final int FORGE_VERSIONS_SQUASHED_SIZE = 2;
// 
//     public static final String EXT_WORLDS = ".zip";
//     public static final String EXT_MODS = ".jar";
//     public static final String EXT_MOD_PACK = ".zip";
// 
//     public static final String ENV_ICON = "ICON";
//     public static final String ENV_VERSION = "VERSION";
//     public static final String ENV_FORGEVERSION = "FORGEVERSION";
//     public static final String ENV_WORLD = "WORLD";
//     public static final String ENV_MODPACK = "MODPACK";
//     public static final String ENV_TYPE = "TYPE";
//     public static final String ENV_DIFFICULTY = "DIFFICULTY";
//     public static final String ENV_WHITELIST = "WHITELIST";
//     public static final String ENV_OPS = "OPS";
//     public static final String ENV_SEED = "SEED";
//     public static final String ENV_MODE = "MODE";
//     public static final String ENV_MOTD = "MOTD";
//     public static final String ENV_PVP = "PVP";
//     public static final String ENV_LEVEL_TYPE = "LEVEL_TYPE";
//     public static final String ENV_GENERATOR_SETTINGS = "GENERATOR_SETTINGS";
//     public static final String ENV_LEVEL = "LEVEL";
// 
//     public static final String LINK_MCCY = "mccy";
//     public static final String SNAPSHOT_VER_PATTERN = "(?<nYear>\\d+)w(?<nWeek>\\d+)(?<sRel>[a-z]+)";
// 
//     public static final String PROFILE_BASIC_AUTH = "basicAuth";
//     public static final String PROFILE_DEV = "dev";
//     public static final String MF_ATTR_FML_CORE_PLUGIN = "FMLCorePlugin";
// }


import me.itzg.mccy.types.MccyConstants;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.springframework.core.io.ClassPathResource;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.junit.Assert.*;
package me.itzg.mccy.services;




/**
 * @author Geoff Bourne
 * @since 1/6/2016
 */
public class FileStorageServiceTest {

    @Rule
    public TemporaryFolder temp = new TemporaryFolder();

    @Test
    public void testSaveNeedsName() throws Exception {

        final FileStorageService service = new FileStorageService();
        final Path repoPath = temp.newFolder().toPath();
        org.springframework.test.util.ReflectionTestUtils.setField(service, "repoPath", repoPath);

        MultipartFile src;
        try (InputStream in = new ClassPathResource("SkyGrid.zip").getInputStream()) {
            src = new MockMultipartFile("SkyGrid.zip", in);
        }

// Path: src/main/java/me/itzg/mccy/types/MccyConstants.java
// public class MccyConstants {
// 
// 
//     public static final String MCCY_LABEL_PREFIX = MccySwarmApplication.class.getPackage().getName();
//     public static final String MCCY_LABEL = MCCY_LABEL_PREFIX;
//     public static final String MCCY_LABEL_MODPACK_URL = MCCY_LABEL_PREFIX+".modpack-url";
//     public static final String MCCY_LABEL_NAME = MCCY_LABEL_PREFIX+".name";
//     public static final String MCCY_LABEL_PUBLIC = MCCY_LABEL_PREFIX+".public";
//     public static final String MCCY_LABEL_OWNER = MCCY_LABEL_PREFIX+".owner";
// 
//     public static final int SERVER_CONTAINER_PORT_INT = 25565;
//     public static final String SERVER_CONTAINER_PORT = String.valueOf(SERVER_CONTAINER_PORT_INT)+ "/tcp";
//     public static final String IP_ADDR_ALL_IF = "0.0.0.0";
// 
//     public static final String X_XSRF_TOKEN = "X-XSRF-TOKEN";
// 
//     public static final String FILE_MOD_INFO = "mod.info";
//     public static final String FILE_MCMOD_INFO = "mcmod.info";
//     public static final String FILE_PLUGIN_META = "plugin.yml";
// 
//     public static final String TEMP_PREFIX = "temp-";
// 
//     public static final String CATEGORY_WORLDS = "worlds";
//     public static final String CATEGORY_MODS = "mods";
// 
//     public static final ComparableVersion[] FORGE_VERSIONS_SQUASHED = new ComparableVersion[]{
//             ComparableVersion.of("1.8"),
//             ComparableVersion.of("1.8.8")
//     };
//     public static final int FORGE_VERSIONS_SQUASHED_SIZE = 2;
// 
//     public static final String EXT_WORLDS = ".zip";
//     public static final String EXT_MODS = ".jar";
//     public static final String EXT_MOD_PACK = ".zip";
// 
//     public static final String ENV_ICON = "ICON";
//     public static final String ENV_VERSION = "VERSION";
//     public static final String ENV_FORGEVERSION = "FORGEVERSION";
//     public static final String ENV_WORLD = "WORLD";
//     public static final String ENV_MODPACK = "MODPACK";
//     public static final String ENV_TYPE = "TYPE";
//     public static final String ENV_DIFFICULTY = "DIFFICULTY";
//     public static final String ENV_WHITELIST = "WHITELIST";
//     public static final String ENV_OPS = "OPS";
//     public static final String ENV_SEED = "SEED";
//     public static final String ENV_MODE = "MODE";
//     public static final String ENV_MOTD = "MOTD";
//     public static final String ENV_PVP = "PVP";
//     public static final String ENV_LEVEL_TYPE = "LEVEL_TYPE";
//     public static final String ENV_GENERATOR_SETTINGS = "GENERATOR_SETTINGS";
//     public static final String ENV_LEVEL = "LEVEL";
// 
//     public static final String LINK_MCCY = "mccy";
//     public static final String SNAPSHOT_VER_PATTERN = "(?<nYear>\\d+)w(?<nWeek>\\d+)(?<sRel>[a-z]+)";
// 
//     public static final String PROFILE_BASIC_AUTH = "basicAuth";
//     public static final String PROFILE_DEV = "dev";
//     public static final String MF_ATTR_FML_CORE_PLUGIN = "FMLCorePlugin";
// }


// Path: src/test/java/me/itzg/mccy/services/FileStorageServiceTest.java
import me.itzg.mccy.types.MccyConstants;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.springframework.core.io.ClassPathResource;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.junit.Assert.*;

package me.itzg.mccy.services;




/**
 * @author Geoff Bourne
 * @since 1/6/2016
 */
public class FileStorageServiceTest {

    @Rule
    public TemporaryFolder temp = new TemporaryFolder();

    @Test
    public void testSaveNeedsName() throws Exception {

        final FileStorageService service = new FileStorageService();
        final Path repoPath = temp.newFolder().toPath();
        org.springframework.test.util.ReflectionTestUtils.setField(service, "repoPath", repoPath);

        MultipartFile src;
        try (InputStream in = new ClassPathResource("SkyGrid.zip").getInputStream()) {
            src = new MockMultipartFile("SkyGrid.zip", in);
        }

        final String filename = service.saveNeedsName(MccyConstants.CATEGORY_WORLDS, ".zip", true, src);