Want to start a project?
(ns project.tests
(:use project.utils))
(defcase standart-create-qos "Create QoS policy"
(select-main-menu "SLA management" "QoS policy")
(press-button "Create new QoS policy")
(input "Name" "test_qos_2")
(select-option "Service class" "Class G")
(select-option "Profile type" "test_profile")
(set-quality-rule "For 15 minutes" "packet loss rate" "in the forward direction" "is less than" "10")
(wait-response (press-button "Save"))
(check-row-exists "test_qos_2"))
public ByteArrayInputStream toInputStream (String s, String charset)
throws UnsupportedEncodingException {
return new ByteArrayInputStream(s.getBytes(charset));
}
(defn string->stream [s charset]
(-> s
(.getBytes charset)
(ByteArrayInputStream.)))
(defn string->stream [s encoding]
(to-input-stream s {:encoding encoding}))
(->> request
:headers
(filter #(str/starts-with? % "my-header")))
(def primes
(filter prime? (iterate inc 1)))
(defn solve []
(->> primes
(take-while #(< % 2E6))
(reduce +)))
(def my-routes
(routes
(GET "/foo" [] "Hello Foo")
(GET "/bar/:id" [id] (str "Hello " id)))))
(html [:span {:class "foo"} "bar"]) ;; => <span class="foo">bar</span>
(html [:ul (for [x (range 1 4)] [:li x])])
;; => <ul><li>1</li><li>2</li><li>3</li></ul>
(let [x {:a 1 :b 1}]
(match [x]
[{:a _ :b 2}] :a0
[{:a 1 :b 1}] :a1
[{:c 3 :d _ :e 4}] :a2
:else nil))
;=> :a1
(matchm [(java.util.Date. 2010 10 1 12 30)]
[{:year 2009 :month a}] a
[{:year (:or 2010 2011) :month b}] b
:else :no-match)
(defonce log-chan (chan))
(defn loop-worker [msg]
(println (str "hello, " msg "!")))
(go-loop []
(let [msg (<! log-chan)]
(loop-worker msg)
(recur)))
(>!! log-chan "world") ; => hello, world!
(>!! log-chan "core.async") ; => hello, core.async!
(s/def ::id int?)
(s/def ::name string?)
(s/def ::user (s/keys ::req-un [::id ::name]))
(def app
(api
{:coercion :spec}
(GET "/users/:id" []
:path-params [id :- ::id]
:return ::user
(ok (users-by-id id)))))
{:select [:a :b :c]
:from [:foo]
:where [:= :f.a "baz"]}