use of com.tvd12.ezyfoxserver.client.handler in project ezyfox-server-android-client by youngmonkeys.
the class EzyHashMap method toMap.
/*
* (non-Javadoc)
* @see com.tvd12.ezyfox.entity.EzyRoObject#toMap()
*/
@Override
public Map toMap() {
EzyObjectToMap objectToMap = EzyObjectToMap.getInstance();
Map map = objectToMap.toMap(this);
return map;
}
use of com.tvd12.ezyfoxserver.client.handler in project properties-file by tvd12.
the class BaseFileWriter method write.
/* (non-Javadoc)
* @see com.tvd12.properties.file.writer.FileWriter#write(java.util.Properties, java.io.File)
*/
@Override
public void write(Properties properties, File file) {
try (ByteArrayOutputStream out = write(properties)) {
if (!file.exists()) {
file.createNewFile();
}
byte[] bytes = encode(out);
writeBytes0(file, bytes);
} catch (IOException e) {
throw new PropertiesFileException("Can not write properties to file", e);
}
}
use of com.tvd12.ezyfoxserver.client.handler in project ezyhttp by youngmonkeys.
the class ApplicationContextBuilderTest method testNotEnable.
@Test
public void testNotEnable() {
// given
System.setProperty(EzyBeanContext.ACTIVE_PROFILES_KEY, "disable");
ApplicationContext applicationContext = new ApplicationContextBuilder().scan("i_dont_know").build();
System.setProperty(EzyBeanContext.ACTIVE_PROFILES_KEY, "enable");
EzyBeanContext beanContext = applicationContext.getBeanContext();
// when
Boolean managementEnable = beanContext.getProperty("management.enable", boolean.class);
Boolean resourceEnable = beanContext.getProperty("resources.enable", boolean.class);
Boolean resourceUploadEnable = beanContext.getProperty("resources.upload.enable", boolean.class);
ResourceResolver resourceResolver = beanContext.getSingleton(ResourceResolver.class);
ResourceDownloadManager resourceDownloadManager = beanContext.getSingleton(ResourceDownloadManager.class);
Set<String> packagesToScan = beanContext.getPackagesToScan();
// then
Asserts.assertFalse(managementEnable);
Asserts.assertFalse(resourceEnable);
Asserts.assertFalse(resourceUploadEnable);
Asserts.assertNull(resourceResolver);
Asserts.assertNull(resourceDownloadManager);
Asserts.assertEquals(Sets.newHashSet("i_dont_know", "com.tvd12.ezyhttp.server", "com.tvd12.ezyhttp.server.core.test", "com.tvd12.ezyhttp.server.core.test.config", "com.tvd12.ezyhttp.server.core.test.event", "com.tvd12.ezyhttp.server.core.test.api"), packagesToScan);
applicationContext.destroy();
}
use of com.tvd12.ezyfoxserver.client.handler in project ezyfox-server by youngmonkeys.
the class EzySimpleXmlReaderTest method test3.
@Test
public void test3() {
EzyXmlReader reader = EzySimpleXmlMapper.builder().contextPath("com.tvd12.ezyfoxserver").classLoader(getClass().getClassLoader()).build();
EzySimpleSettings settings = reader.read(new File("src/main/resources/ezy-settings.xml"), EzySimpleSettings.class);
System.out.println(new EzySimpleJsonWriter().writeAsString(settings));
}
use of com.tvd12.ezyfoxserver.client.handler in project ezyfox-server by youngmonkeys.
the class EzySimplePluginEntryTest method scanPackages.
@Test
public void scanPackages() {
// given
EzyPluginContext pluginContext = mock(EzyPluginContext.class);
ScheduledExecutorService executorService = mock(ScheduledExecutorService.class);
EzyZoneContext zoneContext = mock(EzyZoneContext.class);
EzyServerContext serverContext = mock(EzyServerContext.class);
EzyPluginSetup pluginSetup = mock(EzyPluginSetup.class);
EzyPlugin plugin = mock(EzyPlugin.class);
when(pluginContext.getPlugin()).thenReturn(plugin);
EzyPluginSetting pluginSetting = mock(EzyPluginSetting.class);
when(plugin.getSetting()).thenReturn(pluginSetting);
InternalPluginEntry sut = new InternalPluginEntry();
// when
when(pluginContext.get(ScheduledExecutorService.class)).thenReturn(executorService);
when(pluginContext.getParent()).thenReturn(zoneContext);
when(zoneContext.getParent()).thenReturn(serverContext);
when(pluginContext.get(EzyPluginSetup.class)).thenReturn(pluginSetup);
sut.config(pluginContext);
// then
EzyBeanContext beanContext = sut.beanContext;
MongoConfig mongoConfig = (MongoConfig) beanContext.getBean(MongoConfig.class);
Set<String> expectedPackages = Sets.newHashSet(EzySupportConstants.DEFAULT_PACKAGE_TO_SCAN, "com.tvd12.ezyfoxserver.support.v120.test.entry");
Asserts.assertEquals(expectedPackages, mongoConfig.packagesToScan);
Singleton singleton = (Singleton) beanContext.getBean(Singleton.class);
Asserts.assertNotNull(singleton);
}
Aggregations