package cn.sagacloud.server.algorithm.test

import cn.sagacloud.server.algorithm.services.BaseDataService
import com.sybotan.database.SFilter
import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit4.SpringRunner

/**
 *
 *
 * @author jxing
 */
@RunWith(SpringRunner::class)
@SpringBootTest
class DatabaseFix {

    val dataService = BaseDataService


    @Test
    fun testExceptionTxt(){

        try{
            0/0
        }catch (e : Exception){
            println()
            println(e.stackTrace)
            println(org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace(e))
            println()
        }

    }


    @Test
    fun fixBindFloorIds(){
        val data = dataService.floorModelService.select(SFilter.not(SFilter.isNull("floorId"))).exec()

//        for(floor in data){
//            if(floor.floorIdList == null)
//                floor.floorIdList = ArrayList()
//            if(floor.floorIdList!!.isEmpty()){
//                floor.floorIdList!!.add(floor.floorId!!)
//            }
//            dataService.floorModelService.update(floor, arrayListOf("floorIdList"))
//        }
    }
}