import com.izouma.awesomeadmin.service.OSSFileService;
import com.izouma.awesomeadmin.service.UserInfoService;
import com.izouma.awesomeadmin.util.MbappUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.GenericXmlContextLoader;
import org.springframework.transaction.annotation.Transactional;

import java.util.UUID;

@RunWith(value = SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:/spring/applicationContext.xml"}, loader = GenericXmlContextLoader.class)
@Transactional
public class OrderServiceTest {

    @Autowired
    private OSSFileService oSSFileService;

    @Test
    public void testGenOrderID() {
        String machineId = "1";
        String OrderId = machineId + (System.currentTimeMillis() + "").substring(1) + (System.nanoTime() + "").substring(7, 10);

        System.out.println(OrderId);

        OrderId = MbappUtil.getOrderIdByUUId();
        System.out.println(OrderId);
    }

    @Test
    public void testDeleteImage() {
        oSSFileService.deleteObject("tutuxiang/null/null/null/2.jpg");
    }

}
