Skip to content

Commit

Permalink
chore(cleanup): remove platform stream handler
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli authored and valdar committed May 18, 2019
1 parent 98f0b14 commit 6de97a3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 289 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.ServiceLoader;

import org.apache.camel.k.Runtime;
import org.apache.camel.k.support.PlatformStreamHandler;
import org.apache.camel.k.support.RuntimeSupport;

public class Application {
Expand All @@ -33,16 +32,6 @@ public class Application {
// We now support setting the logging level only
//
ApplicationSupport.configureLogging();

//
// Install a custom protocol handler to support discovering resources
// from the platform i.e. in knative, resources are provided through
// env var as it is not possible to mount config maps / secrets.
//
// TODO: we should remove as soon as we get a knative version that
// includes https://github.com/knative/serving/pull/3061
//
PlatformStreamHandler.configure();
}

public static void main(String[] args) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.apache.camel.k.listener.ContextConfigurer;
import org.apache.camel.k.listener.ContextLifecycleConfigurer;
import org.apache.camel.k.listener.RoutesConfigurer;
import org.apache.camel.k.support.PlatformStreamHandler;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.io.IOUtils;
Expand Down Expand Up @@ -84,24 +83,4 @@ void testLoadRouteAndRest() throws Exception {
runtime.stop();
}
}


@Test
void testLoadResource() throws Exception {
PlatformStreamHandler.configure();

CamelContext context = new ApplicationRuntime().getContext();

try (InputStream is = Resources.resolveResourceAsInputStream(context, "platform:my-resource.txt")) {
String content = IOUtils.toString(is, Charset.defaultCharset());

assertThat(content).isEqualTo("value from file resource");
}

try (InputStream is = Resources.resolveResourceAsInputStream(context, "platform:my-other-resource.txt")) {
String content = IOUtils.toString(is, Charset.defaultCharset());

assertThat(content).isEqualTo("value from env");
}
}
}

0 comments on commit 6de97a3

Please sign in to comment.