Java Code Examples for org.joor.Reflect

The following examples show how to use org.joor.Reflect. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: rocketmq-exporter   Source File: MQAdminExtImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public MessageExt viewMessage(String topic,
                              String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    logger.info("MessageClientIDSetter.getNearlyTimeFromID(msgId)={} msgId={}", MessageClientIDSetter.getNearlyTimeFromID(msgId), msgId);
    try {
        return viewMessage(msgId);
    } catch (Exception e) {
    }
    MQAdminImpl mqAdminImpl = mqClientInstance.getMQAdminImpl();
    QueryResult qr = Reflect.on(mqAdminImpl).call("queryMessage", topic, msgId, 32,
            MessageClientIDSetter.getNearlyTimeFromID(msgId).getTime() - 1000 * 60 * 60 * 13L, Long.MAX_VALUE, true).get();
    if (qr != null && qr.getMessageList() != null && qr.getMessageList().size() > 0) {
        return qr.getMessageList().get(0);
    } else {
        return null;
    }
}
 
Example 2
Source Project: camel-k-runtime   Source File: JavaSourceLoader.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Result load(Runtime runtime, Source source) throws Exception {
    try (InputStream is = source.resolveAsInputStream(runtime.getCamelContext())) {
        final String content = IOHelper.loadText(is);
        final String name = determineQualifiedName(source, content);
        final Reflect compiled = Reflect.compile(name, content);
        final Object instance = compiled.create().get();

        // The given source may contains additional nested classes which are unknown to Camel
        // as they are associated to the ClassLoader used to compile the source thus we need
        // to add it to the ApplicationContextClassLoader.
        final ClassLoader loader = runtime.getCamelContext().getApplicationContextClassLoader();
        if (loader instanceof CompositeClassloader) {
            ((CompositeClassloader) loader).addClassLoader(instance.getClass().getClassLoader());
        }

        return Result.on(instance);
    }
}
 
Example 3
@Test
public void testDelay() throws InterruptedException {
    RScheduledExecutorService executor = redisson.getExecutorService("test", ExecutorOptions.defaults().taskRetryInterval(5, TimeUnit.SECONDS));
    long start = System.currentTimeMillis();
    RScheduledFuture<?> f = executor.schedule(new ScheduledCallableTask(), 11, TimeUnit.SECONDS);
    assertThat(f.awaitUninterruptibly(12000)).isTrue();
    assertThat(f.isSuccess()).isTrue();
    assertThat(System.currentTimeMillis() - start).isBetween(11000L, 11500L);
    
    Reflect.onClass(RedissonExecutorService.class).set("RESULT_OPTIONS", RemoteInvocationOptions.defaults().noAck().expectResultWithin(3, TimeUnit.SECONDS));

    executor = redisson.getExecutorService("test", ExecutorOptions.defaults().taskRetryInterval(5, TimeUnit.SECONDS));
    start = System.currentTimeMillis();
    RScheduledFuture<?> f1 = executor.schedule(new ScheduledCallableTask(), 5, TimeUnit.SECONDS);
    assertThat(f1.awaitUninterruptibly(6000)).isTrue();
    assertThat(f1.isSuccess()).isTrue();
    assertThat(System.currentTimeMillis() - start).isBetween(5000L, 5500L);

    start = System.currentTimeMillis();
    RScheduledFuture<?> f2 = executor.schedule(new RunnableTask(), 5, TimeUnit.SECONDS);
    assertThat(f2.awaitUninterruptibly(6000)).isTrue();
    assertThat(f2.isSuccess()).isTrue();
    assertThat(System.currentTimeMillis() - start).isBetween(5000L, 5500L);
}
 
Example 4
@Test
public void fromJson() throws URISyntaxException, JsonIOException, JsonSyntaxException, IOException {
    try (final Reader reader = new InputStreamReader(new FileInputStream(PATH_IN + fileName))) {
        Type t = new TypeToken<Set<NinePatch>>() {}.getType();
        Set<NinePatch> ninePatchSet = new GsonBuilder().create().fromJson(reader, t);
        NinePatchMap ninePatchMap = NinePatch.init(ninePatchSet);

        QualifiedResource mockedResource = Mockito.mock(QualifiedResource.class);
        Mockito.when(mockedResource.getName()).thenReturn(resourceName);
        Mockito.when(mockedResource.getTypedQualifiers()).thenReturn(typedQualifiers);

        NinePatch ninePatch = ninePatchMap.getBestMatch(mockedResource);
        assertTrue(resultExpected ^ (ninePatch == null));
        if (resultExpected && ninePatch != null) {
        	assertEquals(nameExpected, Reflect.on(ninePatch).get("name"));
        }
    }
}
 
Example 5
@Test
 public void test() throws IOException, TranscoderException, InstantiationException, IllegalAccessException {
 	// verify bounds
     QualifiedResource svg = qualifiedSVGResourceFactory.fromSVGFile(new File(PATH_IN + filename));
     Rectangle svgBounds = svg.getBounds();
     assertNotNull(svgBounds);
     assertEquals(ceil(expectedWidth), svgBounds.getWidth(), 0);
     assertEquals(ceil(expectedHeight), svgBounds.getHeight(), 0);
     Rectangle svgConstrainedBounds = svg.getScaledBounds(svg.getDensity().getValue());
     assertNotNull(svgConstrainedBounds);
     assertEquals(ceil(constrainedWidth), svgConstrainedBounds.getWidth(), 0);
     assertEquals(ceil(constrainedHeight), svgConstrainedBounds.getHeight(), 0);

     // verify generated png (width, height) for each target density
     final String name = svg.getName();
     for (Density.Value d : Density.Value.values()) {
     	Reflect.on(svg).set("name", name + "_" + d.name());
plugin.transcode(svg, d, new File(PATH_OUT), null);
      BufferedImage image = ImageIO.read(new FileInputStream(new File(PATH_OUT, svg.getName() + "." + OUTPUT_FORMAT.name().toLowerCase())));
Rectangle expectedBounds = svg.getScaledBounds(d);
assertEquals(expectedBounds.getWidth(), image.getWidth(), 0);
      assertEquals(expectedBounds.getHeight(), image.getHeight(), 0);
     }
 }
 
Example 6
Source Project: Journey   Source File: CefLifeSpanHandlerProxy.java    License: Apache License 2.0 5 votes vote down vote up
static CefLifeSpanHandlerProxy createHandler(CefLifeSpanHandlerProxy handler) {
    Object instance = Proxy.newProxyInstance(JourneyLoader.getJourneyClassLoader(),
            new Class<?>[]{JourneyLoader.getJourneyClassLoader().loadClass("org.cef.handler.CefLifeSpanHandler")},
            new Reflect.ProxyInvocationHandler() {
                @Override
                public Object invoke(Object proxy, Method method, Object[] args) {
                    ((Reflect.ProxyArgumentsConverter) Reflect.on(handler).field("PROXY_ARGUMENTS_CONVERTER").get())
                            .convertArguments(method.getName(), args);
                    return ((Reflect.ProxyValueConverter) Reflect.on(handler).field("PROXY_VALUE_CONVERTER").get())
                            .convertValue(method.getName(), Reflect.on(handler).call(method.getName(), args).get());
                }
            });
    return Reflect.on(instance).as(CefLifeSpanHandlerProxy.class);
}
 
Example 7
Source Project: Journey   Source File: CefJSDialogHandlerProxy.java    License: Apache License 2.0 5 votes vote down vote up
static CefJSDialogHandlerProxy createHandler(CefJSDialogHandlerProxy handler) {
    Object instance = Proxy.newProxyInstance(JourneyLoader.getJourneyClassLoader(),
            new Class<?>[]{JourneyLoader.getJourneyClassLoader().loadClass("org.cef.handler.CefJSDialogHandler")},
            new Reflect.ProxyInvocationHandler() {
                @Override
                public Object invoke(Object proxy, Method method, Object[] args) {
                    ((Reflect.ProxyArgumentsConverter) Reflect.on(handler).field("PROXY_ARGUMENTS_CONVERTER").get())
                            .convertArguments(method.getName(), args);
                    return ((Reflect.ProxyValueConverter) Reflect.on(handler).field("PROXY_VALUE_CONVERTER").get())
                            .convertValue(method.getName(), Reflect.on(handler).call(method.getName(), args).get());
                }
            });
    return Reflect.on(instance).as(CefJSDialogHandlerProxy.class);
}
 
Example 8
Source Project: Journey   Source File: CefMessageRouterHandlerProxy.java    License: Apache License 2.0 5 votes vote down vote up
static CefMessageRouterHandlerProxy createHandler(CefMessageRouterHandlerProxy handler) {
    Object instance = Proxy.newProxyInstance(JourneyLoader.getJourneyClassLoader(),
            new Class<?>[]{JourneyLoader.getJourneyClassLoader()
                    .loadClass("org.cef.handler.CefMessageRouterHandler")},
            new Reflect.ProxyInvocationHandler() {
                @Override
                public Object invoke(Object proxy, Method method, Object[] args) {
                    ((Reflect.ProxyArgumentsConverter) Reflect.on(handler).field("PROXY_ARGUMENTS_CONVERTER").get())
                            .convertArguments(method.getName(), args);
                    return ((Reflect.ProxyValueConverter) Reflect.on(handler).field("PROXY_VALUE_CONVERTER").get())
                            .convertValue(method.getName(), Reflect.on(handler).call(method.getName(), args).get());
                }
            });
    return Reflect.on(instance).as(CefMessageRouterHandlerProxy.class);
}
 
Example 9
Source Project: Journey   Source File: JourneySettings.java    License: Apache License 2.0 5 votes vote down vote up
public LogSeverity getLogSeverity() {
    Object realLogSeverity = Reflect.on(cefSettings).get("log_severity");
    if (realLogSeverity == null) {
        return null;
    } else {
        return LogSeverity.valueOf(realLogSeverity.toString());
    }
}
 
Example 10
Source Project: Phantom   Source File: CompileDependenciesFileGenerator.java    License: Apache License 2.0 5 votes vote down vote up
private Set<String> getCompileArtifactsForAgp30x() {
    final Set<ArtifactDependencyGraph.HashableResolvedArtifactResult> allArtifacts = Reflect.on("com.android.build.gradle.internal.ide.ArtifactDependencyGraph")
            .call("getAllArtifacts",
                    applicationVariant.getVariantData().getScope(),
                    AndroidArtifacts.ConsumedConfigType.COMPILE_CLASSPATH,
                    null)
            .get();
    return getMavenArtifacts(allArtifacts);
}
 
Example 11
Source Project: ADB-Duang   Source File: DeviceChooserDialog.java    License: MIT License 5 votes vote down vote up
@Override
public JComponent getPreferredFocusedComponent() {
    try {
        return myDeviceChooser.getPreferredFocusComponent();
    } catch (NoSuchMethodError e) {
        // that means that we are probably on a preview version of android studio or in intellij 13
        return Reflect.on(myDeviceChooser).call("getDeviceTable").get();
    }
}
 
Example 12
Source Project: ADBWIFI   Source File: GetRequiredHardwareFeaturesCompat.java    License: Apache License 2.0 5 votes vote down vote up
@Override
// Android studio 1.4 and below
protected EnumSet<IDevice.HardwareFeature> getPreviousImplementation() {
    ManifestInfo manifestInfo = ManifestInfo.get(facet.getModule(), true);
    List<UsesFeature> requiredFeatures = Reflect.on(manifestInfo).call("getRequiredFeatures").get();

    for (UsesFeature feature : requiredFeatures) {
        AndroidAttributeValue<String> name = feature.getName();
        if (name != null && UsesFeature.HARDWARE_TYPE_WATCH.equals(name.getStringValue())) {
            return EnumSet.of(IDevice.HardwareFeature.WATCH);
        }
    }

    return EnumSet.noneOf(IDevice.HardwareFeature.class);
}
 
Example 13
Source Project: ADBWIFI   Source File: DeviceChooserDialog.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public JComponent getPreferredFocusedComponent() {
    try {
        return myDeviceChooser.getPreferredFocusComponent();
    } catch (NoSuchMethodError e) {
        // that means that we are probably on a preview version of android studio or in intellij 13
        return Reflect.on(myDeviceChooser).call("getDeviceTable").get();
    }
}
 
