ItEr50S13AdaptacionServiciosRESTItEr49S18: Creating web service for export CalendarExceptionType entities.
This commit is contained in:
parent
05a7434501
commit
2563ba73c6
15 changed files with 463 additions and 7 deletions
|
|
@ -25,7 +25,7 @@ import java.util.List;
|
|||
import org.hibernate.Criteria;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.navalplanner.business.calendars.entities.CalendarExceptionType;
|
||||
import org.navalplanner.business.common.daos.GenericDAOHibernate;
|
||||
import org.navalplanner.business.common.daos.IntegrationEntityDAO;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
|
@ -38,7 +38,7 @@ import org.springframework.stereotype.Repository;
|
|||
@Repository
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
public class CalendarExceptionTypeDAO extends
|
||||
GenericDAOHibernate<CalendarExceptionType, Long> implements
|
||||
IntegrationEntityDAO<CalendarExceptionType> implements
|
||||
ICalendarExceptionTypeDAO {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
package org.navalplanner.business.calendars.daos;
|
||||
|
||||
import org.navalplanner.business.calendars.entities.CalendarExceptionType;
|
||||
import org.navalplanner.business.common.daos.IGenericDAO;
|
||||
import org.navalplanner.business.common.daos.IIntegrationEntityDAO;
|
||||
|
||||
/**
|
||||
* Contract for {@link CalendarExceptionTypeDAO}
|
||||
|
|
@ -29,7 +29,7 @@ import org.navalplanner.business.common.daos.IGenericDAO;
|
|||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
public interface ICalendarExceptionTypeDAO extends
|
||||
IGenericDAO<CalendarExceptionType, Long> {
|
||||
IIntegrationEntityDAO<CalendarExceptionType> {
|
||||
|
||||
boolean existsByName(CalendarExceptionType type);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,14 +21,16 @@
|
|||
package org.navalplanner.business.calendars.entities;
|
||||
|
||||
import org.apache.commons.lang.BooleanUtils;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.calendars.daos.ICalendarExceptionTypeDAO;
|
||||
import org.navalplanner.business.common.IntegrationEntity;
|
||||
import org.navalplanner.business.common.Registry;
|
||||
|
||||
/**
|
||||
* Type of an exception day.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
public class CalendarExceptionType extends BaseEntity {
|
||||
public class CalendarExceptionType extends IntegrationEntity {
|
||||
|
||||
public static CalendarExceptionType create(String name, String color,
|
||||
Boolean notAssignable) {
|
||||
|
|
@ -69,4 +71,9 @@ public class CalendarExceptionType extends BaseEntity {
|
|||
public boolean isOverAssignable() {
|
||||
return BooleanUtils.isFalse(notAssignable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ICalendarExceptionTypeDAO getIntegrationEntityDAO() {
|
||||
return Registry.getCalendarExceptionTypeDAO();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ package org.navalplanner.business.common;
|
|||
|
||||
import org.navalplanner.business.advance.daos.IAdvanceTypeDAO;
|
||||
import org.navalplanner.business.calendars.daos.IBaseCalendarDAO;
|
||||
import org.navalplanner.business.calendars.daos.ICalendarExceptionTypeDAO;
|
||||
import org.navalplanner.business.common.daos.IConfigurationDAO;
|
||||
import org.navalplanner.business.costcategories.daos.ICostCategoryDAO;
|
||||
import org.navalplanner.business.costcategories.daos.IHourCostDAO;
|
||||
|
|
@ -153,6 +154,9 @@ public class Registry {
|
|||
@Autowired
|
||||
private IHourCostDAO hourCostDAO;
|
||||
|
||||
@Autowired
|
||||
private ICalendarExceptionTypeDAO calendarExceptionTypeDAO;
|
||||
|
||||
private Registry() {
|
||||
}
|
||||
|
||||
|
|
@ -273,4 +277,9 @@ public class Registry {
|
|||
public static IHourCostDAO getHourCostDAO() {
|
||||
return getInstance().hourCostDAO;
|
||||
}
|
||||
}
|
||||
|
||||
public static ICalendarExceptionTypeDAO getCalendarExceptionTypeDAO() {
|
||||
return getInstance().calendarExceptionTypeDAO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -66,6 +66,8 @@
|
|||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="code" access="property" not-null="true" unique="true"/>
|
||||
|
||||
<property name="name" access="field" unique="true" />
|
||||
<property name="color" access="field"/>
|
||||
<property name="notAssignable" access="field"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.ws.calendarexceptiontypes.api;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
import org.navalplanner.business.calendars.entities.CalendarExceptionType;
|
||||
import org.navalplanner.ws.common.api.IntegrationEntityDTO;
|
||||
|
||||
/**
|
||||
* DTO for {@link CalendarExceptionType} entity.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
public class CalendarExceptionTypeDTO extends IntegrationEntityDTO {
|
||||
|
||||
public final static String ENTITY_TYPE = "calendar-exception-type";
|
||||
|
||||
@XmlAttribute
|
||||
public String name;
|
||||
|
||||
@XmlAttribute
|
||||
public String color;
|
||||
|
||||
@XmlAttribute(name = "over-assignable")
|
||||
public boolean overAssignable;
|
||||
|
||||
public CalendarExceptionTypeDTO() {
|
||||
}
|
||||
|
||||
public CalendarExceptionTypeDTO(String code, String name, String color,
|
||||
boolean overAssignable) {
|
||||
super(code);
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.overAssignable = overAssignable;
|
||||
}
|
||||
|
||||
public CalendarExceptionTypeDTO(String name, String color,
|
||||
boolean overAssignable) {
|
||||
this(generateCode(), name, color, overAssignable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityType() {
|
||||
return ENTITY_TYPE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.ws.calendarexceptiontypes.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.navalplanner.business.calendars.entities.CalendarExceptionType;
|
||||
|
||||
/**
|
||||
* DTO for {@link CalendarExceptionType} entity.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
@XmlRootElement(name = "calendar-exception-type-list")
|
||||
public class CalendarExceptionTypeListDTO {
|
||||
|
||||
@XmlElement(name = "calendar-exception-type")
|
||||
public List<CalendarExceptionTypeDTO> calendarExceptionTypes = new ArrayList<CalendarExceptionTypeDTO>();
|
||||
|
||||
public CalendarExceptionTypeListDTO() {
|
||||
}
|
||||
|
||||
public CalendarExceptionTypeListDTO(
|
||||
List<CalendarExceptionTypeDTO> calendarExceptionTypes) {
|
||||
this.calendarExceptionTypes = calendarExceptionTypes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.ws.calendarexceptiontypes.api;
|
||||
|
||||
import org.navalplanner.business.calendars.entities.CalendarExceptionType;
|
||||
|
||||
/**
|
||||
* Service for managing {@link CalendarExceptionType} entities.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
public interface ICalendarExceptionTypeService {
|
||||
|
||||
CalendarExceptionTypeListDTO getCalendarExceptionType();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specification of namespace for REST-based services.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
@javax.xml.bind.annotation.XmlSchema(elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED, namespace = WSCommonGlobalNames.REST_NAMESPACE)
|
||||
package org.navalplanner.ws.calendarexceptiontypes.api;
|
||||
|
||||
import org.navalplanner.ws.common.api.WSCommonGlobalNames;
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.ws.calendarexceptiontypes.impl;
|
||||
|
||||
import org.navalplanner.business.calendars.entities.CalendarExceptionType;
|
||||
import org.navalplanner.ws.calendarexceptiontypes.api.CalendarExceptionTypeDTO;
|
||||
|
||||
/**
|
||||
* Converter from/to {@link CalendarExceptionType} related entities to/from
|
||||
* DTOs.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
public final class CalendarExceptionTypeConverter {
|
||||
|
||||
private CalendarExceptionTypeConverter() {
|
||||
}
|
||||
|
||||
public final static CalendarExceptionTypeDTO toDTO(
|
||||
CalendarExceptionType calendarExceptionType) {
|
||||
return new CalendarExceptionTypeDTO(calendarExceptionType.getCode(),
|
||||
calendarExceptionType.getName(), calendarExceptionType
|
||||
.getColor(), calendarExceptionType.isOverAssignable());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.ws.calendarexceptiontypes.impl;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.navalplanner.business.calendars.daos.ICalendarExceptionTypeDAO;
|
||||
import org.navalplanner.business.calendars.entities.CalendarExceptionType;
|
||||
import org.navalplanner.business.common.daos.IIntegrationEntityDAO;
|
||||
import org.navalplanner.business.common.exceptions.ValidationException;
|
||||
import org.navalplanner.ws.calendarexceptiontypes.api.CalendarExceptionTypeDTO;
|
||||
import org.navalplanner.ws.calendarexceptiontypes.api.CalendarExceptionTypeListDTO;
|
||||
import org.navalplanner.ws.calendarexceptiontypes.api.ICalendarExceptionTypeService;
|
||||
import org.navalplanner.ws.common.impl.GenericRESTService;
|
||||
import org.navalplanner.ws.common.impl.RecoverableErrorException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* REST-based implementation of {@link ICalendarExceptionTypeService}.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
@Path("/calendarexceptiontypes/")
|
||||
@Produces("application/xml")
|
||||
@Service("calendarExceptionTypeServiceREST")
|
||||
public class CalendarExceptionTypeServiceREST extends
|
||||
GenericRESTService<CalendarExceptionType, CalendarExceptionTypeDTO>
|
||||
implements
|
||||
ICalendarExceptionTypeService {
|
||||
|
||||
@Autowired
|
||||
private ICalendarExceptionTypeDAO calendarExceptionTypeDAO;
|
||||
|
||||
@Override
|
||||
protected IIntegrationEntityDAO<CalendarExceptionType> getIntegrationEntityDAO() {
|
||||
return calendarExceptionTypeDAO;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CalendarExceptionTypeDTO toDTO(CalendarExceptionType entity) {
|
||||
return CalendarExceptionTypeConverter.toDTO(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CalendarExceptionType toEntity(CalendarExceptionTypeDTO entityDTO)
|
||||
throws ValidationException, RecoverableErrorException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEntity(CalendarExceptionType entity,
|
||||
CalendarExceptionTypeDTO entityDTO) throws ValidationException,
|
||||
RecoverableErrorException {
|
||||
}
|
||||
|
||||
@Override
|
||||
@GET
|
||||
@Transactional(readOnly = true)
|
||||
public CalendarExceptionTypeListDTO getCalendarExceptionType() {
|
||||
return new CalendarExceptionTypeListDTO(findAll());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -67,6 +67,7 @@
|
|||
<ref bean="labelServiceREST"/>
|
||||
<ref bean="costCategoryServiceREST"/>
|
||||
<ref bean="typeOfWorkHoursServiceREST"/>
|
||||
<ref bean="calendarExceptionTypeServiceREST"/>
|
||||
</jaxrs:serviceBeans>
|
||||
<jaxrs:providers>
|
||||
<ref bean="runtimeExceptionMapper" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.web.test.ws.calendarexceptiontypes.api;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.navalplanner.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE;
|
||||
import static org.navalplanner.web.WebappGlobalNames.WEBAPP_SPRING_CONFIG_FILE;
|
||||
import static org.navalplanner.web.test.WebappGlobalNames.WEBAPP_SPRING_CONFIG_TEST_FILE;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.navalplanner.business.calendars.daos.ICalendarExceptionTypeDAO;
|
||||
import org.navalplanner.business.calendars.entities.CalendarExceptionType;
|
||||
import org.navalplanner.ws.calendarexceptiontypes.api.CalendarExceptionTypeDTO;
|
||||
import org.navalplanner.ws.calendarexceptiontypes.api.CalendarExceptionTypeListDTO;
|
||||
import org.navalplanner.ws.calendarexceptiontypes.api.ICalendarExceptionTypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* Tests for {@link ICalendarExceptionTypeService}.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { BUSINESS_SPRING_CONFIG_FILE,
|
||||
WEBAPP_SPRING_CONFIG_FILE, WEBAPP_SPRING_CONFIG_TEST_FILE })
|
||||
@Transactional
|
||||
public class CalendarExceptionTypeServiceTest {
|
||||
|
||||
@Autowired
|
||||
private ICalendarExceptionTypeService calendarExceptionTypeService;
|
||||
|
||||
@Autowired
|
||||
private ICalendarExceptionTypeDAO calendarExceptionTypeDAO;
|
||||
|
||||
@Autowired
|
||||
private SessionFactory sessionFactory;
|
||||
|
||||
private CalendarExceptionType givenCalendarExceptionTypeStored() {
|
||||
CalendarExceptionType calendarExceptionType = CalendarExceptionType
|
||||
.create("name", "color", false);
|
||||
|
||||
calendarExceptionTypeDAO.save(calendarExceptionType);
|
||||
calendarExceptionTypeDAO.flush();
|
||||
sessionFactory.getCurrentSession().evict(calendarExceptionType);
|
||||
calendarExceptionType.dontPoseAsTransientObjectAnymore();
|
||||
|
||||
return calendarExceptionType;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exportLabelTypes() {
|
||||
CalendarExceptionTypeListDTO list = calendarExceptionTypeService
|
||||
.getCalendarExceptionType();
|
||||
assertTrue(list.calendarExceptionTypes.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exportLabelTypes2() {
|
||||
CalendarExceptionType calendarExceptionType = givenCalendarExceptionTypeStored();
|
||||
|
||||
CalendarExceptionTypeListDTO list = calendarExceptionTypeService
|
||||
.getCalendarExceptionType();
|
||||
assertThat(list.calendarExceptionTypes.size(), equalTo(1));
|
||||
|
||||
CalendarExceptionTypeDTO calendarExceptionTypeDTO = list.calendarExceptionTypes
|
||||
.get(0);
|
||||
assertThat(calendarExceptionTypeDTO.code, equalTo(calendarExceptionType
|
||||
.getCode()));
|
||||
assertThat(calendarExceptionTypeDTO.name, equalTo(calendarExceptionType
|
||||
.getName()));
|
||||
assertThat(calendarExceptionTypeDTO.color,
|
||||
equalTo(calendarExceptionType.getColor()));
|
||||
assertThat(calendarExceptionTypeDTO.overAssignable,
|
||||
equalTo(calendarExceptionType.isOverAssignable()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -84,6 +84,10 @@
|
|||
- export-resources-hours.sh 21654685 2010-01-01 2010-12-31 (authenticate
|
||||
with wsreader/wsreader)
|
||||
|
||||
* Export calendar exception types:
|
||||
|
||||
- export-calendar-exception-types.sh (authenticate with wsreader/wsreader)
|
||||
|
||||
+ When working with the online demo add "--prod" argument to every command.
|
||||
Example:
|
||||
|
||||
|
|
|
|||
21
scripts/rest-clients/export-calendar-exception-types.sh
Executable file
21
scripts/rest-clients/export-calendar-exception-types.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./rest-common-env.sh
|
||||
|
||||
printf "Login name: "
|
||||
read loginName
|
||||
printf "Password: "
|
||||
read password
|
||||
|
||||
if [ "$1" = "--prod" ]; then
|
||||
baseServiceURL=$PRODUCTION_BASE_SERVICE_URL
|
||||
certificate=$PRODUCTION_CERTIFICATE
|
||||
else
|
||||
baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL
|
||||
certificate=$DEVELOPMENT_CERTIFICATE
|
||||
fi
|
||||
|
||||
authorization=`./base64.sh $loginName:$password`
|
||||
|
||||
curl -sv -X GET $certificate --header "Authorization: Basic $authorization" \
|
||||
$baseServiceURL/calendarexceptiontypes | tidy -xml -i -q -utf8
|
||||
Loading…
Add table
Reference in a new issue