From 505ab143a33dfc742bc7d01253d78f115cca4a99 Mon Sep 17 00:00:00 2001 From: Clemens Geibel Date: Tue, 4 Feb 2020 19:21:14 +0100 Subject: [PATCH] Created first draft for jar.clj and jar_test.clj --- src/cryogen_core/classpath_able_io/jar.clj | 17 ++++++++++++++++ .../classpath_able_io/jar_test.clj | 20 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/cryogen_core/classpath_able_io/jar.clj create mode 100644 test/cryogen_core/classpath_able_io/jar_test.clj diff --git a/src/cryogen_core/classpath_able_io/jar.clj b/src/cryogen_core/classpath_able_io/jar.clj new file mode 100644 index 0000000..cee8d63 --- /dev/null +++ b/src/cryogen_core/classpath_able_io/jar.clj @@ -0,0 +1,17 @@ +; Copyright (c) meissa. All rights reserved. +; The use and distribution terms for this software are covered by the +; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) +; which can be found in the file epl-v10.html at the root of this distribution. +; By using this software in any fashion, you are agreeing to be bound by +; the terms of this license. +; You must not remove this notice, or any other, from this software. + +(ns cryogen-core.classpath-able-io.jar + (:require [cryogen-core.classpath-able-io.type :as type]) + (:import [java.net URI] + [java.nio.file Paths Files LinkOption])) + +(defn is-from-classpath-jar? + [uri ;:- JavaUri + ] + (= (.getScheme uri) "jar")) diff --git a/test/cryogen_core/classpath_able_io/jar_test.clj b/test/cryogen_core/classpath_able_io/jar_test.clj new file mode 100644 index 0000000..f12f33c --- /dev/null +++ b/test/cryogen_core/classpath_able_io/jar_test.clj @@ -0,0 +1,20 @@ +; Copyright (c) meissa. All rights reserved. +; The use and distribution terms for this software are covered by the +; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) +; which can be found in the file epl-v10.html at the root of this distribution. +; By using this software in any fashion, you are agreeing to be bound by +; the terms of this license. +; You must not remove this notice, or any other, from this software. + +(ns cryogen-core.classpath-able-io.jar-test + (:require [clojure.test :refer :all] + [clojure.java.io :as io] + [schema.core :as s] + [cryogen-core.file-test-tools :as ftt] + [cryogen-core.classpath-able-io.jar :as sut]) + (:import [java.net URI])) + +(deftest test-is-from-classpath-jar? + (is + (sut/is-from-classpath-jar? (.toURI (io/resource "dummy")))) + )