Example 14
Source Project: armeria   Source File: DocumentationProcessorTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void withJavaDoc() throws IOException {
    Reflect.compile(
            "com.linecorp.armeria.WithJavaDoc",
            loadFile("WithJavaDoc.java.txt"),
            new CompileOptions().processors(target)
    );
    testFile("com.linecorp.armeria.WithJavaDoc");
}
 
Example 15
Source Project: armeria   Source File: DocumentationProcessorTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void noJavaDoc() throws IOException {
    Reflect.compile(
            "com.linecorp.armeria.NoJavaDoc",
            loadFile("NoJavaDoc.java.txt"),
            new CompileOptions().processors(target)
    );
    final String fileName = getFileName("com.linecorp.armeria.NoJavaDoc");
    assertThat(Files.notExists(Paths.get(fileName))).isTrue();
}
 
Example 16
Source Project: redisson   Source File: RedissonMapCacheTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testDestroy() {
    RMapCache<String, String> cache = redisson.getMapCache("test");
    
    EvictionScheduler evictionScheduler = ((Redisson)redisson).getEvictionScheduler();
    Map<?, ?> map = Reflect.on(evictionScheduler).get("tasks");
    assertThat(map.isEmpty()).isFalse();
    cache.destroy();
    assertThat(map.isEmpty()).isTrue();
}
 
Example 17
Source Project: redisson   Source File: RedissonSetCacheTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testDestroy() {
    RSetCache<String> cache = redisson.getSetCache("test");
    
    EvictionScheduler evictionScheduler = ((Redisson)redisson).getEvictionScheduler();
    Map<?, ?> map = Reflect.on(evictionScheduler).get("tasks");
    assertThat(map.isEmpty()).isFalse();
    cache.destroy();
    assertThat(map.isEmpty()).isTrue();
}
 
Example 18
Source Project: EhViewer   Source File: CookieRepositoryTest.java    License: Apache License 2.0 5 votes vote down vote up
private void equals(CookieSet cookieSet, List<Cookie> cookies) {
  assertNotNull(cookieSet);
  assertNotNull(cookies);

  Map<CookieSet.Key, Cookie> map = Reflect.on(cookieSet).field("map").get();
  assertEquals(cookies.size(), map.size());
  for (Cookie cookie: cookies) {
    assertEquals(cookie, map.get(new CookieSet.Key(cookie)));
  }
}
 
Example 19
Source Project: EhViewer   Source File: CookieRepositoryTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testUpdate() {
  Context app = RuntimeEnvironment.application;

  HttpUrl urlEh = HttpUrl.parse("http://www.ehviewer.com/");
  Cookie cookieEh1 = new Cookie.Builder()
      .name("level")
      .value("999")
      .domain("www.ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() + 100000)
      .build();
  Cookie cookieEh2 = new Cookie.Builder()
      .name("level")
      .value("0")
      .domain("www.ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() + 100000)
      .build();

  CookieRepository repository = new CookieRepository(app, "cookie.db");
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh1));
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh2));
  Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
  assertEquals(1, map.size());
  equals(map.get("www.ehviewer.com"), Collections.singletonList(cookieEh2));
  repository.close();

  repository = new CookieRepository(app, "cookie.db");
  map = Reflect.on(repository).field("map").get();
  assertEquals(1, map.size());
  equals(map.get("www.ehviewer.com"), Collections.singletonList(cookieEh2));
  repository.close();
}
 
Example 20
Source Project: EhViewer   Source File: CookieRepositoryTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testRemoveByExpired() {
  Context app = RuntimeEnvironment.application;

  HttpUrl urlEh = HttpUrl.parse("http://www.ehviewer.com/");
  Cookie cookieEh1 = new Cookie.Builder()
      .name("level")
      .value("999")
      .domain("www.ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() + 100000)
      .build();
  Cookie cookieEh2 = new Cookie.Builder()
      .name("level")
      .value("0")
      .domain("www.ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() - 100000)
      .build();

  CookieRepository repository = new CookieRepository(app, "cookie.db");
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh1));
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh2));
  Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
  assertEquals(1, map.size());
  equals(map.get("www.ehviewer.com"), Collections.<Cookie>emptyList());
  repository.close();

  repository = new CookieRepository(app, "cookie.db");
  map = Reflect.on(repository).field("map").get();
  assertEquals(0, map.size());
  repository.close();
}
 
Example 21
Source Project: EhViewer   Source File: CookieRepositoryTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testRemoveByNonPersistent() {
  Context app = RuntimeEnvironment.application;

  HttpUrl urlEh = HttpUrl.parse("http://www.ehviewer.com/");
  Cookie cookieEh1 = new Cookie.Builder()
      .name("level")
      .value("999")
      .domain("www.ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() + 100000)
      .build();
  Cookie cookieEh2 = new Cookie.Builder()
      .name("level")
      .value("0")
      .domain("www.ehviewer.com")
      .path("/")
      .build();

  CookieRepository repository = new CookieRepository(app, "cookie.db");
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh1));
  repository.saveFromResponse(urlEh, Collections.singletonList(cookieEh2));
  Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
  assertEquals(1, map.size());
  equals(map.get("www.ehviewer.com"), Collections.singletonList(cookieEh2));
  repository.close();


  repository = new CookieRepository(app, "cookie.db");
  map = Reflect.on(repository).field("map").get();
  assertEquals(0, map.size());
  repository.close();
}
 
Example 22
Source Project: EhViewer   Source File: CookieRepositoryTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testClear() {
  Context app = RuntimeEnvironment.application;

  HttpUrl url = HttpUrl.parse("http://www.ehviewer.com/");
  Cookie cookie = new Cookie.Builder()
      .name("user")
      .value("1234567890")
      .domain("ehviewer.com")
      .path("/")
      .expiresAt(System.currentTimeMillis() + 3000)
      .build();

  CookieRepository repository = new CookieRepository(app, "cookie.db");
  repository.saveFromResponse(url, Collections.singletonList(cookie));
  Map<String, CookieSet> map = Reflect.on(repository).field("map").get();
  assertEquals(1, map.size());
  equals(map.get("ehviewer.com"), Collections.singletonList(cookie));
  repository.clear();
  map = Reflect.on(repository).field("map").get();
  assertEquals(0, map.size());
  repository.close();

  repository = new CookieRepository(app, "cookie.db");
  map = Reflect.on(repository).field("map").get();
  assertEquals(0, map.size());
  repository.close();
}
 
Example 23
Source Project: Orienteer   Source File: AbstractDynamicProvider.java    License: Apache License 2.0 5 votes vote down vote up
private Class<?> getRequiredType() {
 	
 		Reflect context = Reflect.on(injector).call("enterContext");
try {
	Dependency<?> dependency = context.call("getDependency").get();
	return dependency.getKey().getTypeLiteral().getRawType();
} finally {
	context.call("close");
}
 }
 
Example 24
Source Project: Orienteer   Source File: AbstractMethodHandler.java    License: Apache License 2.0 5 votes vote down vote up
protected static Object prepareForJava(ODocument result, Class<?> requiredClass) {
	if(result==null) return null;
	else if(requiredClass.isInstance(result)) return result;
	else if(ODocumentWrapper.class.isAssignableFrom(requiredClass)) 
		return Reflect.onClass(requiredClass).create(result).get();
	else if(requiredClass.isInterface())
		return DAO.provide(requiredClass, result);
	else if(result.containsField("value")) {
		Object value = result.field("value");
		if(value instanceof ODocument) return prepareForJava((ODocument)value, requiredClass);
		return result.field("value", requiredClass);
	}
	throw new IllegalStateException("Can't case ODocument to "+requiredClass); 
}
 
Example 25
Source Project: Orienteer   Source File: AbstractMethodHandler.java    License: Apache License 2.0 5 votes vote down vote up
protected static Reflect onRealClass(Class<?> clazz) {
	if(!clazz.isInterface()) return Reflect.onClass(clazz);
	else if(clazz.isAssignableFrom(ArrayList.class)) return Reflect.onClass(ArrayList.class);
	else if(clazz.isAssignableFrom(HashSet.class)) return Reflect.onClass(HashSet.class);
	else if(clazz.isAssignableFrom(HashMap.class)) return Reflect.onClass(HashMap.class);
	return Reflect.onClass(clazz); //Will fail in case of creation of new instance
}
 
