2 * Copyright (c) 2016 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.updater.mock
19 private val patch = this.javaClass.classLoader.getResourceAsStream("patch/patch.jar").use { it.readBytes() }
21 fun generateXml(productCode: String, buildId: String, eap: Boolean): String {
22 val status = if (eap) "eap" else "release"
24 <!DOCTYPE products SYSTEM "updates.dtd">
26 <product name="Mock Product">
27 <code>$productCode</code>
28 <channel id="MOCK" status="$status" licensing="$status">
29 <build number="9999.0.0" version="Mock">
30 <message><![CDATA[A mock update. For testing purposes only.]]></message>
31 <button name="Download" url="https://www.jetbrains.com/" download="true"/>
32 <patch from="$buildId" size="from 0 to ∞"/>
36 </products>""".trimIndent()
39 fun generatePatch(): ByteArray = patch