Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
3da14c8c
Commit
3da14c8c
authored
Jul 07, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
cd4e4759
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
46 additions
and
90 deletions
+46
-90
AppControllerTest.java
...ork/apollo/adminservice/controller/AppControllerTest.java
+8
-24
AppNamespaceControllerTest.java
...o/adminservice/controller/AppNamespaceControllerTest.java
+1
-0
ControllerExceptionTest.java
...ollo/adminservice/controller/ControllerExceptionTest.java
+1
-1
AppNamespaceService.java
...rip/framework/apollo/biz/service/AppNamespaceService.java
+1
-1
Validator.java
...ava/com/ctrip/framework/apollo/biz/service/Validator.java
+0
-23
AppNamespace.java
...om/ctrip/framework/apollo/common/entity/AppNamespace.java
+1
-2
InputValidator.java
...m/ctrip/framework/apollo/common/utils/InputValidator.java
+1
-1
ConfigController.java
...ork/apollo/configservice/controller/ConfigController.java
+1
-1
NotificationController.java
...ollo/configservice/controller/NotificationController.java
+1
-1
ConfigControllerTest.java
...apollo/configservice/controller/ConfigControllerTest.java
+5
-5
NotificationControllerTest.java
.../configservice/controller/NotificationControllerTest.java
+4
-4
ConfigConsts.java
...in/java/com/ctrip/framework/apollo/core/ConfigConsts.java
+1
-1
AppNamespaceDTO.java
.../com/ctrip/framework/apollo/core/dto/AppNamespaceDTO.java
+0
-6
ConfigFileFormat.java
...m/ctrip/framework/apollo/core/enums/ConfigFileFormat.java
+5
-0
NamespaceController.java
...amework/apollo/portal/controller/NamespaceController.java
+1
-1
AppNamespaceRepository.java
...work/apollo/portal/repository/AppNamespaceRepository.java
+1
-3
AppNamespaceService.java
.../framework/apollo/portal/service/AppNamespaceService.java
+12
-14
FileTextResolver.java
...k/apollo/portal/service/txtresolver/FileTextResolver.java
+1
-1
cluster.png
apollo-portal/src/main/resources/static/img/cluster.png
+0
-0
namespace.html
apollo-portal/src/main/resources/static/namespace.html
+1
-1
No files found.
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppControllerTest.java
View file @
3da14c8c
...
...
@@ -24,6 +24,7 @@ public class AppControllerTest extends AbstractControllerTest {
}
@Test
@Sql
(
scripts
=
"/controller/cleanup.sql"
,
executionPhase
=
ExecutionPhase
.
AFTER_TEST_METHOD
)
public
void
testCheckIfAppIdUnique
()
{
AppDTO
dto
=
generateSampleDTOData
();
ResponseEntity
<
AppDTO
>
response
=
...
...
@@ -72,16 +73,12 @@ public class AppControllerTest extends AbstractControllerTest {
Assert
.
assertEquals
(
dto
.
getAppId
(),
savedApp
.
getAppId
());
Assert
.
assertNotNull
(
savedApp
.
getDataChangeCreatedTime
());
response
=
restTemplate
.
postForEntity
(
getBaseAppUrl
(),
dto
,
AppDTO
.
class
);
AppDTO
second
=
response
.
getBody
(
);
Assert
.
assertEquals
(
HttpStatus
.
OK
,
response
.
getStatusCode
());
Assert
.
assertEquals
(
dto
.
getAppId
(),
second
.
getAppId
());
Assert
.
assertEquals
(
first
.
getId
(),
second
.
getId
());
try
{
restTemplate
.
postForEntity
(
getBaseAppUrl
(),
dto
,
AppDTO
.
class
);
}
catch
(
HttpClientErrorException
e
){
Assert
.
assertEquals
(
HttpStatus
.
BAD_REQUEST
,
e
.
getStatusCode
());
}
savedApp
=
appRepository
.
findOne
(
second
.
getId
());
Assert
.
assertEquals
(
dto
.
getAppId
(),
savedApp
.
getAppId
());
Assert
.
assertNotNull
(
savedApp
.
getDataChangeCreatedTime
());
Assert
.
assertNotNull
(
savedApp
.
getDataChangeLastModifiedTime
());
}
@Test
...
...
@@ -115,27 +112,14 @@ public class AppControllerTest extends AbstractControllerTest {
Assert
.
assertNull
(
deletedApp
);
}
@Test
@Sql
(
scripts
=
"/controller/cleanup.sql"
,
executionPhase
=
ExecutionPhase
.
AFTER_TEST_METHOD
)
public
void
testUpdate
()
{
AppDTO
dto
=
generateSampleDTOData
();
App
app
=
BeanUtils
.
transfrom
(
App
.
class
,
dto
);
app
=
appRepository
.
save
(
app
);
dto
.
setName
(
"newName"
);
restTemplate
.
postForObject
(
getBaseAppUrl
(),
dto
,
AppDTO
.
class
);
App
updatedApp
=
appRepository
.
findOne
(
app
.
getId
());
Assert
.
assertEquals
(
dto
.
getName
(),
updatedApp
.
getName
());
Assert
.
assertNotNull
(
updatedApp
.
getDataChangeLastModifiedTime
());
}
private
AppDTO
generateSampleDTOData
()
{
AppDTO
dto
=
new
AppDTO
();
dto
.
setAppId
(
"someAppId"
);
dto
.
setName
(
"someName"
);
dto
.
setOwnerName
(
"someOwner"
);
dto
.
setOwnerEmail
(
"someOwner@ctrip.com"
);
dto
.
setDataChangeCreatedBy
(
"apollo"
);
dto
.
setDataChangeLastModifiedBy
(
"apollo"
);
return
dto
;
}
}
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceControllerTest.java
View file @
3da14c8c
...
...
@@ -24,6 +24,7 @@ public class AppNamespaceControllerTest extends AbstractControllerTest{
dto
.
setAppId
(
appId
);
dto
.
setName
(
name
);
dto
.
setComment
(
comment
);
dto
.
setDataChangeCreatedBy
(
"apollo"
);
AppNamespaceDTO
resultDto
=
restTemplate
.
postForEntity
(
String
.
format
(
"http://localhost:%d/apps/%s/appnamespaces"
,
port
,
appId
),
dto
,
AppNamespaceDTO
.
class
).
getBody
();
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerExceptionTest.java
View file @
3da14c8c
...
...
@@ -82,7 +82,7 @@ public class ControllerExceptionTest {
when
(
adminService
.
createNewApp
(
any
(
App
.
class
)))
.
thenThrow
(
new
ServiceException
(
"create app failed"
));
appController
.
create
OrUpdate
(
dto
);
appController
.
create
(
dto
);
}
private
AppDTO
generateSampleDTOData
()
{
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppNamespaceService.java
View file @
3da14c8c
...
...
@@ -37,7 +37,7 @@ public class AppNamespaceService {
return
Objects
.
isNull
(
appNamespaceRepository
.
findByAppIdAndName
(
appId
,
namespaceName
));
}
public
AppNamespace
findPublic
ByNamespace
Name
(
String
namespaceName
)
{
public
AppNamespace
findPublic
NamespaceBy
Name
(
String
namespaceName
)
{
Preconditions
.
checkArgument
(
namespaceName
!=
null
,
"Namespace must not be null"
);
return
appNamespaceRepository
.
findByNameAndIsPublicTrue
(
namespaceName
);
}
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/Validator.java
deleted
100644 → 0
View file @
cd4e4759
package
com
.
ctrip
.
framework
.
apollo
.
biz
.
service
;
import
com.ctrip.framework.apollo.core.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
@Component
public
class
Validator
{
@Autowired
private
ServerConfigService
serverConfigService
;
public
boolean
checkItemValueLength
(
String
value
){
int
lengthLimit
=
Integer
.
valueOf
(
serverConfigService
.
getValue
(
"item.value.length.limit"
,
"65536"
));
if
(!
StringUtils
.
isEmpty
(
value
)
&&
value
.
length
()
>
lengthLimit
){
throw
new
BadRequestException
(
"value too long. length limit:"
+
lengthLimit
);
}
return
true
;
}
}
apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/AppNamespace.java
View file @
3da14c8c
...
...
@@ -3,7 +3,6 @@ package com.ctrip.framework.apollo.common.entity;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
org.bouncycastle.util.Strings
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.Where
;
...
...
@@ -64,7 +63,7 @@ public class AppNamespace extends BaseEntity {
isPublic
=
aPublic
;
}
public
ConfigFileFormat
getF
ormatAsEnum
()
{
public
ConfigFileFormat
f
ormatAsEnum
()
{
return
ConfigFileFormat
.
fromString
(
this
.
format
);
}
...
...
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/InputValidator.java
View file @
3da14c8c
...
...
@@ -10,7 +10,7 @@ import java.util.regex.Pattern;
*/
public
class
InputValidator
{
public
static
final
String
INVALID_CLUSTER_NAMESPACE_MESSAGE
=
"只允许输入数字,字母和符号 - _ ."
;
public
static
final
String
INVALID_NAMESPACE_NAMESPACE_MESSAGE
=
"不允许以.json
|.yml|.yaml|.xml|
.properties结尾"
;
public
static
final
String
INVALID_NAMESPACE_NAMESPACE_MESSAGE
=
"不允许以.json
, .yml, .yaml, .xml,
.properties结尾"
;
public
static
final
String
CLUSTER_NAMESPACE_VALIDATOR
=
"[0-9a-zA-z_.-]+"
;
public
static
final
String
APP_NAMESPACE_VALIDATOR
=
"[a-zA-z0-9._-]+(?<!\\.(json|yml|yaml|xml|properties))$"
;
private
static
final
Pattern
CLUSTER_NAMESPACE_PATTERN
=
...
...
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/ConfigController.java
View file @
3da14c8c
...
...
@@ -127,7 +127,7 @@ public class ConfigController {
* @param dataCenter the datacenter
*/
private
Release
findPublicConfig
(
String
applicationId
,
String
clusterName
,
String
namespace
,
String
dataCenter
)
{
AppNamespace
appNamespace
=
appNamespaceService
.
findPublic
ByNamespace
Name
(
namespace
);
AppNamespace
appNamespace
=
appNamespaceService
.
findPublic
NamespaceBy
Name
(
namespace
);
//check whether the namespace's appId equals to current one
if
(
Objects
.
isNull
(
appNamespace
)
||
Objects
.
equals
(
applicationId
,
appNamespace
.
getAppId
()))
{
...
...
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/NotificationController.java
View file @
3da14c8c
...
...
@@ -131,7 +131,7 @@ public class NotificationController implements ReleaseMessageListener {
private
Set
<
String
>
findPublicConfigWatchKey
(
String
applicationId
,
String
clusterName
,
String
namespace
,
String
dataCenter
)
{
AppNamespace
appNamespace
=
appNamespaceService
.
findPublic
ByNamespace
Name
(
namespace
);
AppNamespace
appNamespace
=
appNamespaceService
.
findPublic
NamespaceBy
Name
(
namespace
);
//check whether the namespace's appId equals to current one
if
(
Objects
.
isNull
(
appNamespace
)
||
Objects
.
equals
(
applicationId
,
appNamespace
.
getAppId
()))
{
...
...
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/ConfigControllerTest.java
View file @
3da14c8c
...
...
@@ -247,7 +247,7 @@ public class ConfigControllerTest {
when
(
configService
.
findRelease
(
someAppId
,
someClusterName
,
someAppOwnNamespaceName
))
.
thenReturn
(
someRelease
);
when
(
appNamespaceService
.
findPublic
ByNamespace
Name
(
someAppOwnNamespaceName
))
when
(
appNamespaceService
.
findPublic
NamespaceBy
Name
(
someAppOwnNamespaceName
))
.
thenReturn
(
someAppOwnNamespace
);
when
(
someRelease
.
getReleaseKey
()).
thenReturn
(
someServerSideReleaseKey
);
when
(
namespaceUtil
.
filterNamespaceName
(
someAppOwnNamespaceName
))
...
...
@@ -276,7 +276,7 @@ public class ConfigControllerTest {
when
(
configService
.
findRelease
(
someAppId
,
someClusterName
,
somePublicNamespaceName
))
.
thenReturn
(
null
);
when
(
appNamespaceService
.
findPublic
ByNamespace
Name
(
somePublicNamespaceName
))
when
(
appNamespaceService
.
findPublic
NamespaceBy
Name
(
somePublicNamespaceName
))
.
thenReturn
(
somePublicAppNamespace
);
when
(
configService
.
findRelease
(
somePublicAppId
,
someDataCenter
,
somePublicNamespaceName
))
.
thenReturn
(
somePublicRelease
);
...
...
@@ -305,7 +305,7 @@ public class ConfigControllerTest {
when
(
configService
.
findRelease
(
someAppId
,
someClusterName
,
somePublicNamespaceName
))
.
thenReturn
(
null
);
when
(
appNamespaceService
.
findPublic
ByNamespace
Name
(
somePublicNamespaceName
))
when
(
appNamespaceService
.
findPublic
NamespaceBy
Name
(
somePublicNamespaceName
))
.
thenReturn
(
somePublicAppNamespace
);
when
(
configService
.
findRelease
(
somePublicAppId
,
someDataCenter
,
somePublicNamespaceName
))
.
thenReturn
(
somePublicRelease
);
...
...
@@ -335,7 +335,7 @@ public class ConfigControllerTest {
when
(
configService
.
findRelease
(
someAppId
,
someClusterName
,
somePublicNamespaceName
))
.
thenReturn
(
null
);
when
(
appNamespaceService
.
findPublic
ByNamespace
Name
(
somePublicNamespaceName
))
when
(
appNamespaceService
.
findPublic
NamespaceBy
Name
(
somePublicNamespaceName
))
.
thenReturn
(
somePublicAppNamespace
);
when
(
configService
.
findRelease
(
somePublicAppId
,
someDataCenter
,
somePublicNamespaceName
))
.
thenReturn
(
null
);
...
...
@@ -373,7 +373,7 @@ public class ConfigControllerTest {
when
(
configService
.
findRelease
(
someAppId
,
someClusterName
,
somePublicNamespaceName
))
.
thenReturn
(
someRelease
);
when
(
someRelease
.
getReleaseKey
()).
thenReturn
(
someAppSideReleaseKey
);
when
(
appNamespaceService
.
findPublic
ByNamespace
Name
(
somePublicNamespaceName
))
when
(
appNamespaceService
.
findPublic
NamespaceBy
Name
(
somePublicNamespaceName
))
.
thenReturn
(
somePublicAppNamespace
);
when
(
configService
.
findRelease
(
somePublicAppId
,
someDataCenter
,
somePublicNamespaceName
))
.
thenReturn
(
somePublicRelease
);
...
...
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/NotificationControllerTest.java
View file @
3da14c8c
...
...
@@ -221,7 +221,7 @@ public class NotificationControllerTest {
AppNamespace
somePublicAppNamespace
=
assmbleAppNamespace
(
somePublicAppId
,
somePublicNamespace
);
when
(
appNamespaceService
.
findPublic
ByNamespace
Name
(
somePublicNamespace
))
when
(
appNamespaceService
.
findPublic
NamespaceBy
Name
(
somePublicNamespace
))
.
thenReturn
(
somePublicAppNamespace
);
DeferredResult
<
ResponseEntity
<
ApolloConfigNotification
>>
...
...
@@ -258,7 +258,7 @@ public class NotificationControllerTest {
when
(
namespaceUtil
.
filterNamespaceName
(
somePublicNamespaceAsFile
))
.
thenReturn
(
somePublicNamespace
);
when
(
appNamespaceService
.
findPublic
ByNamespace
Name
(
somePublicNamespace
))
when
(
appNamespaceService
.
findPublic
NamespaceBy
Name
(
somePublicNamespace
))
.
thenReturn
(
somePublicAppNamespace
);
when
(
appNamespaceService
.
findOne
(
someAppId
,
somePublicNamespace
)).
thenReturn
(
null
);
...
...
@@ -302,7 +302,7 @@ public class NotificationControllerTest {
AppNamespace
somePublicAppNamespace
=
assmbleAppNamespace
(
somePublicAppId
,
somePublicNamespace
);
when
(
appNamespaceService
.
findPublic
ByNamespace
Name
(
somePublicNamespace
))
when
(
appNamespaceService
.
findPublic
NamespaceBy
Name
(
somePublicNamespace
))
.
thenReturn
(
somePublicAppNamespace
);
DeferredResult
<
ResponseEntity
<
ApolloConfigNotification
>>
...
...
@@ -349,7 +349,7 @@ public class NotificationControllerTest {
AppNamespace
somePublicAppNamespace
=
assmbleAppNamespace
(
somePublicAppId
,
somePublicNamespace
);
when
(
appNamespaceService
.
findPublic
ByNamespace
Name
(
somePublicNamespace
))
when
(
appNamespaceService
.
findPublic
NamespaceBy
Name
(
somePublicNamespace
))
.
thenReturn
(
somePublicAppNamespace
);
DeferredResult
<
ResponseEntity
<
ApolloConfigNotification
>>
...
...
apollo-core/src/main/java/com/ctrip/framework/apollo/core/ConfigConsts.java
View file @
3da14c8c
...
...
@@ -5,5 +5,5 @@ public interface ConfigConsts {
String
CLUSTER_NAME_DEFAULT
=
"default"
;
String
CLUSTER_NAMESPACE_SEPARATOR
=
"+"
;
String
APOLLO_CLUSTER_KEY
=
"apollo.cluster"
;
String
FILE_NAMESPACE_KEY_NAME
=
"content"
;
String
CONFIG_FILE_CONTENT_KEY
=
"content"
;
}
apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/AppNamespaceDTO.java
View file @
3da14c8c
package
com
.
ctrip
.
framework
.
apollo
.
core
.
dto
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
public
class
AppNamespaceDTO
extends
BaseDTO
{
private
long
id
;
...
...
@@ -40,10 +38,6 @@ public class AppNamespaceDTO extends BaseDTO{
this
.
appId
=
appId
;
}
public
ConfigFileFormat
getFormatAsEnum
()
{
return
ConfigFileFormat
.
fromString
(
this
.
format
);
}
public
String
getFormat
()
{
return
format
;
}
...
...
apollo-core/src/main/java/com/ctrip/framework/apollo/core/enums/ConfigFileFormat.java
View file @
3da14c8c
package
com
.
ctrip
.
framework
.
apollo
.
core
.
enums
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
/**
* @author Jason Song(song_s@ctrip.com)
*/
...
...
@@ -17,6 +19,9 @@ public enum ConfigFileFormat {
}
public
static
ConfigFileFormat
fromString
(
String
value
){
if
(
StringUtils
.
isEmpty
(
value
)){
throw
new
IllegalArgumentException
(
"value can not be empty"
);
}
switch
(
value
){
case
"properties"
:
return
Properties
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java
View file @
3da14c8c
...
...
@@ -91,7 +91,7 @@ public class NamespaceController {
//add app org id as prefix
App
app
=
appService
.
load
(
appId
);
if
(
appNamespace
.
getF
ormatAsEnum
()
==
ConfigFileFormat
.
Properties
)
{
if
(
appNamespace
.
f
ormatAsEnum
()
==
ConfigFileFormat
.
Properties
)
{
appNamespace
.
setName
(
String
.
format
(
"%s.%s"
,
app
.
getOrgId
(),
appNamespace
.
getName
()));
}
else
{
appNamespace
.
setName
(
String
.
format
(
"%s.%s.%s"
,
app
.
getOrgId
(),
appNamespace
.
getName
(),
appNamespace
.
getFormat
()));
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/AppNamespaceRepository.java
View file @
3da14c8c
...
...
@@ -14,8 +14,6 @@ public interface AppNamespaceRepository extends PagingAndSortingRepository<AppNa
AppNamespace
findByNameAndIsPublic
(
String
namespaceName
,
boolean
isPublic
);
List
<
AppNamespace
>
findByNameNot
(
String
namespaceName
);
List
<
AppNamespace
>
findByNameNotAndIsPublic
(
String
namespaceName
,
boolean
isPublic
);
List
<
AppNamespace
>
findByIsPublicTrue
();
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java
View file @
3da14c8c
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
service
;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.core.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.exception.ServiceException
;
...
...
@@ -26,17 +25,16 @@ public class AppNamespaceService {
/**
* 公共的app ns,能被其它项目关联到的app ns
* @return
*/
public
List
<
AppNamespace
>
findPublicAppNamespaces
()
{
return
appNamespaceRepository
.
findBy
NameNotAndIsPublic
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
true
);
return
appNamespaceRepository
.
findBy
IsPublicTrue
(
);
}
public
AppNamespace
findPublicAppNamespace
(
String
namespaceName
){
public
AppNamespace
findPublicAppNamespace
(
String
namespaceName
)
{
return
appNamespaceRepository
.
findByNameAndIsPublic
(
namespaceName
,
true
);
}
public
AppNamespace
findByAppIdAndName
(
String
appId
,
String
namespaceName
){
public
AppNamespace
findByAppIdAndName
(
String
appId
,
String
namespaceName
)
{
return
appNamespaceRepository
.
findByAppIdAndName
(
appId
,
namespaceName
);
}
...
...
@@ -64,18 +62,18 @@ public class AppNamespaceService {
@Transactional
public
AppNamespace
createAppNamespaceInLocal
(
AppNamespace
appNamespace
)
{
//not unique
if
(
appNamespaceRepository
.
findByName
(
appNamespace
.
getName
())
!=
null
){
// unique check
if
(
appNamespace
.
isPublic
()
&&
appNamespaceRepository
.
findByNameAndIsPublic
(
appNamespace
.
getName
(),
true
)
!=
null
)
{
throw
new
BadRequestException
(
appNamespace
.
getName
()
+
"已存在"
);
}
AppNamespace
managedAppNamespace
=
appNamespaceRepository
.
findByAppIdAndName
(
appNamespace
.
getAppId
(),
appNamespace
.
getName
());
//update
if
(
managedAppNamespace
!=
null
){
BeanUtils
.
copyEntityProperties
(
appNamespace
,
managedAppNamespace
);
return
appNamespaceRepository
.
save
(
managedAppNamespace
);
}
else
{
return
appNamespaceRepository
.
save
(
appNamespace
);
if
(!
appNamespace
.
isPublic
()
&&
appNamespaceRepository
.
findByAppIdAndName
(
appNamespace
.
getAppId
(),
appNamespace
.
getName
())
!=
null
)
{
throw
new
BadRequestException
(
appNamespace
.
getName
()
+
"已存在"
);
}
return
appNamespaceRepository
.
save
(
appNamespace
);
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolver.java
View file @
3da14c8c
...
...
@@ -36,7 +36,7 @@ public class FileTextResolver implements ConfigTextResolver {
ItemDTO
item
=
new
ItemDTO
();
item
.
setNamespaceId
(
namespaceId
);
item
.
setValue
(
value
);
item
.
setKey
(
ConfigConsts
.
FILE_NAMESPACE_KEY_NAME
);
item
.
setKey
(
ConfigConsts
.
CONFIG_FILE_CONTENT_KEY
);
return
item
;
}
}
apollo-portal/src/main/resources/static/img/cluster.png
deleted
100644 → 0
View file @
cd4e4759
2.12 KB
apollo-portal/src/main/resources/static/namespace.html
View file @
3da14c8c
...
...
@@ -24,7 +24,7 @@
<div
class=
"row"
>
<div
class=
"col-md-6"
>
新建Namespace
</div>
<div
class=
"col-md-6 text-right"
>
<button
type=
"button"
class=
"btn btn-info"
ng-
show=
"step == 2"
ng-
click=
"back()"
>
返回到项目首页
<button
type=
"button"
class=
"btn btn-info"
ng-click=
"back()"
>
返回到项目首页
</button>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment