Skip to content

Commit

Permalink
1.3
Browse files Browse the repository at this point in the history
Ready 7.11 + improve interface to compare server
  • Loading branch information
pierre-yves-monnet committed Jul 25, 2020
1 parent 54c074f commit e64ecf7
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 44 deletions.
8 changes: 5 additions & 3 deletions Actions.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.search.SearchOptionsBuilder;
import org.bonitasoft.engine.search.SearchResult;
import org.bonitasoft.engine.service.TenantServiceSingleton
import org.bonitasoft.console.common.server.page.PageContext
import org.bonitasoft.console.common.server.page.PageController
import org.bonitasoft.console.common.server.page.PageResourceProvider

import org.bonitasoft.web.extension.page.PageContext;
import org.bonitasoft.web.extension.page.PageController;
import org.bonitasoft.web.extension.page.PageResourceProvider;

import org.bonitasoft.engine.exception.AlreadyExistsException;
import org.bonitasoft.engine.exception.BonitaHomeNotSetException;
import org.bonitasoft.engine.exception.CreationException;
Expand Down
8 changes: 5 additions & 3 deletions Index.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ import java.sql.DatabaseMetaData;
import org.apache.commons.lang3.StringEscapeUtils

import org.bonitasoft.engine.identity.User;
import org.bonitasoft.console.common.server.page.PageContext
import org.bonitasoft.console.common.server.page.PageController
import org.bonitasoft.console.common.server.page.PageResourceProvider

import org.bonitasoft.web.extension.page.PageContext;
import org.bonitasoft.web.extension.page.PageController;
import org.bonitasoft.web.extension.page.PageResourceProvider;

import org.bonitasoft.engine.exception.AlreadyExistsException;
import org.bonitasoft.engine.exception.BonitaHomeNotSetException;
import org.bonitasoft.engine.exception.CreationException;
Expand Down
40 changes: 22 additions & 18 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,9 @@
<table><tr><td><h1>Drill Car</h1></td><td rowspan="2"><img src="img/drillcar.jpg" width="150" heigth="150" /></td></tr>
<tr><td>
<center>
V1.2
V1.3
</center>
</td></tr>
<tr><td>
<div id="showHistory" ng-if="ctrl.isshowhistory" style="border-width:2px;border-style:ridge;border-color:blue">
1.0 2019 November<br>
1.1 2019 December<br>
1.2 2019 December<br>
</div>
</td></tr>
</table>
</center>

Expand All @@ -74,8 +67,8 @@


