forked from fanruan/finekit
richie
5 years ago
8 changed files with 167 additions and 3 deletions
@ -0,0 +1,33 @@
|
||||
package com.fanruan.api; |
||||
|
||||
import java.io.IOException; |
||||
import java.util.Properties; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-09 |
||||
*/ |
||||
public class FineKit { |
||||
|
||||
private static String version; |
||||
|
||||
static { |
||||
Properties properties = new Properties(); |
||||
try { |
||||
properties.load(FineKit.class.getResourceAsStream("version.properties")); |
||||
version = properties.getProperty("version"); |
||||
} catch (IOException ignore) { |
||||
version = "1.0"; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取开发者工具套件的版本信息 |
||||
* @return 版本信息 |
||||
*/ |
||||
public static String version() { |
||||
return version; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fanruan.api.session; |
||||
|
||||
import com.fr.stable.web.SessionProvider; |
||||
import com.fr.web.core.SessionPoolManager; |
||||
import org.jetbrains.annotations.NotNull; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-09 |
||||
*/ |
||||
public class SessionFactory { |
||||
|
||||
/** |
||||
* 根据sessionID信息返回会话对象 |
||||
* @param sessionID 会话唯一标识符 |
||||
* @return 会话对象 |
||||
*/ |
||||
public static SessionProvider getSession(@NotNull String sessionID) { |
||||
return SessionPoolManager.getSessionIDInfor(sessionID, SessionProvider.class); |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fanruan.api.util; |
||||
|
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-09 |
||||
*/ |
||||
public class GeneralUtils { |
||||
|
||||
/** |
||||
* 返回系统的首选MAC地址 |
||||
* |
||||
* @return 表示系统MAC地址的字符串 |
||||
*/ |
||||
public static String getMacAddress() throws IOException { |
||||
return com.fr.general.GeneralUtils.getMacAddress(); |
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fanruan.api; |
||||
|
||||
import com.fr.config.dao.DaoContext; |
||||
import com.fr.config.dao.impl.LocalClassHelperDao; |
||||
import com.fr.config.dao.impl.LocalEntityDao; |
||||
import com.fr.config.dao.impl.LocalXmlEntityDao; |
||||
import com.fr.runtime.FineRuntime; |
||||
import org.junit.After; |
||||
import org.junit.Before; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-09 |
||||
*/ |
||||
public class Prepare { |
||||
|
||||
@Before |
||||
public void start() { |
||||
FineRuntime.start(); |
||||
DaoContext.setEntityDao(new LocalEntityDao()); |
||||
DaoContext.setClassHelperDao(new LocalClassHelperDao()); |
||||
DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); |
||||
} |
||||
|
||||
@After |
||||
public void stop() { |
||||
DaoContext.setEntityDao(null); |
||||
DaoContext.setClassHelperDao(null); |
||||
DaoContext.setXmlEntityDao(null); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fanruan.api.session; |
||||
|
||||
import com.fanruan.api.Prepare; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-09 |
||||
*/ |
||||
public class SessionFactoryTest extends Prepare { |
||||
|
||||
@Test |
||||
public void getSession() throws Exception { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fanruan.api.util; |
||||
|
||||
import com.fanruan.api.Prepare; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-09 |
||||
*/ |
||||
public class GeneralUtilsTest extends Prepare { |
||||
|
||||
@Test |
||||
public void getMacAddress() throws Exception{ |
||||
Assert.assertEquals(GeneralUtils.getMacAddress(), com.fr.general.GeneralUtils.getMacAddress()); |
||||
} |
||||
} |
Loading…
Reference in new issue