Example 26
Source Project: Orienteer   Source File: DefaultInterfaceMethodHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ResultHolder handle(T target, Object proxy, Method method, Object[] args) throws Throwable {
	if(method.isDefault()) {
	Class<?> declaringClass = method.getDeclaringClass();
	MethodHandles.Lookup lookup = Reflect.onClass(MethodHandles.Lookup.class)
			.create(declaringClass, MethodHandles.Lookup.PRIVATE).get();
	return new ResultHolder(lookup.unreflectSpecial(method, declaringClass)
				  .bindTo(proxy)
				  .invokeWithArguments(args));
	} else return null;
}
 
Example 27
@Test
public void fromJson() throws URISyntaxException, JsonIOException, JsonSyntaxException, IOException, TranscoderException, InstantiationException, IllegalAccessException {
    try (final Reader reader = new InputStreamReader(new FileInputStream(PATH_IN + ninePatchConfig))) {
        Type t = new TypeToken<Set<NinePatch>>() {}.getType();
        Set<NinePatch> ninePatchSet = new GsonBuilder().create().fromJson(reader, t);
        NinePatchMap ninePatchMap = NinePatch.init(ninePatchSet);
        QualifiedResource svg = qualifiedSVGResourceFactory.fromSVGFile(new File(PATH_IN + resourceName));
        NinePatch ninePatch = ninePatchMap.getBestMatch(svg);

        assertNotNull(ninePatch);

        final String name = svg.getName();
    	Reflect.on(svg).set("name", name + "_" + targetDensity.name());
        plugin.transcode(svg, targetDensity, new File(PATH_OUT), ninePatch);
     final File ninePatchFile = new File(PATH_OUT, svg.getName() + ".9." + OUTPUT_FORMAT.name().toLowerCase());
        final File nonNinePatchFile = new File(PATH_OUT, svg.getName() + "." + OUTPUT_FORMAT.name().toLowerCase());

        if (OUTPUT_FORMAT.hasNinePatchSupport()) {
        	assertTrue(FilenameUtils.getName(ninePatchFile.getAbsolutePath()) + " does not exists although the output format supports nine patch", ninePatchFile.exists());
        	assertTrue(FilenameUtils.getName(nonNinePatchFile.getAbsolutePath()) + " file does not exists although the output format supports nine patch", !nonNinePatchFile.exists());
         BufferedImage image = ImageIO.read(new FileInputStream(ninePatchFile));
      tester.test(image);
      // test corner pixels
      int w = image.getWidth();
      int h = image.getHeight();
      new PixelTester(new int[][] {}, new int[][] {
      		{0, 0},
      		{0, h - 1},
      		{w - 1, 0},
      		{w - 1, h - 1}
      }).test(image);
        } else {
        	assertTrue(FilenameUtils.getName(ninePatchFile.getAbsolutePath()) + " exists although the output format does not support nine patch", !ninePatchFile.exists());
        	assertTrue(FilenameUtils.getName(nonNinePatchFile.getAbsolutePath()) + " does not exists although the output format does not support nine patch", nonNinePatchFile.exists());
        }
    }
}
 
Example 28
Source Project: Journey   Source File: CefMessageRouterProxy.java    License: Apache License 2.0 4 votes vote down vote up
static CefMessageRouterProxy createRouter() {
    JourneyLoader classLoader = JourneyLoader.getJourneyClassLoader();
    Object realCefMessageRouter = Reflect.onClass(classLoader.loadClass("org.cef.browser.CefMessageRouter"))
            .call("create").get();
    return Reflect.on(realCefMessageRouter).as(CefMessageRouterProxy.class);
}
 
Example 29
Source Project: Journey   Source File: JourneySettings.java    License: Apache License 2.0 4 votes vote down vote up
public String getBrowserSubprocessPath() {
    return Reflect.on(cefSettings).get("browser_subprocess_path");
}
 
Example 30
Source Project: Journey   Source File: JourneySettings.java    License: Apache License 2.0 4 votes vote down vote up
public void setBrowserSubprocessPath(String browser_subprocess_path) {
    Reflect.on(cefSettings).set("browser_subprocess_path", browser_subprocess_path);
}