<ul class="nav nav-tabs" ng-class="{'nav-stacked': vertical, 'nav-justified': justified}" style="border-bottom: 1px solid #c2c2c2;">
<li ng-class="{active: active, disabled: false}" id="form-tab" heading="properties" active="true" title="Server Properties" select="ctrl.navbaractiv == 'properties'" class="{{ctrl.getNavClass('properties')}}" style="{{ctrl.getNavStyle('properties')}}">
<a ng-click="ctrl.navbaractiv = 'properties';" class="ng-binding">Server Properties</a>
<li ng-class="{active: active, disabled: false}" id="form-tab" heading="properties" active="true" title="Setup Properties" select="ctrl.navbaractiv == 'properties'" class="{{ctrl.getNavClass('properties')}}" style="{{ctrl.getNavStyle('properties')}}">
<a ng-click="ctrl.navbaractiv = 'properties';" class="ng-binding">Setup Properties</a>
</li>
<li ng-class="{active: active, disabled: false}" id="form-tab" heading="context" active="true" title="Tomcat context" select="ctrl.navbaractiv == 'context'" class="{{ctrl.getNavClass('context')}}" style="{{ctrl.getNavStyle('context')}}">
<a ng-click="ctrl.navbaractiv='context'" class="ng-binding">Tomcat context</a>
Expand Down Expand Up @@ -407,27 +400,38 @@ <h3>Recommendations</h3>
You can give a second Bonita directory to compare a UAT and a PRODUCTION platform, for example.
</td>
<tr>
<tr style="padding: 10px 5px 20px 10px;">
<td style="width:200px">Do a Setup pull before the operation</td><td>
<input type="checkbox" ng-model="ctrl.diff.param.doSetupPull" title="Do a Setup pull before the operation"></input><br>
<tr style="padding: 10px;"><td colspan="2" style="text-align:center;background-color: rgb(114, 191, 210)">Application</td></tr>
<tr style="padding: 10px 5px 20px 10px;">
<td style="padding: 10px 5px 20px 10px;">Use this application:</td>
<td><input type="checkbox" ng-model="ctrl.diff.param.useLocalServer" title="If check, the local server is used to compare with."></input></td>
</tr>
<tr >
<td style="padding: 10px 5px 20px 10px;">Comparison Directory</td>
<td>
<input ng-model="ctrl.diff.param.applicationFile" style="width: 100%;" ng-disabled="ctrl.diff.param.useLocalServer" title="Give a directory accessible by the server, to compare. invalid is the local file are used"></input> <br>
</td>
</tr>
<tr >
<td style="padding: 10px 5px 20px 10px;">Do a Setup pull before</td><td>
<input type="checkbox" ng-model="ctrl.diff.param.doSetupPull" ng-disabled="! ctrl.diff.param.useLocalServer" title="Do a Setup pull before the operation. Invalid if you give explicitaly a local file"></input><br>
</td>
</tr>
</tr>
<tr style="padding: 10px;"><td colspan="2" style="text-align:center;background-color: rgb(114, 191, 210)">Parameters</td></tr>
<tr style="padding: 10px 5px 20px 10px;"><td>Compare XML:</td><td><input type="checkbox" ng-model="ctrl.diff.param.compareContextXml" title="XML files are opened, and compare nodes per nodes"></input></td></tr>
<tr style="padding: 10px 5px 20px 10px;"><td>Ignore image:</td><td><input type="checkbox" ng-model="ctrl.diff.param.ignoreImage" title="Images (JPEG, GIFF, ...) files are ignored"></input></td></tr>
<tr style="padding: 10px 5px 20px 10px;"><td>Ignore Bonita Transation:</td><td><input type="checkbox" ng-model="ctrl.diff.param.ignoreBonitaTranslationFile" title="Bonita Translation file are ignored"></input></td></tr>
<tr style="padding: 10px 5px 20px 10px;"><td>Ignore Bonita Transaction:</td><td><input type="checkbox" ng-model="ctrl.diff.param.ignoreBonitaTranslationFile" title="Bonita Translation file are ignored"></input></td></tr>
<tr style="padding: 10px 5px 20px 10px;"><td>Ignore temporary directory:</td><td><input type="checkbox" ng-model="ctrl.diff.param.ignoreTemp" title="Temporary directory (temp, tmp) are ignored in the comparison"></input></td></tr>
<tr style="padding: 10px 5px 20px 10px;"><td>Ignore Licence files:</td><td><input type="checkbox" ng-model="ctrl.diff.param.ignoreLicence" title="License file are ignored"></input></td></tr>
<tr style="padding: 10px 5px 20px 10px;"><td>Ignore License files:</td><td><input type="checkbox" ng-model="ctrl.diff.param.ignoreLicence" title="License file are ignored"></input></td></tr>
<tr style="padding: 10px 5px 20px 10px;"><td>Ignore setup directory:</td><td><input type="checkbox" ng-model="ctrl.diff.param.ignoreSetup" title="Setup directory are ignored, then the comparison is only on the environment (memory, SSO..)"></input></td></tr>
<tr style="padding: 10px 5px 20px 10px;"><td>Ignore Defered JS:</td><td><input type="checkbox" ng-model="ctrl.diff.param.ignoreDeferedJs" title="Execution generated multiple deferended JS to improve performance. They are ignored."></input></td></tr>
<tr style="padding: 10px 5px 20px 10px;"><td>Ignore Deffered JS:</td><td><input type="checkbox" ng-model="ctrl.diff.param.ignoreDeferedJs" title="Execution generated multiple deferended JS to improve performance. They are ignored."></input></td></tr>
</table>
<center>
<div ng-show="ctrl.inprogress">
<span class="Loading">.</span>
Please wait, collect in progress
</div>

