|
|
@ -22,6 +22,10 @@ import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.enums.UserType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.UserType; |
|
|
|
import org.apache.dolphinscheduler.common.utils.HadoopUtils; |
|
|
|
import org.apache.dolphinscheduler.common.utils.HadoopUtils; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.User; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.User; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Assert; |
|
|
|
import org.junit.Assert; |
|
|
|
import org.junit.Before; |
|
|
|
import org.junit.Before; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
@ -33,12 +37,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; |
|
|
|
import org.powermock.modules.junit4.PowerMockRunner; |
|
|
|
import org.powermock.modules.junit4.PowerMockRunner; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.mock.web.MockCookie; |
|
|
|
|
|
|
|
import org.springframework.mock.web.MockHttpServletRequest; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.Cookie; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RunWith(PowerMockRunner.class) |
|
|
|
@RunWith(PowerMockRunner.class) |
|
|
|
@PowerMockIgnore({"sun.security.*", "javax.net.*"}) |
|
|
|
@PowerMockIgnore({"sun.security.*", "javax.net.*"}) |
|
|
@ -92,20 +90,6 @@ public class BaseServiceTest { |
|
|
|
baseService.putMsg(result,Status.PROJECT_NOT_FOUNT,"test"); |
|
|
|
baseService.putMsg(result,Status.PROJECT_NOT_FOUNT,"test"); |
|
|
|
} |
|
|
|
} |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testGetCookie(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MockHttpServletRequest request = new MockHttpServletRequest(); |
|
|
|
|
|
|
|
MockCookie mockCookie = new MockCookie("userId","1"); |
|
|
|
|
|
|
|
request.setCookies(mockCookie); |
|
|
|
|
|
|
|
//cookie is not null
|
|
|
|
|
|
|
|
Cookie cookie = BaseService.getCookie(request,"userId"); |
|
|
|
|
|
|
|
Assert.assertNotNull(cookie); |
|
|
|
|
|
|
|
//cookie is null
|
|
|
|
|
|
|
|
cookie = BaseService.getCookie(request,"userName"); |
|
|
|
|
|
|
|
Assert.assertNull(cookie); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testCreateTenantDirIfNotExists(){ |
|
|
|
public void testCreateTenantDirIfNotExists(){ |
|
|
|
|
|
|
|
|
|
|
|
PowerMockito.mockStatic(HadoopUtils.class); |
|
|
|
PowerMockito.mockStatic(HadoopUtils.class); |
|
|
|