203 lines
5.7 KiB
Makefile
203 lines
5.7 KiB
Makefile
# ----------------------------------------------------------------------------- #
|
|
# Makefile pour Giant
|
|
# ----------------------------------------------------------------------------- #
|
|
PROJET = giant
|
|
COURRIEL = sbeaugrand@scores-decisions.com
|
|
MODELES = ../../includes/dbmodels
|
|
SOURCES = \
|
|
credit-data/v1/index.php \
|
|
test-credit-data.php \
|
|
monitor-events/v1/index.php \
|
|
monitor-events.php \
|
|
update-investigation-tests.php \
|
|
generateDoctrine.php \
|
|
orders.sql \
|
|
monitors.sql \
|
|
soapui-test-suite.ini \
|
|
Makefile
|
|
WSDL = \
|
|
wsdl/credit-data-service-provider-api-1.0.wsdl \
|
|
schema/services/credit-data-service-provider-api-1.0.xsd \
|
|
schema/services/shared-1.0.xsd \
|
|
schema/services/creditrecommendation-1.0.xsd \
|
|
schema/services/fulldataset-1.0.xsd \
|
|
schema/services/compactdataset-1.0.xsd \
|
|
schema/cdm/datatypes-1.0.xsd \
|
|
schema/services/credit-data-types-1.0.xsd \
|
|
schema/cdm/cdm-1.0.xsd \
|
|
schema/cdm/graydon_be-1.0.xsd \
|
|
wsdl/monitor-events-service-1.0.wsdl \
|
|
schema/services/monitor-1.0.xsd
|
|
SRC = http:\/\/services\.giant-net\.com
|
|
TST = https:\/\/giant-tst.graydon.nl
|
|
SRV = http:\/\/localhost:8088
|
|
DST = http:\/\/extranet\.devlocal\.com\/services
|
|
TESTS1 = \
|
|
Ping \
|
|
RetrieveOptions \
|
|
StartInvestigation \
|
|
OrderDataSet \
|
|
StartMonitoring
|
|
TESTS2 = \
|
|
RetrieveOrderStatus \
|
|
RetrieveDataSet
|
|
TESTS3 = \
|
|
StopMonitoring \
|
|
UpdateMonitoringOptions
|
|
TESTS4 = \
|
|
SignalMonitoringEvents
|
|
TESTS_UNITAIRES = $(addprefix test-, $(TESTS1) $(TESTS2) $(TESTS3) $(TESTS4))
|
|
O_ID = `mysql -ss giant -e "select Auto_increment from \
|
|
information_schema.tables where table_name='orders'" | \
|
|
awk 'END { print $$0 - 1 }'`
|
|
M_ID = `mysql -ss giant -e "select Auto_increment from \
|
|
information_schema.tables where table_name='monitors'" | \
|
|
awk 'END { print $$0 - 1 }'`
|
|
PWD = `pwd`
|
|
TDIR = tests
|
|
TPRE = $(TDIR)/test-
|
|
PHP_UI = php $(PWD)/update-investigation-tests.php
|
|
PHP_CD = php test-credit-data.php
|
|
PHP_ME = php monitor-events.php
|
|
SIRET = 55214450300018
|
|
|
|
.SUFFIXES:
|
|
|
|
.PHONY: all
|
|
all:
|
|
@echo
|
|
@echo "make install"
|
|
@echo " -> telechargement et modification des fichiers wsdl et xsd"
|
|
@echo " -> creation des tables de la base 'giant'"
|
|
@echo " -> generation des fichiers Doctrine"
|
|
@echo "make clean-wsdl"
|
|
@echo " -> suppression des fichiers wsdl et xsd pour que la cible"
|
|
@echo " 'install' les telecharge a nouveau"
|
|
@echo "make crontab"
|
|
@echo " -> executer update-investigation-tests.php tous les jours"
|
|
@echo "make tests"
|
|
@echo " -> executer tous les tests unitaires"
|
|
@echo "make test-<nom-du-test>"
|
|
@echo " -> executer un test unitaire, ex: make test-RetrieveOptions"
|
|
@echo "make clean-tests"
|
|
@echo " -> suppression de tous les fichiers de sortie des tests"
|
|
@echo "make clean"
|
|
@echo " -> suppression des fichiers non versionnes"
|
|
@echo "make test-suite"
|
|
@echo " -> generation de la suite de tests SoapUI"
|
|
@echo
|
|
|
|
.PHONY: install
|
|
install: wsdl tables doctrine test-suite
|
|
|
|
.PHONY: wsdl
|
|
wsdl: $(WSDL)
|
|
|
|
%.wsdl %.xsd:
|
|
wget -r -nH http://services.giant-net.com/$@
|
|
sed 's/$(SRC)/$(DST)/g' $@ > /tmp/sed.tmp && mv /tmp/sed.tmp $@
|
|
|
|
.PHONY: test-suite
|
|
test-suite:
|
|
cat soapui-test-suite.ini | \
|
|
sed 's/$(SRC)/$(DST)/g' | \
|
|
sed 's/$(TST)/$(DST)/g' | \
|
|
sed 's/$(SRV)\/credit-data\/v1/$(DST)\/credit-data\/v1\//g' | \
|
|
sed 's/0406952018/$(SIRET)/g' | \
|
|
sed 's/533885/$(SIRET)/g' | \
|
|
sed 's/0406952018/$(SIRET)/g' | \
|
|
sed 's/<CompanyId>34/<CompanyId>$(SIRET)/g' | \
|
|
sed 's/<con:value>BE/<con:value>FR/g' | \
|
|
sed 's/<con:value>NL/<con:value>FR/g' | \
|
|
sed 's/<con:value>nl/<con:value>fr/g' | \
|
|
sed 's/<LanguageCode>nl/<LanguageCode>fr/g' | \
|
|
sed "s/'Chamber/\"Chamber/" | \
|
|
cat > soapui-test-suite.xml
|
|
|
|
.PHONY: tables
|
|
tables:
|
|
mysql -e "show databases" | grep "giant" >/dev/null || \
|
|
mysql -e "create database giant"
|
|
mysql giant < orders.sql
|
|
mysql giant < monitors.sql
|
|
|
|
.PHONY: doctrine
|
|
doctrine:
|
|
php generateDoctrine.php $(PROJET) $(MODELES)
|
|
|
|
.PHONY: crontab
|
|
crontab:
|
|
@echo -e "MAILTO=$(COURRIEL)\n00 13 * * * $(PHP_UI)" > /tmp/crontab.tmp
|
|
@crontab /tmp/crontab.tmp
|
|
@rm /tmp/crontab.tmp
|
|
@crontab -l
|
|
$(if $(shell /etc/rc.d/init.d/crond status | grep pid), , \
|
|
@echo -e "\na faire: 'sudo chkconfig crond on ; \
|
|
sudo /etc/rc.d/init.d/crond start'\n")
|
|
|
|
.PHONY: clean-wsdl
|
|
clean-wsdl:
|
|
find schema -name \*.xsd -exec rm {} \;
|
|
rm -f wsdl/*.wsdl
|
|
|
|
.PHONY: clean-orders
|
|
clean-orders:
|
|
mysql giant -e "truncate table orders"
|
|
|
|
.PHONY: clean-monitors
|
|
clean-monitors:
|
|
mysql giant -e "truncate table monitors"
|
|
|
|
.PHONY: tar
|
|
tar:
|
|
@tar cvzf $(PROJET).tgz $(SOURCES)
|
|
|
|
.PHONY: tests
|
|
tests: $(TESTS1) $(TESTS2) $(TESTS3) $(TESTS4)
|
|
@$(foreach t, $(TESTS1) $(TESTS2) $(TESTS3) $(TESTS4), \
|
|
$(if $(wildcard $(TPRE)$(t).ref), \
|
|
echo diff $(TPRE)$(t).ref $(TPRE)$(t).txt; \
|
|
diff $(TPRE)$(t).ref $(TPRE)$(t).txt \
|
|
-I Time -I Date] -I ProviderOrderId;, \
|
|
echo cp $(TPRE)$(t).txt $(TPRE)$(t).ref; \
|
|
cp $(TPRE)$(t).txt $(TPRE)$(t).ref; ))
|
|
|
|
.PHONY: $(TESTS1)
|
|
$(TESTS1):
|
|
$(PHP_CD) CompanyId=$(SIRET) action=$@ > $(TPRE)$@.txt
|
|
|
|
.PHONY: $(TESTS2)
|
|
$(TESTS2):
|
|
$(PHP_CD) ProviderOrderId=$(O_ID) action=$@ > $(TPRE)$@.txt
|
|
|
|
.PHONY: $(TESTS3)
|
|
$(TESTS3):
|
|
$(PHP_CD) ProviderOrderId=$(M_ID) action=$@ > $(TPRE)$@.txt
|
|
|
|
.PHONY: $(TESTS4)
|
|
$(TESTS4):
|
|
$(PHP_ME) ProviderOrderId=$(M_ID) > $(TPRE)$@.txt
|
|
|
|
.PHONY: $(TESTS_UNITAIRES)
|
|
$(TESTS_UNITAIRES):
|
|
@make --no-print-directory $(subst test-, , $@)
|
|
$(if $(wildcard $(TDIR)/$@.ref), \
|
|
diff $(TDIR)/$@.ref $(TDIR)/$@.txt \
|
|
-I Time -I Date] -I ProviderOrderId, \
|
|
cp $(TDIR)/$@.txt $(TDIR)/$@.ref )
|
|
|
|
.PHONY: clean-tests
|
|
clean-tests:
|
|
@$(foreach t, $(TESTS_UNITAIRES), \
|
|
echo rm -f $(TDIR)/$(t).ref; \
|
|
echo rm -f $(TDIR)/$(t).txt; \
|
|
rm -f $(TDIR)/$(t).ref \
|
|
$(TDIR)/$(t).txt; )
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
@$(foreach t, $(TESTS_UNITAIRES), \
|
|
echo rm -f $(TDIR)/$(t).txt; \
|
|
rm -f $(TDIR)/$(t).txt; )
|
|
@find . -name \*~ -exec rm {} \;
|