<button class="btn btn-success" ng-click="ctrl.diffAnalysis()">Analysis</button> <p>
<button class="btn btn-success" ng-click="ctrl.diffAnalysis()" ng-disabled="ctrl.inprogress">Analysis</button> <p>
</center>
<!-- <div class="alert alert-info">{{ctrl.diff.param}}</div> -->
</div>
Expand Down
Binary file removed lib/CustomPageDrillCar-1.1.1.jar
Binary file not shown.
Binary file added lib/CustomPageDrillCar-1.3.0.jar
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.bonitasoft.custompage</groupId>
<artifactId>CustomPageDrillCar</artifactId>
<version>1.1.1</version>
<version>1.3.0</version>
<dependencies>
<dependency>
<groupId>org.bonitasoft.engine</groupId>
Expand All @@ -23,7 +23,7 @@
<dependency>
<groupId>org.bonitasoft.serverconfiguration</groupId>
<artifactId>bonita-serverconfiguration</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.bonitasoft.log.event</groupId>
Expand Down
14 changes: 9 additions & 5 deletions resources/drillmonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ appCommand.controller('DrillControler',
// -----------------------------------------------------------------------------------------
// Properties
// -----------------------------------------------------------------------------------------
this.props = { 'param' : { 'collectSetup':true, 'collectServer':true, 'collectAnalysis':true, 'doSetupPull':true, 'dosetupull': true, 'displaylevel': 'all'},
this.props = { 'param' : { 'collectSetup':true, 'collectServer':true, 'collectAnalysis':true, 'doSetupPull':true, 'dosetupull': true, 'displaylevel': 'all', 'useLocalFile' : true},
'platform': [],
'tenants': {
'list':[],
Expand Down Expand Up @@ -176,19 +176,23 @@ appCommand.controller('DrillControler',

this.diff = {"displaylevel": 100,
"param":
{"useLocalFile": true,
"doSetupPull" : true,
{
"referentielIsABundle": true,
"comparaisonFile": "",
"referenceFile":'',

"useLocalServer" : true,
"applicationFile": "",
"doSetupPull" : true,


'compareContextXml': false,
'ignoreImage': true,
'ignoreBonitaTranslationFile': true,
'ignoreTemp': true,
'ignoreLicence':true,
'ignoreSetup':false,
'ignoreDeferedJs': true
}
}
};

// D:/pym/Google Drive/consulting/20190429 Verizon Migration/analysis/7.8.4/BonitaSubscription-7.8.4_SIT_110119-2
Expand Down
43 changes: 30 additions & 13 deletions src/main/java/org/bonitasoft/custompage/drillcar/DrillCarAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import org.bonitasoft.log.event.BEvent;
import org.bonitasoft.log.event.BEventFactory;
import org.bonitasoft.log.event.BEvent.Level;
import org.bonitasoft.serverconfiguration.CollectOperation.TYPECOLLECT;
import org.bonitasoft.serverconfiguration.CollectResult;
import org.bonitasoft.serverconfiguration.CollectResult.COLLECTLOGSTRATEGY;
Expand All @@ -22,7 +23,9 @@

public class DrillCarAPI {

/**

public static BEvent eventParameterError = new BEvent(DrillCarAPI.class.getName(), 1, Level.APPLICATIONERROR, "Parameter error", "Something is wrong with parameters", "Analysis can't be done", "Check error");
/**
* collect all properties information
* @param parameters
* @param pageDirectory
Expand Down Expand Up @@ -84,32 +87,46 @@ public static Map<String, Object> propsCollects(Map<String, Object> parameters,
* @return
*/
public static Map<String, Object> diffAnalysis(Map<String, Object> parameters, File pageDirectory) {
ComparaisonParameter comparaisonParameter = ComparaisonParameter.getInstanceFromMap(parameters);

ArrayList<BEvent> listEvents = new ArrayList<BEvent>();
ComparaisonParameter comparaisonParameter;
try {
comparaisonParameter = ComparaisonParameter.getInstanceFromMap(parameters);
} catch(Exception e)
{
listEvents.add( new BEvent(eventParameterError, e, ""));
Map<String,Object> result = new HashMap<>();
result.put("listevents", BEventFactory.getSyntheticHtml(listEvents));
return result;
}

ConfigAPI currentConfig;
// value is D:\bonita\BPM-SP-7.9.0\workspace\tomcat\server\temp\bonita_portal_10028@Dragon-Pierre-Yves\tenants\1\pages\custompage_drillcar
File fileBundle = null;
fileBundle = new File(pageDirectory.getAbsoluteFile() + "/../../../../../../../");
ArrayList<BEvent> listEvents = new ArrayList<BEvent>();
File localServerFile = null;
localServerFile = new File(pageDirectory.getAbsoluteFile() + "/../../../../../../../");

try {
fileBundle = new File(fileBundle.getCanonicalPath());
localServerFile = new File(localServerFile.getCanonicalPath());
} catch (Exception e) {
}

if (comparaisonParameter.useLocalFile) {
File applicationFile=null;
if (comparaisonParameter.useLocalServer) {

currentConfig = ConfigAPI.getInstance( BonitaConfigPath.getInstance( fileBundle)) ;
listEvents.addAll( currentConfig.setupPull() );
currentConfig = ConfigAPI.getInstance( BonitaConfigPath.getInstance( localServerFile)) ;
applicationFile = localServerFile;
if (comparaisonParameter.doSetupPull)
listEvents.addAll( currentConfig.setupPull() );
}
else {
currentConfig = ConfigAPI.getInstance( BonitaConfigPath.getInstance( comparaisonParameter.applicationFile));
applicationFile = comparaisonParameter.applicationFile;
}
else
currentConfig = ConfigAPI.getInstance( BonitaConfigPath.getInstance( comparaisonParameter.localFile));

BonitaConfigBundle bonitaReferentiel = BonitaConfigBundle.getInstance(comparaisonParameter.referenceFile);

ComparaisonResult comparaison = currentConfig.compareWithReferentiel(bonitaReferentiel, comparaisonParameter, LOGSTRATEGY.NOLOG);

ComparaisonResultDecoMap decoMap = new ComparaisonResultDecoMap(comparaison, "", comparaisonParameter.localFile, comparaisonParameter.referenceFile);
ComparaisonResultDecoMap decoMap = new ComparaisonResultDecoMap(comparaison, "", applicationFile, comparaisonParameter.referenceFile);
listEvents.addAll( comparaison.getErrors());
Map<String,Object> result = decoMap.getMap();
result.put("listevents", BEventFactory.getSyntheticHtml(listEvents));
Expand Down

0 comments on commit e64ecf7

Please sign in to comment.