// Path: common-utils/src/main/java/com/stnetix/ariaddna/commonutils/dto/vufs/AllocationStrategy.java
// public enum AllocationStrategy {
// 
//     /** Each file has one copy*/
//     UNION {
//         @Override
//         public String toString() {
//             return "UNION";
//         }
//     },
//     /** Each file has 2 or more copy*/
//     MIRROR {
//         @Override
//         public String toString() {
//             return "MIRROR";
//         }
//     },
//     /** Each file has 3 or more copy*/
//     HA {
//         @Override
//         public String toString() {
//             return "HA";
//         }
//     }
// }
// 
// Path: user-service/src/main/java/com/stnetix/ariaddna/userservice/IProfile.java
// public interface IProfile {
// 
//     Set<MetatableDTO> getMetatables();
// 
//     MetatableDTO getCurrentMasterTable();
// 
//     CloudAvailableSpace getCloudAvailableSpace();
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.stnetix.ariaddna.commonutils.dto.vufs.AllocationStrategy;
import com.stnetix.ariaddna.persistence.services.IMetatableService;
import com.stnetix.ariaddna.userservice.IProfile;
import com.stnetix.ariaddna.vufs.MetatablePersisteceServiceStub;
import com.stnetix.ariaddna.vufs.ProfileStub;
import com.stnetix.ariaddna.vufs.bo.Metafile;
import com.stnetix.ariaddna.vufs.exception.BlockNotExistInMetatableException;
import com.stnetix.ariaddna.vufs.exception.MetafileDoesNotExistException;
import com.stnetix.ariaddna.vufs.transformers.MetafileTransformer;
import com.stnetix.ariaddna.vufs.transformers.MetatableTransformer;
/*
 * Copyright (c) 2018 stnetix.com. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License.  You may obtain a copy of
 * the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed
 * under the License is distributed on an "AS IS" BASIS, without warranties or
 * conditions of any kind, EITHER EXPRESS OR IMPLIED.  See the License for the
 * specific language governing permissions and limitations under the License.
 */

package com.stnetix.ariaddna.vufs.service;





public class VufsServiceImplTest {

    private IVufsService vufsService;

    @Before
    public void initial() {
        MetafileTransformer metafileTransformer = new MetafileTransformer();
        MetatableTransformer transformer = new MetatableTransformer();
        transformer.setMetafileTransformer(metafileTransformer);
        IProfile profile = new ProfileStub();
        IMetatableService persistService = new MetatablePersisteceServiceStub();
        vufsService = new VufsServiceImpl(profile, transformer, persistService);
    }

    @Test
    public void createEmptyMetafile() {
        Metafile emptyMetafile = vufsService.createEmptyMetafile();
        assertNotNull(emptyMetafile);
        assertNotNull(emptyMetafile.getFileUuid());
        assertNotNull(emptyMetafile.getVersion());
    }

    @Test
    public void getMetafileByUuid() throws MetafileDoesNotExistException {
        Metafile newMetafile = vufsService.createEmptyMetafile();
// Path: common-utils/src/main/java/com/stnetix/ariaddna/commonutils/dto/vufs/AllocationStrategy.java
// public enum AllocationStrategy {
// 
//     /** Each file has one copy*/
//     UNION {
//         @Override
//         public String toString() {
//             return "UNION";
//         }
//     },
//     /** Each file has 2 or more copy*/
//     MIRROR {
//         @Override
//         public String toString() {
//             return "MIRROR";
//         }
//     },
//     /** Each file has 3 or more copy*/
//     HA {
//         @Override
//         public String toString() {
//             return "HA";
//         }
//     }
// }
// 
// Path: user-service/src/main/java/com/stnetix/ariaddna/userservice/IProfile.java
// public interface IProfile {
// 
//     Set<MetatableDTO> getMetatables();
// 
//     MetatableDTO getCurrentMasterTable();
// 
//     CloudAvailableSpace getCloudAvailableSpace();
// }


// Path: vufs/src/test/java/com/stnetix/ariaddna/vufs/service/VufsServiceImplTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.stnetix.ariaddna.commonutils.dto.vufs.AllocationStrategy;
import com.stnetix.ariaddna.persistence.services.IMetatableService;
import com.stnetix.ariaddna.userservice.IProfile;
import com.stnetix.ariaddna.vufs.MetatablePersisteceServiceStub;
import com.stnetix.ariaddna.vufs.ProfileStub;
import com.stnetix.ariaddna.vufs.bo.Metafile;
import com.stnetix.ariaddna.vufs.exception.BlockNotExistInMetatableException;
import com.stnetix.ariaddna.vufs.exception.MetafileDoesNotExistException;
import com.stnetix.ariaddna.vufs.transformers.MetafileTransformer;
import com.stnetix.ariaddna.vufs.transformers.MetatableTransformer;

/*
 * Copyright (c) 2018 stnetix.com. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License.  You may obtain a copy of
 * the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed
 * under the License is distributed on an "AS IS" BASIS, without warranties or
 * conditions of any kind, EITHER EXPRESS OR IMPLIED.  See the License for the
 * specific language governing permissions and limitations under the License.
 */

package com.stnetix.ariaddna.vufs.service;





public class VufsServiceImplTest {

    private IVufsService vufsService;

    @Before
    public void initial() {
        MetafileTransformer metafileTransformer = new MetafileTransformer();
        MetatableTransformer transformer = new MetatableTransformer();
        transformer.setMetafileTransformer(metafileTransformer);
        IProfile profile = new ProfileStub();
        IMetatableService persistService = new MetatablePersisteceServiceStub();
        vufsService = new VufsServiceImpl(profile, transformer, persistService);
    }

    @Test
    public void createEmptyMetafile() {
        Metafile emptyMetafile = vufsService.createEmptyMetafile();
        assertNotNull(emptyMetafile);
        assertNotNull(emptyMetafile.getFileUuid());
        assertNotNull(emptyMetafile.getVersion());
    }

    @Test
    public void getMetafileByUuid() throws MetafileDoesNotExistException {
        Metafile newMetafile = vufsService.createEmptyMetafile();
        newMetafile.setAllocationStrategy(AllocationStrategy.HA);