Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
12fbacc765
5 changed files with 39 additions and 204 deletions
|
|
@ -1,197 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output version="1.0" method="text" indent="no" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="*"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="meta">
|
||||
{
|
||||
"version": "<xsl:value-of select="@version"/>",
|
||||
<xsl:apply-templates select="*"/>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="enums">
|
||||
"enums": {
|
||||
<xsl:apply-templates select="*" mode="enums"/>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="objects">
|
||||
,"objects": {
|
||||
<xsl:apply-templates select="*" mode="objects"/>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="views">
|
||||
,"views": {
|
||||
<!--xsl:apply-templates select="*" mode="views"/-->
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="reports"></xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="types">
|
||||
,"types": [
|
||||
<xsl:apply-templates select="*" mode="types"/>
|
||||
]
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="types">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{
|
||||
"code": "<xsl:value-of select="name(.)"/>",
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="enums">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name(.)"/>": {
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
"fields": [<xsl:apply-templates select="*" mode="field"/>]
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="objects">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name(.)"/>": {
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
"fields": [<xsl:apply-templates select="*[name()!='actions']" mode="field"/>]
|
||||
<xsl:apply-templates select="query|subscription|subscriptionHistory" mode="objects"/>
|
||||
<xsl:if test="actions">,"actions":[<xsl:apply-templates select="actions" mode="objects"/>]</xsl:if>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="query" mode="objects"></xsl:template>
|
||||
<xsl:template match="subscription" mode="objects"></xsl:template>
|
||||
<xsl:template match="subscriptionHistory" mode="objects"></xsl:template>
|
||||
<xsl:template match="views" mode="objects"></xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="actions" mode="objects">
|
||||
<xsl:for-each select="*">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{"method":"<xsl:value-of select="name()"/>",
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
"fields": [<xsl:apply-templates select="*" mode="field"/>]
|
||||
}
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
|
||||
<xsl:template match="*" mode="views">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name(.)"/>": {
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
<xsl:if test="source">"sources": [<xsl:apply-templates select="source" mode="views"/>]</xsl:if>
|
||||
<xsl:if test="set">,"fields":[<xsl:apply-templates select="set" mode="views"/>]</xsl:if>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="source" mode="views">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="@code"/>"
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="set" mode="views">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(field)=1">
|
||||
<xsl:apply-templates select="field"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
{<xsl:for-each select="field[position() = 1]">
|
||||
<xsl:for-each select="@*[name()!='source']">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name()"/>":
|
||||
<xsl:variable name="attrName"><xsl:value-of select="name()"/></xsl:variable>
|
||||
{
|
||||
<xsl:for-each select="parent::*/parent::*/field/@*[name()=$attrName]">
|
||||
<xsl:apply-templates select="." mode="withSource"/>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="field">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{"code": "<xsl:value-of select="name()"/>",
|
||||
<xsl:for-each select="@*">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='type'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='length'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='searchable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='sortable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='visible'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='ignore'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='required'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='cacheable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:otherwise>"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="value">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{"<xsl:value-of select="name()"/>":
|
||||
{
|
||||
<xsl:for-each select="@*">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='id'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='code'">"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:when>
|
||||
<xsl:when test="name()='name'">"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:when>
|
||||
<xsl:otherwise>"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="@*" mode="withSource">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='type'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='length'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='searchable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='sortable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='visible'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='required'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='cacheable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:otherwise>"<xsl:value-of select="parent::*/@source"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -38,7 +38,9 @@ INSERT INTO <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="@
|
|||
<xsl:with-param name="nodeName" select="$nodeName"/>
|
||||
</xsl:apply-templates>) values (<xsl:apply-templates select="@*" mode="values">
|
||||
<xsl:with-param name="nodeName" select="$nodeName"/>
|
||||
</xsl:apply-templates>);
|
||||
</xsl:apply-templates>) ON CONFLICT (ID) DO UPDATE SET <xsl:apply-templates select="@*" mode="tablename-conflict-set">
|
||||
<xsl:with-param name="nodeName" select="$nodeName"/>
|
||||
</xsl:apply-templates>;
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="objects">
|
||||
|
|
@ -48,7 +50,9 @@ INSERT INTO <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="@
|
|||
<xsl:with-param name="nodeName" select="$nodeName"/>
|
||||
</xsl:apply-templates>) values (<xsl:apply-templates select="@*" mode="values">
|
||||
<xsl:with-param name="nodeName" select="$nodeName"/>
|
||||
</xsl:apply-templates>);
|
||||
</xsl:apply-templates>) ON CONFLICT (ID) DO UPDATE SET <xsl:apply-templates select="@*" mode="tablename-conflict-set">
|
||||
<xsl:with-param name="nodeName" select="$nodeName"/>
|
||||
</xsl:apply-templates>;
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*" mode="tablename">
|
||||
|
|
@ -78,6 +82,19 @@ INSERT INTO <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="@
|
|||
<xsl:if test="position() != last()">, </xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*" mode="tablename-conflict-set">
|
||||
<xsl:param name="nodeName"/>
|
||||
<xsl:variable name="fieldName" select="name()"/>
|
||||
<xsl:variable name="dbFieldName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dbFieldName='ID'">
|
||||
</xsl:when>
|
||||
<xsl:when test="xalan:nodeset($meta)/*/*[name()=$nodeName]/*[name()=$fieldName]">
|
||||
<xsl:value-of select="$dbFieldName"/> = EXCLUDED.<xsl:value-of select="$dbFieldName"/>
|
||||
<xsl:if test="position() != last()">, </xsl:if>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='convertDbStyle'>
|
||||
<xsl:param name='toconvert' />
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan">
|
||||
<xsl:output version="1.0" method="html" indent="no" encoding="UTF-8"/>
|
||||
|
||||
<xsl:variable name="data" select="document('..\data.xml')/meta"/>
|
||||
<xsl:variable name="meta" select="document('..\meta.xml')/meta"/>
|
||||
|
||||
<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
|
||||
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
||||
<xsl:variable name="avoidletters">_0123456789</xsl:variable>
|
||||
|
||||
<xsl:variable name="meta" select="document('..\meta.xml')/meta"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
|
|
@ -72,11 +73,17 @@
|
|||
|
||||
<xsl:template match="*" mode="enums">
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='concat(name(),"Dictionary")'/></xsl:call-template></xsl:variable>
|
||||
<xsl:variable name="enumName"><xsl:value-of select="name()"/></xsl:variable>
|
||||
<h3><xsl:value-of select="position()"/>. <xsl:value-of select="@name"/> - <xsl:value-of select="$dbTableName"/>( <xsl:value-of select="name()"/>)</h3>
|
||||
<table class="sample" width="100%" border="0">
|
||||
<tr><td width="10%">№</td><td width="20%">Поле</td><td width="20%">Тип</td><td width="45%">Наименование</td></tr>
|
||||
<xsl:apply-templates select="*" mode="comment-enums"/>
|
||||
</table>
|
||||
<a name="enums.{name()}"/>
|
||||
<div>Значения:</div>
|
||||
<xsl:for-each select="xalan:nodeset($data)/enums/*[name()=$enumName]">
|
||||
<xsl:value-of select="@id"/>. <xsl:value-of select="@code"/> - <i><xsl:value-of select="@name"/></i><br/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="objects">
|
||||
|
|
@ -87,7 +94,6 @@
|
|||
<tr><td width="10%">№</td><td width="20%">Поле</td><td width="20%">Тип</td><td width="45%">Наименование</td></tr>
|
||||
<xsl:apply-templates select="*" mode="comment-objects"/>
|
||||
</table>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="field" >
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import static ru.spcex.clearing.balance.utils.MatcherFactory.usingIgnoringFields
|
|||
|
||||
class AccountBalanceServiceTest extends AbstractServiceTest {
|
||||
|
||||
public static final Matcher<AccountResult> ACCOUNT_BALANCE_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate");
|
||||
private static final Matcher<AccountResult> ACCOUNT_BALANCE_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate");
|
||||
private final BigDecimal amountNew = new BigDecimal(1000);
|
||||
private final String cashMovementCurrencyCodeNew = "cash";
|
||||
private final Long accountIdUpdate = accountIdNew;
|
||||
|
|
|
|||
|
|
@ -5,14 +5,20 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import ru.clearing.classes.statics.data.account.Account;
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf01;
|
||||
import ru.clearing.classes.statics.data.statement.Statement;
|
||||
import ru.spcex.clearing.balance.utils.MatcherFactory;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collections;
|
||||
|
||||
import static ru.spcex.clearing.balance.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||
|
||||
class Sdf01ExecutorTest extends AbstractServiceTest {
|
||||
|
||||
private static final MatcherFactory.Matcher<Result> SDF01_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate");
|
||||
|
||||
private final static DateTimeFormatter datFormatter = DateTimeFormatter.ofPattern("dd.MM.yy");
|
||||
private final Long id = currentId.getAndIncrement();
|
||||
@Autowired
|
||||
|
|
@ -20,6 +26,7 @@ class Sdf01ExecutorTest extends AbstractServiceTest {
|
|||
|
||||
@Test
|
||||
void execute() {
|
||||
//check create statement
|
||||
SDf01 sDf01 = new SDf01();
|
||||
sDf01.setMarket("U");//!"U".equals
|
||||
sDf01.setDeal(deal);//tradingCode
|
||||
|
|
@ -38,6 +45,8 @@ class Sdf01ExecutorTest extends AbstractServiceTest {
|
|||
|
||||
Result predictableResult = new Result();
|
||||
predictableResult.setGenerationId(id);
|
||||
Statement predictableStatement = new Statement();
|
||||
Result result = sdf01Executor.execute(Collections.singletonList(sDf01), statementRequest);
|
||||
SDF01_MATCHER.assertMatch(result, predictableResult);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue